Fix: An easier to understand fix. Remove also not recommanded "continue

2" instructions.
This commit is contained in:
Laurent Destailleur 2013-01-08 22:59:36 +01:00
parent 1555bb681c
commit f3df7a2fec
3 changed files with 60 additions and 138 deletions

View File

@ -722,20 +722,10 @@ class pdf_einstein extends ModelePDFCommandes
//Local tax 1 before VAT //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 ) { foreach( $this->localtax1 as $localtax_type => $localtax_rate )
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
//TODO: Place into a function to control showing by country or study better option
if($mysoc->country_code!='ES')
{ {
continue 2; // TODO: Place into a function to control showing by country or study better option
break; if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue;
}
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey!=0) // On affiche pas taux 0 if ($tvakey!=0) // On affiche pas taux 0
@ -764,20 +754,10 @@ class pdf_einstein extends ModelePDFCommandes
//Local tax 2 before VAT //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 ) { foreach( $this->localtax2 as $localtax_type => $localtax_rate )
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
//TODO: Place into a function to control showing by country or study better option
if($mysoc->country_code!='ES')
{ {
continue 2; // TODO: Place into a function to control showing by country or study better option
break; if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue;
}
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey!=0) // On affiche pas taux 0 if ($tvakey!=0) // On affiche pas taux 0
@ -834,14 +814,10 @@ class pdf_einstein extends ModelePDFCommandes
//Local tax 1 after VAT //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 ) { foreach( $this->localtax1 as $localtax_type => $localtax_rate )
switch ($localtax_type) { {
case '2': if (in_array((string) $localtax_type, array('2','4','6'))) continue;
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey>0) // On affiche pas taux 0 if ($tvakey>0) // On affiche pas taux 0
@ -878,14 +854,10 @@ class pdf_einstein extends ModelePDFCommandes
//Local tax 2 after VAT //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 ) { foreach( $this->localtax2 as $localtax_type => $localtax_rate )
switch ($localtax_type) { {
case '2': if (in_array((string) $localtax_type, array('2','4','6'))) continue;
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey>0) // On affiche pas taux 0 if ($tvakey>0) // On affiche pas taux 0

View File

@ -852,19 +852,11 @@ class pdf_crabe extends ModelePDFFactures
//Local tax 1 before VAT //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 ) { foreach( $this->localtax1 as $localtax_type => $localtax_rate )
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
//TODO: Place into a function to control showing by country or study better option
if($mysoc->country_code!='ES')
{ {
continue 2; // TODO: Place into a function to control showing by country or study better option
break; if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue;
}
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey!=0) // On affiche pas taux 0 if ($tvakey!=0) // On affiche pas taux 0
@ -893,19 +885,11 @@ class pdf_crabe extends ModelePDFFactures
//Local tax 2 before VAT //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 ) { foreach( $this->localtax2 as $localtax_type => $localtax_rate )
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
//TODO: Place into a function to control showing by country or study better option
if($mysoc->country_code!='ES')
{ {
continue 2; // TODO: Place into a function to control showing by country or study better option
break; if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue;
}
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey!=0) // On affiche pas taux 0 if ($tvakey!=0) // On affiche pas taux 0
@ -962,14 +946,10 @@ class pdf_crabe extends ModelePDFFactures
//Local tax 1 after VAT //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 ) { foreach( $this->localtax1 as $localtax_type => $localtax_rate )
switch ($localtax_type) { {
case '2': if (in_array((string) $localtax_type, array('2','4','6'))) continue;
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey>0) // On affiche pas taux 0 if ($tvakey>0) // On affiche pas taux 0
@ -1006,14 +986,10 @@ class pdf_crabe extends ModelePDFFactures
//Local tax 2 after VAT //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 ) { foreach( $this->localtax2 as $localtax_type => $localtax_rate )
switch ($localtax_type) { {
case '2': if (in_array((string) $localtax_type, array('2','4','6'))) continue;
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
// retrieve global local tax // retrieve global local tax

View File

@ -755,20 +755,11 @@ class pdf_azur extends ModelePDFPropales
//Local tax 1 before VAT //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 ) { foreach( $this->localtax1 as $localtax_type => $localtax_rate )
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
//TODO: Place into a function to control showing by country or study better option
if($mysoc->country_code!='ES')
{ {
continue 2; // TODO: Place into a function to control showing by country or study better option
break; if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue;
}
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey!=0) // On affiche pas taux 0 if ($tvakey!=0) // On affiche pas taux 0
@ -797,20 +788,11 @@ class pdf_azur extends ModelePDFPropales
//Local tax 2 before VAT //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 ) { foreach( $this->localtax2 as $localtax_type => $localtax_rate )
switch ($localtax_type) {
case '1':
case '3':
case '5':
case '7':
//TODO: Place into a function to control showing by country or study better option
if($mysoc->country_code!='ES')
{ {
continue 2; // TODO: Place into a function to control showing by country or study better option
break; if (in_array((string) $localtax_type, array('1','3','5','7')) && $mysoc->country_code != 'ES') continue;
}
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey!=0) // On affiche pas taux 0 if ($tvakey!=0) // On affiche pas taux 0
@ -867,14 +849,10 @@ class pdf_azur extends ModelePDFPropales
//Local tax 1 after VAT //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 ) { foreach( $this->localtax1 as $localtax_type => $localtax_rate )
switch ($localtax_type) { {
case '2': if (in_array((string) $localtax_type, array('2','4','6'))) continue;
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey>0) // On affiche pas taux 0 if ($tvakey>0) // On affiche pas taux 0
@ -911,14 +889,10 @@ class pdf_azur extends ModelePDFPropales
//Local tax 2 after VAT //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 ) { foreach( $this->localtax2 as $localtax_type => $localtax_rate )
switch ($localtax_type) { {
case '2': if (in_array((string) $localtax_type, array('2','4','6'))) continue;
case '4':
case '6':
continue 2;
break;
}
foreach( $localtax_rate as $tvakey => $tvaval ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
if ($tvakey>0) // On affiche pas taux 0 if ($tvakey>0) // On affiche pas taux 0