From 25fa2254c135f1212247386005effa65764af64c Mon Sep 17 00:00:00 2001 From: fhenry Date: Thu, 7 Mar 2013 10:50:02 +0100 Subject: [PATCH 1/5] Fix [ bug #753 ] cashdesk : Error message when adding product to basket https://doliforge.org/tracker/?func=detail&aid=753&group_id=144 http://www.dolibarr.fr/forum/526-autres-modules/39315-probleme-avec-point-de-vente http://www.dolibarr.es/index.php/foro/6-icomo/2080-errores-con-tpv-y-tipos-de-iva --- htdocs/cashdesk/class/Facturation.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index 32fa03ad48e..3538a3908d1 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -118,7 +118,7 @@ class Facturation } // Define part of HT, VAT, TTC - $resultarray=calcul_price_total($this->qte,$this->prix(),$this->remisePercent(),$vat_rate,0,0,0,'HT',$product->type); + $resultarray=calcul_price_total($this->qte,$this->prix(),$this->remisePercent(),$vat_rate,0,0,0,'HT',$product->type,0); // Calcul du total ht sans remise $total_ht = $resultarray[0]; From a0803e758ecebf79f4e336b6269d846214c51199 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2013 11:25:14 +0100 Subject: [PATCH 2/5] Fix: Missing generic translation --- htdocs/langs/en_US/main.lang | 2 ++ htdocs/langs/fr_FR/main.lang | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index ce12e10119d..c958ed0d56b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -300,6 +300,8 @@ TotalHT=Total (net of tax) TotalTTC=Total (inc. tax) TotalTTCToYourCredit=Total (inc. tax) to your credit TotalVAT=Total tax +TotalLT1=Total tax 2 +TotalLT2=Total tax 3 TotalLT1ES=Total RE TotalLT2ES=Total IRPF IncludedVAT=Included tax diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index c6a9933aa65..7c54726118c 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -302,6 +302,8 @@ TotalHT=Total HT TotalTTC=Total TTC TotalTTCToYourCredit=Total TTC à votre crédit TotalVAT=Total TVA +TotalLT1=Total Taxe 2 +TotalLT2=Total Taxe 3 TotalLT1ES=Total RE TotalLT2ES=Total IRPF IncludedVAT=Dont TVA From 668249a1956571a64516aff2f5e01d78c7f6ecb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2013 18:44:25 +0100 Subject: [PATCH 3/5] Fix: We must refresh object also if option MAIN_DISABLE_PDF_AUTOUPDATE is 1 (Cyril ZEKSER) --- htdocs/commande/fiche.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 77b8f5956c5..5b80bfadf9e 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -725,6 +725,8 @@ else if ($action == 'addline' && $user->rights->commande->creer) if ($result > 0) { + $ret=$object->fetch($object->id); // Reload to get new records + if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { // Define output language @@ -737,7 +739,6 @@ else if ($action == 'addline' && $user->rights->commande->creer) $outputlangs->setDefaultLang($newlang); } - $ret=$object->fetch($object->id); // Reload to get new records commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $hookmanager); } From e97ca67c4a75e9371afc793e3f04ca18301f6fa7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Mar 2013 19:13:50 +0100 Subject: [PATCH 4/5] Fix: Several problem with localtax into PDF generation Conflicts: htdocs/core/modules/commande/doc/pdf_einstein.modules.php htdocs/core/modules/facture/doc/pdf_crabe.modules.php htdocs/core/modules/propale/doc/pdf_azur.modules.php htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php --- .../commande/doc/pdf_einstein.modules.php | 50 +++++++++---------- .../modules/facture/doc/pdf_crabe.modules.php | 50 +++++++++---------- .../modules/propale/doc/pdf_azur.modules.php | 50 +++++++++---------- .../pdf/pdf_canelle.modules.php | 28 +++++------ .../pdf/pdf_muscadet.modules.php | 28 +++++------ 5 files changed, 100 insertions(+), 106 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index d0d8840730d..ffb2b7fc1be 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -720,12 +720,11 @@ class pdf_einstein extends ModelePDFCommandes else { //Local tax 1 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey!=0) // On affiche pas taux 0 @@ -741,8 +740,8 @@ class pdf_einstein extends ModelePDFCommandes $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -750,14 +749,13 @@ class pdf_einstein extends ModelePDFCommandes } } } - } + //} //Local tax 2 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey!=0) // On affiche pas taux 0 @@ -775,8 +773,8 @@ class pdf_einstein extends ModelePDFCommandes $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -785,7 +783,7 @@ class pdf_einstein extends ModelePDFCommandes } } } - } + //} // VAT foreach($this->tva as $tvakey => $tvaval) { @@ -812,15 +810,15 @@ class pdf_einstein extends ModelePDFCommandes } //Local tax 1 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -833,7 +831,7 @@ class pdf_einstein extends ModelePDFCommandes $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -842,7 +840,7 @@ class pdf_einstein extends ModelePDFCommandes } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); @@ -850,17 +848,17 @@ class pdf_einstein extends ModelePDFCommandes } } } - } + //} //Local tax 2 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -873,7 +871,7 @@ class pdf_einstein extends ModelePDFCommandes $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -882,7 +880,7 @@ class pdf_einstein extends ModelePDFCommandes } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -891,7 +889,7 @@ class pdf_einstein extends ModelePDFCommandes } } } - } + //} // Total TTC $index++; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index e12a4984104..7b46fe6e5a5 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -850,12 +850,11 @@ class pdf_crabe extends ModelePDFFactures else { //Local tax 1 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -872,8 +871,8 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -881,14 +880,13 @@ class pdf_crabe extends ModelePDFFactures } } } - } + //} //Local tax 2 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -907,8 +905,8 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -917,7 +915,7 @@ class pdf_crabe extends ModelePDFFactures } } } - } + //} // VAT foreach($this->tva as $tvakey => $tvaval) { @@ -944,15 +942,15 @@ class pdf_crabe extends ModelePDFFactures } //Local tax 1 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -965,7 +963,7 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -974,7 +972,7 @@ class pdf_crabe extends ModelePDFFactures } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); @@ -982,10 +980,10 @@ class pdf_crabe extends ModelePDFFactures } } } - } + //} //Local tax 2 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; @@ -993,7 +991,7 @@ class pdf_crabe extends ModelePDFFactures foreach( $localtax_rate as $tvakey => $tvaval ) { // retrieve global local tax - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -1006,7 +1004,7 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -1015,7 +1013,7 @@ class pdf_crabe extends ModelePDFFactures } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -1023,7 +1021,7 @@ class pdf_crabe extends ModelePDFFactures } } } - } + //} } // Total TTC diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 3a76d61f7f3..6c481063086 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -753,12 +753,11 @@ class pdf_azur extends ModelePDFPropales else { //Local tax 1 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -775,8 +774,8 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -784,14 +783,13 @@ class pdf_azur extends ModelePDFPropales } } } - } + //} //Local tax 2 before VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { - // TODO: Place into a function to control showing by country or study better option - if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue; + if (in_array((string) $localtax_type, array('1','3','5','7'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { @@ -810,8 +808,8 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2".$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -820,7 +818,7 @@ class pdf_azur extends ModelePDFPropales } } } - } + //} // VAT foreach($this->tva as $tvakey => $tvaval) { @@ -847,15 +845,15 @@ class pdf_azur extends ModelePDFPropales } //Local tax 1 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -868,7 +866,7 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -877,7 +875,7 @@ class pdf_azur extends ModelePDFPropales } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); @@ -885,17 +883,17 @@ class pdf_azur extends ModelePDFPropales } } } - } + //} //Local tax 2 after VAT - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { if (in_array((string) $localtax_type, array('2','4','6'))) continue; foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -908,7 +906,7 @@ class pdf_azur extends ModelePDFPropales $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; + $totalvat = $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; if ($localtax_type == '7') { // amount on order $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); @@ -917,7 +915,7 @@ class pdf_azur extends ModelePDFPropales } else { - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); @@ -926,7 +924,7 @@ class pdf_azur extends ModelePDFPropales } } } - } + //} // Total TTC $index++; diff --git a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php index 0813162020d..5e857abf6b0 100755 --- a/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/pdf/pdf_canelle.modules.php @@ -529,7 +529,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), 0, 'R', 1); } @@ -539,19 +539,19 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), 0, 'R', 1); } } else { - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ //Local tax 1 foreach( $this->localtax1 as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -564,22 +564,22 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat =$outputlangs->transnoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - } + //} - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ //Local tax 2 foreach( $this->localtax2 as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -592,15 +592,15 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat =$outputlangs->transnoentities("TotalLT2",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - } + //} } $useborder=0; diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 3074e73d19a..4141190f451 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -697,7 +697,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax1), $useborder, 'R', 1); } @@ -707,19 +707,19 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), 0, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code), 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); } } else { - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') + //{ //Local tax 1 foreach( $this->localtax1 as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -732,22 +732,22 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat =$outputlangs->transcountrynoentities("TotalLT1",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - } + //} - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') - { + //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + //{ //Local tax 2 foreach( $this->localtax2 as $tvakey => $tvaval ) { - if ($tvakey>0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -760,15 +760,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; + $totalvat =$outputlangs->transcountrynoentities("TotalLT2",$mysoc->country_code).' '; + $totalvat.=vatrate(abs($tvakey),1).$tvacompl; $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - } + //} } // Total TTC From 44698fcde034cf7579af079f45a86ad3b42ea6a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 8 Mar 2013 01:50:16 +0100 Subject: [PATCH 5/5] Fix: dol_is_dir may not be loaded, so call fails --- htdocs/core/class/translate.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index fe6d26f6a13..9c492c9aaff 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -621,7 +621,7 @@ class Translate $newdir=dol_osencode($dir); // Check if directory exists - if (! dol_is_dir($dir)) continue; + if (! is_dir($newdir)) continue; // We must not use dol_is_dir here, function may not be loaded $fonc='numberwords'; if (file_exists($newdir.'/functions_'.$fonc.'.lib.php')) @@ -691,4 +691,4 @@ class Translate } -?> \ No newline at end of file +?>