From 3e30658de8d8ac6cab3a066892ff5d06974b6ba0 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 19 Jan 2020 21:34:10 +0100 Subject: [PATCH 01/15] Bug solde is rounded and doesn't have decimal --- include/class/acc_account_ledger.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/class/acc_account_ledger.class.php b/include/class/acc_account_ledger.class.php index 3cc75754a..18c58e1c0 100644 --- a/include/class/acc_account_ledger.class.php +++ b/include/class/acc_account_ledger.class.php @@ -325,7 +325,7 @@ class Acc_Account_Ledger return array('debit'=>$r['sum_deb'], 'credit'=>$r['sum_cred'], - 'solde'=>abs(bcsub($r['sum_deb'],$r['sum_cred']))); + 'solde'=>abs(bcsub($r['sum_deb'],$r['sum_cred'],2))); } /*! * \brief isTva tell is a poste is used for VAT From c8bd525a425d3a7683d51155d37579e8497176e4 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 19 Jan 2020 21:34:34 +0100 Subject: [PATCH 02/15] Test Acc_Account --- .../include/class/acc_account.classTest.php | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/unit-test/include/class/acc_account.classTest.php b/unit-test/include/class/acc_account.classTest.php index 91343d73a..676899a09 100644 --- a/unit-test/include/class/acc_account.classTest.php +++ b/unit-test/include/class/acc_account.classTest.php @@ -16,7 +16,7 @@ class Acc_AccountTest extends TestCase * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ - protected function setUp() :void + protected function setUp() { global $g_connection, $g_parameter, $g_user; $_REQUEST['gDossier']=DOSSIER; @@ -129,7 +129,6 @@ class Acc_AccountTest extends TestCase $this->assertEquals($ex->getCode(),EXC_PARAM_VALUE); } $duplicate->set_parameter('pcm_val','999TEST'); - $duplicate->insert(); $duplicate->delete(); } @@ -154,11 +153,15 @@ class Acc_AccountTest extends TestCase /** * @covers Acc_Account::insert + * @covers Acc_Account::find_by_value */ public function testInsert() { $cn=Dossier::connect(); + $cn->exec_sql("delete from tmp_pcmn where pcm_val=$1", + ['400A']); $new=new Acc_Account($cn); + $new->set_parameter("pcm_val", '400A'); $new->set_parameter("pcm_val_parent", "400"); $new->set_parameter("pcm_direct_use", "Y"); @@ -172,11 +175,16 @@ class Acc_AccountTest extends TestCase catch (Exception $e) { $this->assertEquals($e->getCode(), EXC_PARAM_VALUE); + $new->delete(); } $new->set_parameter("pcm_lib", "Insertion test"); $new->insert(); + $check=new Acc_Account($cn); + $check->find_by_value('400A'); + $this->assertEquals("Insertion test",$check->get_lib()); $new->delete(); + } /** @@ -201,11 +209,14 @@ class Acc_AccountTest extends TestCase public function testSave() { global $g_connection; + $g_connection->exec_sql("delete from tmp_pcmn where pcm_val=$1", + ['999TEST']); $check=new Acc_Account($g_connection,'999TEST'); $check->set_parameter("pcm_lib", "TESTING"); $check->set_parameter('pcm_val_parent','9'); $check->set_parameter('pcm_direct_use','N'); // insert + $check->save(); $check_new=new Acc_Account($g_connection,'999TEST'); $this->assertEquals($check_new->get_lib(),$check->get_lib()); @@ -216,5 +227,11 @@ class Acc_AccountTest extends TestCase $this->assertNotEquals($check_new->get_lib(),"TESTING"); $check->delete(); } - + + public function testfind_parent() + { + $this->object->set_parameter("pcm_val", 70000000); + $result=$this->object->find_parent(); + $this->assertEquals($result,700); + } } From 397892effae65641b44f9242530da9475d4ea52d Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 22 Feb 2020 11:13:23 +0100 Subject: [PATCH 03/15] Minimum version : PHP 7.0 and PostgreSQL 9.5 --- html/install.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/html/install.php b/html/install.php index c8b188dcd..b56adf76c 100644 --- a/html/install.php +++ b/html/install.php @@ -316,8 +316,8 @@ if (!defined('PHP_VERSION_ID')) { define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); } -if ( PHP_VERSION_ID < 50500) { - echo $g_failed. " ".phpversion." ". _("Version PHP trop basse , minimum 5.4"); +if ( PHP_VERSION_ID < 70033) { + echo $g_failed. " ".phpversion." ". _("Version PHP trop basse , minimum 7.0.33"); } else { echo $g_succeed. " ".phpversion(); @@ -420,10 +420,10 @@ $version=$cn->get_value($sql); echo _("Version base de données :"),$version; $majeur=explode(".",$version); -if ( $majeur[0] < 9 ) +if ( $majeur[0] < 9 && $majeur[0] < 5 ) { ?> -

From 353bacaf37e19ece9335a4e8354c1100b1df0c75 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 22 Feb 2020 11:14:45 +0100 Subject: [PATCH 04/15] Noalyss_CSV : add setter and getter --- include/lib/noalyss_csv.class.php | 116 ++++++++++++++++++++++++++++-- 1 file changed, 111 insertions(+), 5 deletions(-) diff --git a/include/lib/noalyss_csv.class.php b/include/lib/noalyss_csv.class.php index 4eefce8d6..669403431 100644 --- a/include/lib/noalyss_csv.class.php +++ b/include/lib/noalyss_csv.class.php @@ -58,7 +58,7 @@ class Noalyss_Csv * Correct the name of the file , remove forbidden character and * add extension and date */ - private function correct_name() + protected function correct_name() { if (trim(strlen($this->filename))==0) { record_log('CSV->correct_name filename is empty'); @@ -157,7 +157,7 @@ class Noalyss_Csv /** * clean the row */ - private function clean() + protected function clean() { $this->element=array(); $this->size=0; @@ -166,7 +166,7 @@ class Noalyss_Csv * format the number for the CSV export * @param $p_number number */ - private function nb($p_number) + protected function nb($p_number) { $p_number=trim($p_number); if ($p_number=="") {return $p_number;} @@ -177,12 +177,118 @@ class Noalyss_Csv } return $r; } - private function encode($str) + protected function encode($str) { if ($this->encoding=="utf8") return $str; if ($this->encoding=="latin1") return utf8_decode ($str); throw new Exception(_("Encodage invalide")); } - + /** + * @return mixed + */ + public function get_filename() + { + return $this->filename; + return $this; + } + + /** + * @param mixed $filename + */ + public function set_filename($filename) + { + $this->filename = $filename; + return $this; + } + + /** + * @return array + */ + public function get_element() + { + return $this->element; + return $this; + } + + /** + * @param array $element + */ + public function set_element($element) + { + $this->element = $element; + return $this; + } + + /** + * @return mixed + */ + public function get_sep_field() + { + return $this->sep_field; + return $this; + } + + /** + * @param mixed $sep_field + */ + public function set_sep_field($sep_field) + { + $this->sep_field = $sep_field; + return $this; + } + + /** + * @return mixed + */ + public function get_sep_dec() + { + return $this->sep_dec; + return $this; + } + + /** + * @param mixed $sep_dec + */ + public function set_sep_dec($sep_dec) + { + $this->sep_dec = $sep_dec; + return $this; + } + + /** + * @return mixed + */ + public function get_encoding() + { + return $this->encoding; + return $this; + } + + /** + * @param mixed $encoding + */ + public function set_encoding($encoding) + { + $this->encoding = $encoding; + return $this; + } + + /** + * @return int + */ + public function get_size() + { + return $this->size; + return $this; + } + + /** + * @param int $size + */ + public function set_size($size) + { + $this->size = $size; + return $this; + } } From 68e1d75a608ce6b772d564cd814bd931ffd35296 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 26 Feb 2020 21:02:03 +0100 Subject: [PATCH 05/15] Task #0001699: Affichage PDF balance - totaux niveaux, etc'. --- include/class/acc_balance.class.php | 7 +++---- include/export/export_balance_pdf.php | 21 +++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/class/acc_balance.class.php b/include/class/acc_balance.class.php index 6fbf2fc36..71469ab72 100644 --- a/include/class/acc_balance.class.php +++ b/include/class/acc_balance.class.php @@ -273,11 +273,10 @@ class Acc_Balance // Add the saldo $i+=1; $delta=bcsub($tot_deb,$tot_cred); - $side_delta=($delta<0)?"C":"D"; - $side_delta=($delta==0)?"=":$side_delta; - + $side_delta=findSide($delta); + $a['poste']=""; - $a['label']="Totaux ".nbm(abs($delta)).$side_delta; + $a['label']=sprintf(_("Totaux %s %s"),nbm(abs($delta)),$side_delta); $a['sum_deb']=$tot_deb; $a['sum_cred']=$tot_cred; $a['solde_deb']=$tot_deb_saldo; diff --git a/include/export/export_balance_pdf.php b/include/export/export_balance_pdf.php index 2490bb13f..03bc3ee09 100644 --- a/include/export/export_balance_pdf.php +++ b/include/export/export_balance_pdf.php @@ -176,31 +176,32 @@ if (!empty($array)) { if (${'lvl' . $ind . '_old'} == '') ${'lvl' . $ind . '_old'} = substr($r['poste'], 0, $ind); if (${'lvl' . $ind . '_old'} != substr($r['poste'], 0, $ind)) { $pdf->SetFont('DejaVu', 'B', 7); - $pdf->LongLine(30, 6, ${'lvl' . $ind . '_old'}); + $strTotal=sprintf(_("Totaux %s "),${'lvl' . $ind . '_old'}); + $pdf->LongLine(30, 6, $strTotal,"TB"); $delta = bcsub(${'nlvl' . $ind}['solde_cred'], ${'nlvl' . $ind}['solde_deb']); $side = ($delta < 0) ? "D" : "C"; if ($previous == 1) { $delta_previous = bcsub(${'nlvl' . $ind}['solde_cred_previous'], ${'nlvl' . $ind}['solde_deb_previous']); $side_previous = ($delta_previous < 0) ? "D" : "C"; - $pdf->write_cell(60, 6, " ", 0, 0, 'R'); - $pdf->write_cell(22, 6, nbm(${'nlvl' . $ind}['sum_deb_previous']), 0, 0, 'R'); - $pdf->write_cell(22, 6, nbm(${'nlvl' . $ind}['sum_cred_previous']), 0, 0, 'R'); - $pdf->write_cell(22, 6, nbm(abs($delta_previous)) . " $side_previous", 0, 0, 'R'); + $pdf->write_cell(60, 6, sprintf(_("niveau %s"),$ind), "TB", 0, 'R'); + $pdf->write_cell(22, 6, nbm(${'nlvl' . $ind}['sum_deb_previous']), "TB", 0, 'R'); + $pdf->write_cell(22, 6, nbm(${'nlvl' . $ind}['sum_cred_previous']), "TB", 0, 'R'); + $pdf->write_cell(22, 6, nbm(abs($delta_previous)) . " $side_previous", "TB", 0, 'R'); } else { - $pdf->write_cell(60, 6, " ", 0, 0, 'R'); + $pdf->write_cell(60, 6, sprintf(_("niveau %s"),$ind), "TB", 0, 'R'); } $solde_lv = bcsub(${'nlvl' . $ind}['sum_deb_ope'], ${'nlvl' . $ind}['sum_cred_ope']); $side_lv = ($solde_lv < 0) ? " C" : " D"; $side_lv = ($solde_lv == 0) ? " " : $side_lv; - $pdf->write_cell(25, 6, nbm(abs($solde_lv)) . $side_lv, 0, 0, 'R'); - $pdf->write_cell(25, 6, nbm(bcsub(${'nlvl' . $ind}['sum_deb'], ${'nlvl' . $ind}['sum_deb_ope'])), 0, 0, 'R'); - $pdf->write_cell(25, 6, nbm(bcsub(${'nlvl' . $ind}['sum_cred'], ${'nlvl' . $ind}['sum_cred_ope'])), 0, 0, 'R'); + $pdf->write_cell(25, 6, nbm(abs($solde_lv)) . $side_lv, "TB", 0, 'R'); + $pdf->write_cell(25, 6, nbm(bcsub(${'nlvl' . $ind}['sum_deb'], ${'nlvl' . $ind}['sum_deb_ope'])), "TB", 0, 'R'); + $pdf->write_cell(25, 6, nbm(bcsub(${'nlvl' . $ind}['sum_cred'], ${'nlvl' . $ind}['sum_cred_ope'])), "TB", 0, 'R'); $solde_lv = bcsub(${'nlvl' . $ind}['solde_deb'], ${'nlvl' . $ind}['solde_cred']); $side_lv = ($solde_lv > 0) ? "D" : "C"; $side_lv = ($solde_lv == 0) ? "" : $side_lv; - $pdf->write_cell(25, 6, nbm(abs($solde_lv)) . " $side_lv", 0, 0, 'R'); + $pdf->write_cell(25, 6, nbm(abs($solde_lv)) . " $side_lv", "TB", 0, 'R'); $pdf->line_new(); $pdf->SetFont('DejaVuCond', '', 7); ${'lvl' . $ind . '_old'} = substr($r['poste'], 0, $ind); From 775a7f358e35b75627bf76c484f1667789785759 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 26 Feb 2020 22:42:30 +0100 Subject: [PATCH 06/15] replace $_GET by httpInput --- include/ajax/ajax_card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php index 5c291bc13..980215825 100644 --- a/include/ajax/ajax_card.php +++ b/include/ajax/ajax_card.php @@ -96,6 +96,7 @@ $html=var_export($_REQUEST,true); // For storing extra information , example the HTML elt id to update // after creating $extra=""; +$http=new \HttpInput(); switch($op2) { /* ------------------------------------------------------------ */ @@ -103,12 +104,11 @@ switch($op2) /* ------------------------------------------------------------ */ case 'rmfa': if ($g_user->check_action(FICCAT)==0)exit(); - ob_start(); - if( ! isset($_GET['ad_id']) || isNumber($_GET['ad_id']) ==0) - throw new Exception ( _("Parametre ad_id est invalide"),11); - $ad_id= $_GET['ad_id']; + + ob_start(); try { + $ad_id= $http->get("ad_id","number"); $cn->start(); $fa=new Fiche_Attr($cn,$ad_id); $fa->delete(); @@ -117,6 +117,7 @@ case 'rmfa': catch (Exception $e) { $cn->rollback(); + record_log($e->getMessage()); record_log($e->getTraceAsString()); echo $e->getMessage(); } From bc1db914103925bc254c863e8028f7aab6d74825 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 26 Feb 2020 22:42:43 +0100 Subject: [PATCH 07/15] remove blank line --- html/js/card.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/html/js/card.js b/html/js/card.js index 95b731ea6..70ede3254 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -730,6 +730,7 @@ function save_card(obj) smoke.alert('Poste comptable trop grand'); return false; } + // Data must be taken here var data=$('save_card').serialize(false); @@ -896,6 +897,7 @@ function update_card(obj) { try { var name=obj.id; + var qs=Form.serialize(name)+'&op2=upc&op=card'; var action=new Ajax.Request ( 'ajax_misc.php', { From 71a063a31d73b22433f2ce937c983afeb61d46da Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 26 Feb 2020 22:43:01 +0100 Subject: [PATCH 08/15] Task #1756: Avertissement qcode --- include/class/fiche.class.php | 16 ++++++++++++++-- include/lib/message_javascript.php | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index 15ebe00d1..9a300b447 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -529,10 +529,18 @@ class Fiche $w->name = "av_text" . $attr->ad_id; if ($attr->ad_id == 21 || $attr->ad_id==22||$attr->ad_id==20||$attr->ad_id==31) { - $bulle=Icon_Action::infobulle(21); + $bulle=Icon_Action::infobulle( 21); } - if ($attr->ad_id == ATTR_DEF_NAME || $attr->ad_id== ATTR_DEF_QUICKCODE) + + // Warning length quickcode + if ($attr->ad_id== ATTR_DEF_QUICKCODE ) { + $bulle=Icon_Action::warnbulle(76); + } + if ($attr->ad_id == ATTR_DEF_NAME || $attr->ad_id== ATTR_DEF_QUICKCODE) + { $class=" input_text highlight info"; + + } else $class="input_text"; $r.="" . td(_($w->label)." $bulle", ' class="'.$class.'" ') . td($w->input()." $msg")." "; @@ -720,6 +728,10 @@ class Fiche else $class="input_text"; + // Warning length quickcode + if ($r->ad_id== ATTR_DEF_QUICKCODE ) { + $bulle=Icon_Action::warnbulle(76); + } $ret.="".td(_($r->ad_text).$bulle,'class="'.$class.'"').td($w->input()." ".$msg)." "; } diff --git a/include/lib/message_javascript.php b/include/lib/message_javascript.php index c702b588e..6e54ab8d8 100644 --- a/include/lib/message_javascript.php +++ b/include/lib/message_javascript.php @@ -106,4 +106,5 @@ content[72]=""; content[74]=""; content[75]=""; +content[76]=""; \ No newline at end of file From 3fe0a06a638463ed2708230b4afc8b3d68c2ccbb Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 1 Mar 2020 12:14:36 +0100 Subject: [PATCH 09/15] =?UTF-8?q?Task=20#1694:=20Op=C3=A9ration=20FIN:=20o?= =?UTF-8?q?p=C3=A9ration=20li=C3=A9e=20-=20code=20fiche=20mais=20pas=20nom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/js/scripts.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/html/js/scripts.js b/html/js/scripts.js index 734d0554a..af9f5ac66 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -1399,6 +1399,20 @@ function set_reconcile(obj) if (tiers && tiers.value != "") { $(tiers.value).value = elmt.value; + /* set the name */ + new Ajax.Request("fid.php",{ + method:"get", + parameters:{gDossier:obj.elements['gDossier'].value,"FID":elmt.value}, + onSuccess:function(req){ + // find the row number + //tiers.value = e_othern + var tiers_card=new String(tiers.value); + var num=tiers_card.replace("e_other",""); + var tiers_name_id="e_other"+"_name"+num; + var answer = req.responseText.evalJSON(); + $(tiers_name_id).value=answer["name"]; + } + }); } } $(ctlc.value).value += nValue; From 5bd1ed9373638386e2ce079f43852bf7d9849015 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Mon, 2 Mar 2020 20:39:15 +0100 Subject: [PATCH 10/15] Task #0001704: Faciliter l'ajout de plusieurs lignes --- html/js/acc_ledger.js | 16 ++++++++++++++++ include/class/acc_ledger.class.php | 1 + include/class/acc_ledger_purchase.class.php | 2 +- include/class/acc_ledger_sold.class.php | 3 +-- include/class/pre_op_advanced.class.php | 1 + include/class/pre_op_ven.class.php | 2 +- include/compta_fin.inc.php | 2 +- include/operation_ods_new.inc.php | 2 +- 8 files changed, 23 insertions(+), 6 deletions(-) diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index d6b288252..f236bf34b 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -344,6 +344,22 @@ function ledger_fin_add_row() nb.value++; } +/** + * Add multiple row + * @param p_numrow + */ +function ledger_add_multiple(p_elid) +{ + var nbrow=$(p_elid).value; + if (nbrow == NaN) {nbrow=1;} + var type_ledger=$(p_elid+"_ledger").value; + var i=0; + for (i=0;iid . "').focus()"); return $r; } diff --git a/include/class/pre_op_advanced.class.php b/include/class/pre_op_advanced.class.php index ec78536a7..2c110fe45 100644 --- a/include/class/pre_op_advanced.class.php +++ b/include/class/pre_op_advanced.class.php @@ -284,6 +284,7 @@ class Pre_Op_Advanced extends Pre_operation_detail // If readonly == 1 then show CA } $ret.=''; + $ret.=Html_Input_Noalyss::ledger_add_item("M"); return $ret; } } diff --git a/include/class/pre_op_ven.class.php b/include/class/pre_op_ven.class.php index 0a2c79dae..c76252c1b 100644 --- a/include/class/pre_op_ven.class.php +++ b/include/class/pre_op_ven.class.php @@ -406,8 +406,8 @@ class Pre_op_ven extends Pre_operation_detail // Set correctly the REQUEST param for jrn_type $r.=HtmlInput::hidden('jrn_type','VEN'); + $r.= Html_Input_Noalyss::ledger_add_item("O"); - $r.=HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_add_row()"'); return $r; } } diff --git a/include/compta_fin.inc.php b/include/compta_fin.inc.php index 7627696a1..b15f39d6d 100644 --- a/include/compta_fin.inc.php +++ b/include/compta_fin.inc.php @@ -145,7 +145,7 @@ try { echo $Ledger->input($array); - echo HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_fin_add_row()"'); + echo Html_Input_Noalyss::ledger_add_item("F"); echo HtmlInput::submit('save',_('Sauve')); echo HtmlInput::reset(_('Effacer')); diff --git a/include/operation_ods_new.inc.php b/include/operation_ods_new.inc.php index 9396314ad..bad4da0bc 100644 --- a/include/operation_ods_new.inc.php +++ b/include/operation_ods_new.inc.php @@ -94,7 +94,7 @@ $iconcerned->amount_id="totalDeb"; printf (_("Opération rapprochée : %s"),$iconcerned->input()); echo '

'; -echo HtmlInput::button('add', _('Ajout d\'une ligne'), 'onClick="quick_writing_add_row()"'); +echo Html_Input_Noalyss::ledger_add_item("M"); echo HtmlInput::submit('summary', _('Sauvez')); echo '

'; From 53a36e7ab65982a28fec7df02f20914fb14fe55f Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Mon, 2 Mar 2020 20:39:34 +0100 Subject: [PATCH 11/15] =?UTF-8?q?Cosmetic=20:=20Op=C3=A9ration=20pr=C3=A9d?= =?UTF-8?q?=C3=A9finie,=20mod=C3=A8le?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/js/scripts.js | 4 +--- include/class/pre_op_ach.class.php | 19 ++++++++++--------- include/class/pre_operation.class.php | 16 ++++++++-------- include/template/predf_ledger_detail.php | 2 +- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/html/js/scripts.js b/html/js/scripts.js index af9f5ac66..ae36f0445 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -1227,9 +1227,7 @@ function mod_predf_op(dossier_id, od_id) { var target = "mod_predf_op"; removeDiv(target); - var sx = '20%'; - var sy = '10%'; - var str_style = "top:" + sx + ";left:" + sy + ";"; + var str_style = "top:10%;left:2%;width:96%"; var div = {id: target, cssclass: 'inner_box', style: str_style, html: loading(), drag: 1}; diff --git a/include/class/pre_op_ach.class.php b/include/class/pre_op_ach.class.php index 00fbad9b0..fb9640e77 100644 --- a/include/class/pre_op_ach.class.php +++ b/include/class/pre_op_ach.class.php @@ -40,18 +40,19 @@ class Pre_op_ach extends Pre_operation_detail function get_post() { parent::get_post(); + $http=new HttpInput(); $this->operation->od_direct='f'; - $this->e_client=$_POST['e_client']; + $this->e_client=$http->post('e_client'); for ($i=0;$i<$this->operation->nb_item;$i++) { $march="e_march".$i; - $this->$march=$_POST['e_march'.$i]; - $this->{"e_march".$i."_price"}=(isset ($_POST['e_march'.$i."_price"]))?$_POST['e_march'.$i."_price"]:0; - $this->{"e_march".$i."_price"}=(trim($_POST['e_march'.$i."_price"])=="")?0:$_POST['e_march'.$i."_price"]; - $this->{"e_march".$i."_tva_id"}=(isset ($_POST['e_march'.$i."_tva_id"]))?$_POST['e_march'.$i."_tva_id"]:0; - $this->{"e_march".$i."_tva_amount"}=(isset($_POST['e_march'.$i."_tva_amount"]))?$_POST['e_march'.$i."_tva_amount"]:0; - $this->{"e_march".$i."_label"}=(isset($_POST['e_march'.$i."_label"]))?$_POST['e_march'.$i."_label"]:null; - $this->{"e_quant".$i}=$_POST['e_quant'.$i]; + $this->$march=$http->post('e_march'.$i); + $this->{"e_march".$i."_price"}=$http->post('e_march'.$i."_price","string",0); + $this->{"e_march".$i."_price"}=$http->post('e_march'.$i."_price","string",0); + $this->{"e_march".$i."_tva_id"}=$http->post('e_march'.$i."_tva_id","string",0); + $this->{"e_march".$i."_tva_amount"}=$http->post('e_march'.$i."_tva_amount","string",0); + $this->{"e_march".$i."_label"}=$http->post('e_march'.$i."_label","string",NULL); + $this->{"e_quant".$i}=$http->post('e_quant'.$i); } } @@ -403,7 +404,7 @@ class Pre_op_ach extends Pre_operation_detail // Set correctly the REQUEST param for jrn_type $r.= HtmlInput::hidden('jrn_type','ACH'); - $r.= HtmlInput::button('add_item',_('Ajout article'), ' onClick="ledger_add_row()"'); + $r.= Html_Input_Noalyss::ledger_add_item("O"); return $r; } diff --git a/include/class/pre_operation.class.php b/include/class/pre_operation.class.php index 885e7a1fd..8243b58bb 100644 --- a/include/class/pre_operation.class.php +++ b/include/class/pre_operation.class.php @@ -71,14 +71,14 @@ class Pre_operation /*!\brief fill the object with the $_POST variable */ function get_post() { - $this->nb_item=$_POST['nb_item']; - $this->p_jrn=$_REQUEST['p_jrn']; - $this->jrn_type=$_POST['jrn_type']; - - $this->name=$_POST['opd_name']; + $http=new HttpInput(); + $this->nb_item=$http->post('nb_item',"number"); + $this->p_jrn=$http->request('p_jrn',"number"); + $this->jrn_type=$http->post('jrn_type'); + $this->name=$http->post('opd_name'); - $this->name=(trim($this->name)=='')?$_POST['e_comm']:$this->name; - $this->description= $_POST['od_description']; + $this->name=(trim($this->name)=='')?$http->post('e_comm'):$this->name; + $this->description= $http->post('od_description'); if ( $this->name=="") { $n=$this->db->get_next_seq('op_def_op_seq'); @@ -106,7 +106,7 @@ class Pre_operation } if ( $this->count() > MAX_PREDEFINED_OPERATION ) { - echo ''.("Vous avez atteint le max. d'opération prédéfinie, désolé").''; + echo ''.("Vous avez atteint le max. d'opération prédéfinie, désolé").''; return false; } $sql='insert into op_predef (jrn_def_id,od_name,od_item,od_jrn_type,od_direct,od_description)'. diff --git a/include/template/predf_ledger_detail.php b/include/template/predf_ledger_detail.php index 972353466..a3cdd8f8a 100644 --- a/include/template/predf_ledger_detail.php +++ b/include/template/predf_ledger_detail.php @@ -36,7 +36,7 @@ echo ''; echo $item['quick_code']; echo ''.$item['bt'].''; ?> - + Date: Thu, 5 Mar 2020 23:25:40 +0100 Subject: [PATCH 12/15] if you want to modify the accounting , it must not be used before. --- include/class/acc_plan_mtable.class.php | 81 +++++++++++++++++++------ 1 file changed, 62 insertions(+), 19 deletions(-) diff --git a/include/class/acc_plan_mtable.class.php b/include/class/acc_plan_mtable.class.php index 9f37cbcb8..b5537e957 100644 --- a/include/class/acc_plan_mtable.class.php +++ b/include/class/acc_plan_mtable.class.php @@ -62,21 +62,24 @@ class Acc_Plan_MTable extends Manage_Table_SQL ["label"=>_("Produit inversé"),"value"=>"PROINV"], ["label"=>_("Contexte"),"value"=>"CON"] ]); - $this->set_col_type("pcm_direct_use", "select",array(["label"=>_("Oui"),"value"=>"Y"],["label"=>"Non","value"=>"N"])); - $this->a_order=["pcm_val","pcm_lib","parent_accounting","pcm_direct_use","pcm_type","fiche_qcode"]; + $this->set_col_type("pcm_direct_use", "select", + array(["label" => _("Oui"), "value" => "Y"], ["label" => "Non", "value" => "N"])); + $this->set_col_type("pcm_val", "custom"); + $this->a_order = ["pcm_val", "pcm_lib", "parent_accounting", "pcm_direct_use", "pcm_type", "fiche_qcode"]; $this->set_icon_mod("first"); } + /** * Display a row * @param type $p_row array of value key column=>value */ function display_row($p_row) { - printf('', + printf('', $this->object_name, $p_row[$this->table->primary_key]) ; - + $dossier_id=Dossier::id(); $nb_order=count($this->a_order); for ($i=0; $i<$nb_order; $i++) @@ -99,29 +102,29 @@ class Acc_Plan_MTable extends Manage_Table_SQL elseif ($v == "fiche_qcode") { $count=$this->table->cn->get_value("select count(*) from fiche_detail where ad_id=5 and ad_value=$1",array($p_row['pcm_val'])); if ($count == 0) echo td(""); - elseif ($count == 1 ) { + elseif ($count == 1 ) { echo ''; - echo HtmlInput::card_detail($p_row[$v]) ; + echo HtmlInput::card_detail($p_row[$v]) ; echo ''; - + } - elseif ($count > 1) { + elseif ($count > 1) { echo ''; $a_code=explode(",",$p_row[$v]); $nb_code=count($a_code); for ($xx = 0;$xx < $nb_code;$xx++) { - echo HtmlInput::card_detail($a_code[$xx])."," ; + echo HtmlInput::card_detail($a_code[$xx])."," ; } echo " ($count) "; echo Icon_Action::more(uniqid(), sprintf("display_all_card('%s','%s')",$dossier_id,$p_row["pcm_val"])); echo ''; - - } + + } } elseif ($v=="pcm_lib") { - + if ( $nb >0){ echo ""; if ($nb_used > 0) { @@ -148,13 +151,14 @@ class Acc_Plan_MTable extends Manage_Table_SQL echo ''; } + /** - * Check that the entered data are valid before recording them into + * Check that the entered data are valid before recording them into * tmp_pcmn, the errors are stored into this->a_error and if someting wrong * is found it returns false, if the data can be saved it returns true - * @return return false if an error is found, + * @return return false if an error is found, */ - function check() + function check() { $cn=Dossier::connect(); $count=$cn->get_value("select count(*) from tmp_pcmn where pcm_val = $1 and id <> $2", @@ -180,12 +184,25 @@ class Acc_Plan_MTable extends Manage_Table_SQL if ($exist_parent == 0) { $this->set_error("parent_accounting", _("Compte parent n'existe pas")); } - if ( count($this->aerror) > 0 ) return false; + /** + * check that accounting is not already used + */ + $old_accounting = $cn->get_value("select pcm_val from tmp_pcmn where id = $1", + array($this->table->id)); + // it is not a new accounting and is different + if ($old_accounting != "" && $old_accounting != $this->table->pcm_val) { + // count it is used + if ($cn->get_value("select count(*) from jrnx where j_poste=$1", + [$old_accounting]) > 0) { + $this->set_error("pcm_val", _("Poste utilisé")); + } + } + if (count($this->aerror) > 0) return false; return true; } - + /** - * @brief display into a dialog box the datarow in order + * @brief display into a dialog box the datarow in order * to be appended or modified. Can be override if you need * a more complex form */ @@ -195,5 +212,31 @@ class Acc_Plan_MTable extends Manage_Table_SQL $dossier_id=Dossier::id(); echo HtmlInput::button_action(_("Toutes les fiches") , sprintf("display_all_card('%s','%s')",$dossier_id,$this->table->pcm_val)); } - + + /** + * if pcm_val already used then it cannot be modified + * + * @param $p_key always pcm_val + * @param $p_value current value of pcm_val + * @return nothing|void + */ + function input_custom($p_key, $p_value) + { + $readonly=true; + $cn=Dossier::connect(); + if ( + $p_value == "" || + ($p_value !="" && $cn->get_value("select count(*) from jrnx where j_poste=$1",[$p_value]) == 0 ) + ) + { + $readonly=false; + } + $text=new IText($p_key); + $text->setReadOnly($readonly); + $text->value=$p_value; + $min_size=(strlen($p_value)<30)?30:strlen($p_value)+5; + $text->size=$min_size; + echo $text->input(); + } + } From 6c4c728d17e6415353c46dda5776113d8b4332b3 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 20 Mar 2020 20:05:08 +0100 Subject: [PATCH 13/15] HtmlOutput tab , add mode row --- html/style-classic.css | 105 +++++++++++++++++++- html/style-classic7.css | 105 +++++++++++++++++++- html/style-light.css | 105 +++++++++++++++++++- include/lib/output_html_tab.class.php | 137 ++++++++++++++++++++++---- 4 files changed, 430 insertions(+), 22 deletions(-) diff --git a/html/style-classic.css b/html/style-classic.css index ae70d4123..c24061e9e 100644 --- a/html/style-classic.css +++ b/html/style-classic.css @@ -2316,4 +2316,107 @@ span.warning { background-color: #eddadd; padding:10px; border:red solid 1px; -} \ No newline at end of file +} + /**********************************************************************************************************************/ + /* LI as list + * Tabs like row + ****************************************************************************/ + ul.tab_row { + padding-top: 15px; + display:block; + width:96%; + padding-left:2%; + padding-right:2%; + list-style: none; + margin-left:2px; + } + ul.tab_row a { + display:block; + width:100%; + } + li.tab_row_selected { + display:block; + width:90%; + background: #C2E3FC; /* Old browsers */ + background: -moz-linear-gradient(top, #C2E3FC 0%, #6393c1 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E3FC), color-stop(100%,#6393c1)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* IE10+ */ + background: linear-gradient(to bottom, #C2E3FC 0%,#6393c1 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#C2E3FC', endColorstr='#6393c1',GradientType=0 ); /* IE6-9 */ + color:whitesmoke; + margin-left: 2px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border:1px #879ed4 solid; + font-weight: bold; + padding:5px; + margin-top:13px; + + + } + li.tab_row { + display:block; + width:90%; + background-color: inherit; + color:inherit;/*! margin-left: 0px; */ + /*! padding: 5px; */ + /*! border-top-left-radius: 10px; */ + /*! border-top-right-radius: 10px; */ + border:1px #879ed4 solid; + background: whitesmoke; + margin-top:13px; + + } + li.tab_row:hover { + display:block; + background-color: lightblue; + color:wheat;margin-left: 2px; + padding: 5px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border:1px #879ed4 solid; + white-space: nowrap; + + } + @media only screen and (min-width: 1280px) { + li.tab_row { + display:block; + background-color: inherit; + + + padding: 15px 7px 0px 10px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border:1px #879ed4 solid; + + } + li.tab_row:hover { + display:block; + background-color: lightblue; + color:wheat;margin-left: 2px; + padding: 15px 7px 0px 10px; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + border:1px #879ed4 solid; + } + li.tab_row_selected { + padding: 12px 15px 15px 15px; + } + } + ul.tab_row a { + text-decoration: none; + color:inherit; + display:block; + white-space: nowrap; + width: 100%; + height: 100%; + cursor :pointer; + } + ul.tab_row a:hover { + text-decoration: none; + color:white; + display:block; + background-color: lightblue; + } \ No newline at end of file diff --git a/html/style-classic7.css b/html/style-classic7.css index 51105a1e9..0842dec2b 100644 --- a/html/style-classic7.css +++ b/html/style-classic7.css @@ -2323,4 +2323,107 @@ span.warning { font-weight: bold; background-color: #eddadd; padding:10px; -} \ No newline at end of file +} +/**********************************************************************************************************************/ + /* LI as list + * Tabs like row + ****************************************************************************/ + ul.tab_row { + padding-top: 15px; + display:block; + width:96%; + padding-left:2%; + padding-right:2%; + list-style: none; + margin-left:2px; + } + ul.tab_row a { + display:block; + width:100%; + } + li.tab_row_selected { + display:block; + width:90%; + background: #C2E3FC; /* Old browsers */ + background: -moz-linear-gradient(top, #C2E3FC 0%, #6393c1 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E3FC), color-stop(100%,#6393c1)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* IE10+ */ + background: linear-gradient(to bottom, #C2E3FC 0%,#6393c1 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#C2E3FC', endColorstr='#6393c1',GradientType=0 ); /* IE6-9 */ + color:whitesmoke; + margin-left: 2px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border:1px #879ed4 solid; + font-weight: bold; + padding:5px; + margin-top:13px; + + + } + li.tab_row { + display:block; + width:90%; + background-color: inherit; + color:inherit;/*! margin-left: 0px; */ + /*! padding: 5px; */ + /*! border-top-left-radius: 10px; */ + /*! border-top-right-radius: 10px; */ + border:1px #879ed4 solid; + background: whitesmoke; + margin-top:13px; + + } + li.tab_row:hover { + display:block; + background-color: lightblue; + color:wheat;margin-left: 2px; + padding: 5px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border:1px #879ed4 solid; + white-space: nowrap; + + } + @media only screen and (min-width: 1280px) { + li.tab_row { + display:block; + background-color: inherit; + + + padding: 15px 7px 0px 10px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border:1px #879ed4 solid; + + } + li.tab_row:hover { + display:block; + background-color: lightblue; + color:wheat;margin-left: 2px; + padding: 15px 7px 0px 10px; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + border:1px #879ed4 solid; + } + li.tab_row_selected { + padding: 12px 15px 15px 15px; + } + } + ul.tab_row a { + text-decoration: none; + color:inherit; + display:block; + white-space: nowrap; + width: 100%; + height: 100%; + cursor :pointer; + } + ul.tab_row a:hover { + text-decoration: none; + color:white; + display:block; + background-color: lightblue; + } \ No newline at end of file diff --git a/html/style-light.css b/html/style-light.css index 1bb1762c9..df96649ce 100644 --- a/html/style-light.css +++ b/html/style-light.css @@ -2241,4 +2241,107 @@ span.warning { font-weight: bold; background-color: #eddadd; padding:10px; -} \ No newline at end of file +} + /**********************************************************************************************************************/ + /* LI as list + * Tabs like row + ****************************************************************************/ + ul.tab_row { + padding-top: 15px; + display:block; + width:96%; + padding-left:2%; + padding-right:2%; + list-style: none; + margin-left:2px; + } + ul.tab_row a { + display:block; + width:100%; + } + li.tab_row_selected { + display:block; + width:90%; + background: #C2E3FC; /* Old browsers */ + background: -moz-linear-gradient(top, #C2E3FC 0%, #6393c1 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E3FC), color-stop(100%,#6393c1)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #C2E3FC 0%,#6393c1 100%); /* IE10+ */ + background: linear-gradient(to bottom, #C2E3FC 0%,#6393c1 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#C2E3FC', endColorstr='#6393c1',GradientType=0 ); /* IE6-9 */ + color:whitesmoke; + margin-left: 2px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border:1px #879ed4 solid; + font-weight: bold; + padding:5px; + margin-top:13px; + + + } + li.tab_row { + display:block; + width:90%; + background-color: inherit; + color:inherit;/*! margin-left: 0px; */ + /*! padding: 5px; */ + /*! border-top-left-radius: 10px; */ + /*! border-top-right-radius: 10px; */ + border:1px #879ed4 solid; + background: whitesmoke; + margin-top:13px; + + } + li.tab_row:hover { + display:block; + background-color: lightblue; + color:wheat;margin-left: 2px; + padding: 5px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border:1px #879ed4 solid; + white-space: nowrap; + + } + @media only screen and (min-width: 1280px) { + li.tab_row { + display:block; + background-color: inherit; + + + padding: 15px 7px 0px 10px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; + border:1px #879ed4 solid; + + } + li.tab_row:hover { + display:block; + background-color: lightblue; + color:wheat;margin-left: 2px; + padding: 15px 7px 0px 10px; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + border:1px #879ed4 solid; + } + li.tab_row_selected { + padding: 12px 15px 15px 15px; + } + } + ul.tab_row a { + text-decoration: none; + color:inherit; + display:block; + white-space: nowrap; + width: 100%; + height: 100%; + cursor :pointer; + } + ul.tab_row a:hover { + text-decoration: none; + color:white; + display:block; + background-color: lightblue; + } \ No newline at end of file diff --git a/include/lib/output_html_tab.class.php b/include/lib/output_html_tab.class.php index 943faa4e3..cf54c5831 100644 --- a/include/lib/output_html_tab.class.php +++ b/include/lib/output_html_tab.class.php @@ -37,24 +37,101 @@ class Output_Html_Tab { private $a_tabs; //!< array of html tabs - + private $class_tab; //!< for normal tab + private $class_tab_selected; //!< for class_tab_selected + private $mode; //!< mode default tabs /** *@example html_tab.test.php */ function __construct() { $this->a_tabs=[]; + $this->class_tab="tabs"; + $this->class_tab_selected="tabs_selected"; } /** - * Add Html_Tab + * get the mode , possible value are row or tabs + * @return mixed + */ + public function get_mode() + { + return $this->mode; + return $this; + } + + /** + * set the mode , possible values are row or tabs + * @param mixed $mode + */ + public function set_mode($mode) + { + if ($mode != "row" && $mode != "tab") { + throw new Exception(_("OUTPUTHTML070 Mode invalide")); + } + $this->mode = $mode; + if ($mode == "row") { + $this->set_class_tab_selected("tab_row_selected"); + $this->set_class_tab("tab_row"); + } + if ( $mode == "tab") { + $this->set_class_tab_selected("tabs_selected"); + $this->set_class_tab("tabs"); + + } + return $this; + } + + /** + * Add Html_Tab * @param Html_Tab $p_html_tab */ function add(Html_Tab $p_html_tab) { $this->a_tabs[]=clone $p_html_tab; + } - + + /** + * get the CSS class of tabs + * @return mixed + */ + public function get_class_tab() + { + return $this->class_tab; + return $this; + } + + /** + * set the CSS class of tabs, default is tabs + * @param mixed $class_tab + */ + public function set_class_tab($class_tab) + { + $this->class_tab = $class_tab; + return $this; + } + + /** + * get the CSS class of tabs_selected + * @return mixed + */ + public function get_class_tab_selected() + { + return $this->class_tab_selected; + return $this; + } + + /** + * set the CSS class of tabs, default is tabs_selected + * @param mixed $class_tab_selected + */ + public function set_class_tab_selected($class_tab_selected) + { + $this->class_tab_selected = $class_tab_selected; + return $this; + } + /** * Build the javascript to change the class name of the selected tab, hide other div and show the selected one * @param string $p_not_hidden id of the showed tab @@ -66,20 +143,32 @@ class Output_Html_Tab $nb=count($this->a_tabs); for ($i =0 ; $i < $nb;$i++) { - if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) { - $r .= sprintf("$('div%s').hide();",$this->a_tabs[$i]->get_id() ); - $r .= sprintf("$('tab%s').className='tabs';",$this->a_tabs[$i]->get_id() ); - } else { - $r .= sprintf("$('div%s').show();",$p_not_hidden ); - $r .= sprintf("$('tab%s').className='tabs_selected';",$p_not_hidden ); - + if ($this->get_mode()=="tab") { + + if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) { + $r .= sprintf("$('div%s').hide();",$this->a_tabs[$i]->get_id() ); + $r .= sprintf("$('tab%s').className='%s';",$this->a_tabs[$i]->get_id(),$this->class_tab ); + } else { + $r .= sprintf("$('div%s').show();",$p_not_hidden ); + $r .= sprintf("$('tab%s').className='%s';",$p_not_hidden ,$this->class_tab_selected); + + } + } elseif ($this->get_mode()=="row") { + if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) { + $r .= sprintf("Effect.BlindUp('div%s',{duration : 1.0});",$this->a_tabs[$i]->get_id() ); + $r .= sprintf("$('tab%s').className='%s';",$this->a_tabs[$i]->get_id(),$this->class_tab ); + } else { + $r .= sprintf("Effect.SlideDown('div%s',{duration : 1.0});",$p_not_hidden ); + $r .= sprintf("$('tab%s').className='%s';",$p_not_hidden ,$this->class_tab_selected); + + } } } return $r; } /** * print the html + javascript code of the tabs and the div - * + * */ function output() { @@ -88,11 +177,11 @@ class Output_Html_Tab { return; } - echo '
    '; + printf ( '
      ',$this->class_tab); for ($i=0; $i<$nb; $i++) { - printf ('
    • ', - $this->a_tabs[$i]->get_id()); + printf ('
    • ', + $this->a_tabs[$i]->get_id(),$this->class_tab); switch ($this->a_tabs[$i]->get_mode()) { case 'link': @@ -122,14 +211,24 @@ class Output_Html_Tab break; } echo '
    • '; + if ( $this->get_mode()=="row") { + $this->print_div($i); + } } echo '
    '; - for ($i=0;$i<$nb;$i++) - { - printf(''; + if ( $this->get_mode()=="tab" ) { + for ($i=0;$i<$nb;$i++) + { + $this->print_div($i); + } + } } + private function print_div($p_index) + { + printf(''; + } } From 4e5029c4b7d8cad33ac69f30a920477f52bd010c Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 21 Mar 2020 11:41:14 +0100 Subject: [PATCH 14/15] Output_Html_Tab : cosmetic --- html/style-classic.css | 9 +++- html/style-classic7.css | 71 ++++++++++++++++++++------- html/style-light.css | 19 ++++++- include/lib/html_tab.class.php | 22 ++++++++- include/lib/output_html_tab.class.php | 37 ++++++++++++-- 5 files changed, 131 insertions(+), 27 deletions(-) diff --git a/html/style-classic.css b/html/style-classic.css index c24061e9e..e830a15b2 100644 --- a/html/style-classic.css +++ b/html/style-classic.css @@ -2419,4 +2419,11 @@ span.warning { color:white; display:block; background-color: lightblue; - } \ No newline at end of file + } +span.tab_row { + font-style: italic; + font-size:90%; +} +span.title_tab_row { + +} \ No newline at end of file diff --git a/html/style-classic7.css b/html/style-classic7.css index 0842dec2b..5b3233330 100644 --- a/html/style-classic7.css +++ b/html/style-classic7.css @@ -55,7 +55,6 @@ input:focus { font-style: italic; } - a.mtitle span.notice { text-decoration: underline; } @@ -2329,13 +2328,13 @@ span.warning { * Tabs like row ****************************************************************************/ ul.tab_row { - padding-top: 15px; + padding-top: 25px; display:block; - width:96%; - padding-left:2%; - padding-right:2%; + width:100%; + padding-left:0%; + padding-right:0%; list-style: none; - margin-left:2px; + margin-left:0px; } ul.tab_row a { display:block; @@ -2343,7 +2342,7 @@ span.warning { } li.tab_row_selected { display:block; - width:90%; + width:96%; background: #C2E3FC; /* Old browsers */ background: -moz-linear-gradient(top, #C2E3FC 0%, #6393c1 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#C2E3FC), color-stop(100%,#6393c1)); /* Chrome,Safari4+ */ @@ -2353,7 +2352,7 @@ span.warning { background: linear-gradient(to bottom, #C2E3FC 0%,#6393c1 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#C2E3FC', endColorstr='#6393c1',GradientType=0 ); /* IE6-9 */ color:whitesmoke; - margin-left: 2px; + /*! margin-left: 2px; */ border-top-left-radius: 10px; border-top-right-radius: 10px; border:1px #879ed4 solid; @@ -2362,15 +2361,17 @@ span.warning { margin-top:13px; + padding-left: 2%; + padding-right: 2%; } li.tab_row { display:block; - width:90%; + width:auto; background-color: inherit; color:inherit;/*! margin-left: 0px; */ - /*! padding: 5px; */ - /*! border-top-left-radius: 10px; */ - /*! border-top-right-radius: 10px; */ + padding: 5px; + border-top-left-radius: 10px; + border-top-right-radius: 10px; border:1px #879ed4 solid; background: whitesmoke; margin-top:13px; @@ -2391,9 +2392,8 @@ span.warning { li.tab_row { display:block; background-color: inherit; - - - padding: 15px 7px 0px 10px; + padding: 20px 15px 15px 20px; + margin: 20px 15px 15px 15px; border-top-left-radius: 10px; border-top-right-radius: 10px; border:1px #879ed4 solid; @@ -2403,13 +2403,15 @@ span.warning { display:block; background-color: lightblue; color:wheat;margin-left: 2px; - padding: 15px 7px 0px 10px; + padding: 20px 15px 15px 20px; + margin: 20px 15px 15px 15px; border-top-left-radius: 5px; border-top-right-radius: 5px; border:1px #879ed4 solid; } li.tab_row_selected { - padding: 12px 15px 15px 15px; + padding: 20px 15px 15px 20px; + margin:20px 15px 15px 15px; } } ul.tab_row a { @@ -2420,10 +2422,43 @@ span.warning { width: 100%; height: 100%; cursor :pointer; + text-align: center; + + + } ul.tab_row a:hover { text-decoration: none; color:white; display:block; background-color: lightblue; - } \ No newline at end of file + /*! text-align: center; */ + } + div.tab_row { + background-color: aliceblue; + border-color: #879ed4; + border-width: 1px; + border-style: solid; + } +span.tab_row { + font-style: italic; + font-size:90%; +} +span.title_tab_row { + font-size:105%; + font-weight: bold; + background-color: darkblue; + color:white; + padding : 3px; +} +span.tab_row { + font-style: italic; + font-size:90%; +} +span.title_tab_row { + font-size:105%; + font-weight: bold; + background-color: darkblue; + color:white; + padding : 3px; +} \ No newline at end of file diff --git a/html/style-light.css b/html/style-light.css index df96649ce..95b758593 100644 --- a/html/style-light.css +++ b/html/style-light.css @@ -2292,6 +2292,7 @@ span.warning { border:1px #879ed4 solid; background: whitesmoke; margin-top:13px; + padding:5px; } li.tab_row:hover { @@ -2311,7 +2312,7 @@ span.warning { background-color: inherit; - padding: 15px 7px 0px 10px; + padding: 15px 7px 15px 10px; border-top-left-radius: 10px; border-top-right-radius: 10px; border:1px #879ed4 solid; @@ -2338,10 +2339,24 @@ span.warning { width: 100%; height: 100%; cursor :pointer; + padding: 3px; } ul.tab_row a:hover { text-decoration: none; color:white; display:block; background-color: lightblue; - } \ No newline at end of file + } + +span.tab_row { + font-style: italic; + font-size:90%; +} +span.title_tab_row { + font-size:105%; + font-weight: bold; + background-color: darkblue; + color:white; + padding : 3px; + +} \ No newline at end of file diff --git a/include/lib/html_tab.class.php b/include/lib/html_tab.class.php index ee3304a39..55b51c090 100644 --- a/include/lib/html_tab.class.php +++ b/include/lib/html_tab.class.php @@ -35,7 +35,7 @@ class Html_Tab private $content ; //!< static content of the tab private $mode ; //!< possible values are static if the content is static, ajax for calling an ajax, link for a html link, default static private $link; //!< the javascript or an html link, depending of the $mode - + private $comment; //!< comment to add when we use the row /** *@example html_tab.test.php */ @@ -44,7 +44,27 @@ class Html_Tab $this->id=$p_id; $this->title=$p_title; $this->mode='static'; + $this->comment=""; } + + /** + * @return string + */ + public function get_comment() + { + return $this->comment; + return $this; + } + + /** + * @param string $comment + */ + public function set_comment($comment) + { + $this->comment = $comment; + return $this; + } + public function get_id() { return $this->id; diff --git a/include/lib/output_html_tab.class.php b/include/lib/output_html_tab.class.php index cf54c5831..c8af50d90 100644 --- a/include/lib/output_html_tab.class.php +++ b/include/lib/output_html_tab.class.php @@ -155,10 +155,10 @@ class Output_Html_Tab } } elseif ($this->get_mode()=="row") { if ( $this->a_tabs[$i]->get_id() != $p_not_hidden) { - $r .= sprintf("Effect.BlindUp('div%s',{duration : 1.0});",$this->a_tabs[$i]->get_id() ); + $r .= sprintf("Effect.BlindUp('div%s',{duration : 0.7});",$this->a_tabs[$i]->get_id() ); $r .= sprintf("$('tab%s').className='%s';",$this->a_tabs[$i]->get_id(),$this->class_tab ); } else { - $r .= sprintf("Effect.SlideDown('div%s',{duration : 1.0});",$p_not_hidden ); + $r .= sprintf("Effect.SlideDown('div%s',{duration : 0.7});",$p_not_hidden ); $r .= sprintf("$('tab%s').className='%s';",$p_not_hidden ,$this->class_tab_selected); } @@ -166,6 +166,18 @@ class Output_Html_Tab } return $r; } + + /** + * When printing row , a comment is written if not empty + * @param $p_index + */ + protected function print_comment($p_index) { + printf (' %s ', + $this->get_class_tab(), + $this->a_tabs[$p_index]->get_comment() + ); + + } /** * print the html + javascript code of the tabs and the div * @@ -188,7 +200,10 @@ class Output_Html_Tab printf ('', $this->a_tabs[$i]->get_id(), $this->a_tabs[$i]->get_link()); - echo $this->a_tabs[$i]->get_title(); + printf (' %s ', + $this->get_class_tab(), + $this->a_tabs[$i]->get_title() + ); echo ''; break; @@ -196,6 +211,11 @@ class Output_Html_Tab printf('', $this->a_tabs[$i]->get_id(), $this->a_tabs[$i]->get_link()); + printf (' %s ', + $this->get_class_tab(), + $this->a_tabs[$i]->get_title() + ); + echo $this->a_tabs[$i]->get_title(); echo ''; break; @@ -203,13 +223,20 @@ class Output_Html_Tab // show one , hide other $script=$this->build_js($this->a_tabs[$i]->get_id()); printf('', $script); - echo $this->a_tabs[$i]->get_title(); + printf (' %s ', + $this->get_class_tab(), + $this->a_tabs[$i]->get_title() + ); + echo ''; break; default: break; } + if ( $this->get_mode()=="row") { + $this->print_comment($i); + } echo ''; if ( $this->get_mode()=="row") { $this->print_div($i); @@ -226,7 +253,7 @@ class Output_Html_Tab } private function print_div($p_index) { - printf('