From 1e8aae4de46c2e4b701c65afd34452d362d9203f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 28 Nov 2012 12:11:42 +0100 Subject: [PATCH 01/13] show local taxes on crabe pdf model --- .../modules/facture/doc/pdf_crabe.modules.php | 217 +++++++++++++----- 1 file changed, 154 insertions(+), 63 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 33827261db1..f9b007f3d0b 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -371,16 +372,24 @@ class pdf_crabe extends ModelePDFFactures if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; $vatrate=(string) $object->lines[$i]->tva_tx; - $localtax1rate=(string) $object->lines[$i]->localtax1_tx; - $localtax2rate=(string) $object->lines[$i]->localtax2_tx; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; - if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]=''; - if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]=''; $this->tva[$vatrate] += $tvaligne; - $this->localtax1[$localtax1rate]+=$localtax1ligne; - $this->localtax2[$localtax2rate]+=$localtax2ligne; + + // Search local taxes + $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$object->client->country_code."'"; + $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; + + $resqlt=$this->db->query($sql); + if ($resqlt) + { + $objt = $this->db->fetch_object($resqlt); + $this->localtax1[$objt->localtax1_type][$objt->localtax1]+=$localtax1ligne; + $this->localtax2[$objt->localtax2_type][$objt->localtax2]+=$localtax2ligne; + } // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) @@ -822,6 +831,84 @@ 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') + { + foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { + switch ($localtax_type) { + case '1': + case '3': + case '5': + case '7': + continue 2; + break; + } + foreach( $localtax_rate as $tvakey => $tvaval ) + { + if ($tvakey>0) // On affiche pas taux 0 + { + //$this->atleastoneratenotnull++; + + $index++; + $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/',$tvakey)) + { + $tvakey=str_replace('*','',$tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; + } + $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; + $totalvat.=vatrate($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); + } + } + } + } + //Local tax 2 before VAT + if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + { + foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { + switch ($localtax_type) { + case '1': + case '3': + case '5': + case '7': + continue 2; + break; + } + foreach( $localtax_rate as $tvakey => $tvaval ) + { + if ($tvakey>0) // On affiche pas taux 0 + { + //$this->atleastoneratenotnull++; + + + + $index++; + $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); + + $tvacompl=''; + if (preg_match('/\*/',$tvakey)) + { + $tvakey=str_replace('*','',$tvakey); + $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; + } + $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; + $totalvat.=vatrate($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); + + } + } + } + } + // VAT foreach($this->tva as $tvakey => $tvaval) { if ($tvakey > 0) // On affiche pas taux 0 @@ -830,6 +917,7 @@ class pdf_crabe extends ModelePDFFactures $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $tvacompl=''; if (preg_match('/\*/',$tvakey)) { @@ -839,52 +927,31 @@ class pdf_crabe extends ModelePDFFactures $totalvat =$outputlangs->transnoentities("TotalVAT").' '; $totalvat.=vatrate($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($sign * $tvaval), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - if (! $this->atleastoneratenotnull) // If no vat at all + //Local tax 1 after VAT + if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') { - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_tva), 0, 'R', 1); - - // Total LocalTax1 - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on' && $object->total_localtax1>0) - { - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT1".$mysoc->country_code), $useborder, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax1), $useborder, 'R', 1); - } - - // Total LocalTax2 - if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on' && $object->total_localtax2>0) - { - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalLT2".$mysoc->country_code), $useborder, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_localtax2), $useborder, 'R', 1); - } - } - else - { - if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') - { - //Local tax 1 - foreach($this->localtax1 as $tvakey => $tvaval) + foreach( $this->localtax1 as $localtax_type => $localtax_rate ) { + switch ($localtax_type) { + case '2': + case '4': + case '6': + continue 2; + break; + } + foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey>0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -892,27 +959,43 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT1".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat = $outputlangs->transnoentities("TotalLT1".$mysoc->pays_code).' '; + if ($localtax_type == '7') { // amount on order + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1); + $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1); + } + else + { + $totalvat.=vatrate($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') - { - //Local tax 2 - foreach($this->localtax2 as $tvakey => $tvaval) + } + //Local tax 2 after VAT + if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') + { + foreach( $this->localtax2 as $localtax_type => $localtax_rate ) { + switch ($localtax_type) { + case '2': + case '4': + case '6': + continue 2; + break; + } + foreach( $localtax_rate as $tvakey => $tvaval ) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey>0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->SetXY ($col1x, $tab2_top + $tab2_hl * $index); $tvacompl=''; if (preg_match('/\*/',$tvakey)) @@ -920,12 +1003,21 @@ class pdf_crabe extends ModelePDFFactures $tvakey=str_replace('*','',$tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } - $totalvat =$outputlangs->transnoentities("TotalLT2".$mysoc->country_code).' '; - $totalvat.=vatrate($tvakey,1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat = $outputlangs->transnoentities("TotalLT2".$mysoc->pays_code).' '; - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $tvaval), 0, 'R', 1); + if ($localtax_type == '7') { // amount on order + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $pdf->SetXY ($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvakey), 0, 'R', 1); + } + else + { + $totalvat.=vatrate($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); + } } } } @@ -936,11 +1028,10 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->SetTextColor(0,0,60); $pdf->SetFillColor(224,224,224); - $text=$outputlangs->transnoentities("TotalTTC"); - if ($object->type == 2) $text=$outputlangs->transnoentities("TotalTTCToYourCredit"); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $text, $useborder, 'L', 1); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $object->total_ttc), $useborder, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_ttc), $useborder, 'R', 1); } } From f0918a25362777ee0d8b2ffff68205b6ba97f13f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 28 Nov 2012 12:13:03 +0100 Subject: [PATCH 02/13] remove unused arrays into pdf models (localtaxes) --- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 3 +-- htdocs/core/modules/propale/doc/pdf_azur.modules.php | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index fd5c9446092..af52234361d 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -3,6 +3,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2012 Juanjo Menent + * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,8 +120,6 @@ class pdf_einstein extends ModelePDFCommandes $this->tva=array(); $this->localtax1=array(); $this->localtax2=array(); - $this->localtax1_type=array(); - $this->localtax2_type=array(); $this->atleastoneratenotnull=0; $this->atleastonediscount=0; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 5f3aa93d7f6..1fee81625e6 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -119,8 +119,6 @@ class pdf_azur extends ModelePDFPropales $this->tva=array(); $this->localtax1=array(); $this->localtax2=array(); - $this->localtax1_type=array(); - $this->localtax2_type=array(); $this->atleastoneratenotnull=0; $this->atleastonediscount=0; } From e459736977c877259f757248c5b575697e29fbc0 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 28 Nov 2012 17:47:15 +0100 Subject: [PATCH 03/13] add function gettypeoflocaltax and modify pdf models --- htdocs/core/lib/functions.lib.php | 28 +++++++++ .../commande/doc/pdf_einstein.modules.php | 62 +++++++++++++----- .../modules/facture/doc/pdf_crabe.modules.php | 63 ++++++++++++++----- .../modules/propale/doc/pdf_azur.modules.php | 61 +++++++++++++----- 4 files changed, 169 insertions(+), 45 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4cc42423483..d87de10d8cd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4208,6 +4208,34 @@ function getCurrencySymbol($currency_code) return $currency_sign; } +/** + * Get type of one localtax + * + * @param int $vatrate VAT Rate + * @param int $number Number of localtax (1 / 2) + * @return int Type of local tax (1 to 7 / 0 if not found) + */ + +function getTypeOfLocalTaxFromRate($vatrate, $number) +{ + global $db, $mysoc; + + // Search local taxes + $sql = "SELECT t.localtax1_type, t.localtax2_type"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; + $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + if ($number == 1) return $obj->localtax1_type; + elseif ($number == 2) return $obj->localtax2_type; + } + + return 0; +} if (! function_exists('getmypid')) { diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index af52234361d..e6fffa4e03c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -138,7 +138,7 @@ class pdf_einstein extends ModelePDFCommandes */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) { - global $user,$langs,$conf; + global $user,$langs,$conf,$mysoc,$db; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO @@ -365,6 +365,10 @@ class pdf_einstein extends ModelePDFCommandes $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; + $localtax1_rate=$object->lines[$i]->localtax1_tx; + $localtax2_rate=$object->lines[$i]->localtax2_tx; + $localtax1_type=$object->lines[$i]->localtax1_type; + $localtax2_type=$object->lines[$i]->localtax2_type; if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; @@ -372,24 +376,52 @@ class pdf_einstein extends ModelePDFCommandes $vatrate=(string) $object->lines[$i]->tva_tx; + // TODO : store local taxes types into object lines and remove this + if (empty($localtax1_type)) + $localtax1_type=getTypeOfLocalTaxFromRate($vatrate,1); + if (empty($localtax2_type)) + $localtax2_type=getTypeOfLocalTaxFromRate($vatrate,2); + //end TODO + + // retrieve global local tax + if ($localtax1_type == '7') + { + $sql = "SELECT t.localtax1"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; + $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $localtax1_rate = $obj->localtax1; + } + } + if ($localtax2_type == '7') + { + $sql = "SELECT t.localtax2"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; + $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $localtax2_rate = $obj->localtax2; + } + } + + if ($localtax1ligne != 0 || $localtax1_type == '7') + $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + if ($localtax2ligne != 0 || $localtax2_type == '7') + $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; + if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; $this->tva[$vatrate] += $tvaligne; - // Search local taxes - $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$object->client->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; - - $resqlt=$this->db->query($sql); - if ($resqlt) - { - $objt = $this->db->fetch_object($resqlt); - $this->localtax1[$objt->localtax1_type][$objt->localtax1]+=$localtax1ligne; - $this->localtax2[$objt->localtax2_type][$objt->localtax2]+=$localtax2ligne; - } - // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index f9b007f3d0b..2db960300e8 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -139,7 +139,7 @@ class pdf_crabe extends ModelePDFFactures */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) { - global $user,$langs,$conf; + global $user,$langs,$conf,$mysoc,$db; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO @@ -366,31 +366,63 @@ class pdf_crabe extends ModelePDFFactures $tvaligne=$object->lines[$i]->total_tva; $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; + $localtax1_rate=$object->lines[$i]->localtax1_tx; + $localtax2_rate=$object->lines[$i]->localtax2_tx; + $localtax1_type=$object->lines[$i]->localtax1_type; + $localtax2_type=$object->lines[$i]->localtax2_type; if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; $vatrate=(string) $object->lines[$i]->tva_tx; + + // TODO : store local taxes types into object lines and remove this + if (empty($localtax1_type)) + $localtax1_type=getTypeOfLocalTaxFromRate($vatrate,1); + if (empty($localtax2_type)) + $localtax2_type=getTypeOfLocalTaxFromRate($vatrate,2); + //end TODO + + // retrieve global local tax + if ($localtax1_type == '7') + { + $sql = "SELECT t.localtax1"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; + $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $localtax1_rate = $obj->localtax1; + } + } + if ($localtax2_type == '7') + { + $sql = "SELECT t.localtax2"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; + $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $localtax2_rate = $obj->localtax2; + } + } + + if ($localtax1ligne != 0 || $localtax1_type == '7') + $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + if ($localtax2ligne != 0 || $localtax2_type == '7') + $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; $this->tva[$vatrate] += $tvaligne; - // Search local taxes - $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$object->client->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; - - $resqlt=$this->db->query($sql); - if ($resqlt) - { - $objt = $this->db->fetch_object($resqlt); - $this->localtax1[$objt->localtax1_type][$objt->localtax1]+=$localtax1ligne; - $this->localtax2[$objt->localtax2_type][$objt->localtax2]+=$localtax2ligne; - } - // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { @@ -990,6 +1022,7 @@ class pdf_crabe extends ModelePDFFactures } foreach( $localtax_rate as $tvakey => $tvaval ) { + // retrieve global local tax if ($tvakey>0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 1fee81625e6..49972bb9d8f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -137,7 +137,7 @@ class pdf_azur extends ModelePDFPropales */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0,$hookmanager=false) { - global $user,$langs,$conf; + global $user,$langs,$conf,$mysoc,$db; if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO @@ -363,31 +363,62 @@ class pdf_azur extends ModelePDFPropales $tvaligne=$object->lines[$i]->total_tva; $localtax1ligne=$object->lines[$i]->total_localtax1; $localtax2ligne=$object->lines[$i]->total_localtax2; + $localtax1_rate=$object->lines[$i]->localtax1_tx; + $localtax2_rate=$object->lines[$i]->localtax2_tx; + $localtax1_type=$object->lines[$i]->localtax1_type; + $localtax2_type=$object->lines[$i]->localtax2_type; if ($object->remise_percent) $tvaligne-=($tvaligne*$object->remise_percent)/100; if ($object->remise_percent) $localtax1ligne-=($localtax1ligne*$object->remise_percent)/100; if ($object->remise_percent) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; $vatrate=(string) $object->lines[$i]->tva_tx; + // TODO : store local taxes types into object lines and remove this + if (empty($localtax1_type)) + $localtax1_type=getTypeOfLocalTaxFromRate($vatrate,1); + if (empty($localtax2_type)) + $localtax2_type=getTypeOfLocalTaxFromRate($vatrate,2); + //end TODO + + // retrieve global local tax + if ($localtax1_type == '7') + { + $sql = "SELECT t.localtax1"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; + $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $localtax1_rate = $obj->localtax1; + } + } + if ($localtax2_type == '7') + { + $sql = "SELECT t.localtax2"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; + $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; + + $resql=$db->query($sql); + if ($resql) + { + $obj = $db->fetch_object($resql); + $localtax2_rate = $obj->localtax2; + } + } + + if ($localtax1ligne != 0 || $localtax1_type == '7') + $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; + if ($localtax2ligne != 0 || $localtax2_type == '7') + $this->localtax2[$localtax2_type][$localtax2_rate]+=$localtax2ligne; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=''; $this->tva[$vatrate] += $tvaligne; - // Search local taxes - $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$object->client->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; - - $resqlt=$this->db->query($sql); - if ($resqlt) - { - $objt = $this->db->fetch_object($resqlt); - $this->localtax1[$objt->localtax1_type][$objt->localtax1]+=$localtax1ligne; - $this->localtax2[$objt->localtax2_type][$objt->localtax2]+=$localtax2ligne; - } - // Add line if (! empty($conf->global->MAIN_PDF_DASH_BETWEEN_LINES) && $i < ($nblignes - 1)) { From 53cf2ca8f571a3a791fb0e2f6740f06141de7385 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 28 Nov 2012 17:57:17 +0100 Subject: [PATCH 04/13] dont use ES translation for labels --- htdocs/societe/soc.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 528672e3592..45caee823b1 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -909,22 +909,22 @@ else // Local Taxes if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - print ''.$langs->trans("LocalTax1IsUsed").''; + print ''.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax1assuj_value',0,1); - print ''.$langs->trans("LocalTax2IsUsed").''; + print ''.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value',0,1); print ''; } elseif($mysoc->localtax1_assuj=="1") { - print ''.$langs->trans("LocalTax1IsUsed").''; + print ''.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax1assuj_value',0,1); print ''; } elseif($mysoc->localtax2_assuj=="1") { - print ''.$langs->trans("LocalTax2IsUsed").''; + print ''.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value',0,1); print ''; } @@ -1320,23 +1320,23 @@ else // Local Taxes if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - print ''.$langs->trans("LocalTax1IsUsedES").''; + print ''.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); - print ''.$langs->trans("LocalTax2IsUsedES").''; + print ''.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); print ''; } elseif($mysoc->localtax1_assuj=="1") { - print ''.$langs->trans("LocalTax1IsUsedES").''; + print ''.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax1assuj_value',$object->localtax1_assuj,1); print ''; } elseif($mysoc->localtax2_assuj=="1") { - print ''.$langs->trans("LocalTax2IsUsedES").''; + print ''.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value',$object->localtax2_assuj,1); print ''; } @@ -1636,22 +1636,22 @@ else // Local Taxes if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") { - print ''.$langs->trans("LocalTax1IsUsedES").''; + print ''.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).''; print yn($object->localtax1_assuj); - print ''.$langs->trans("LocalTax2IsUsedES").''; + print ''.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).''; print yn($object->localtax2_assuj); print ''; } elseif($mysoc->localtax1_assuj=="1") { - print ''.$langs->trans("LocalTax1IsUsedES").''; + print ''.$langs->trans("LocalTax1IsUsed",$mysoc->country_code).''; print yn($object->localtax1_assuj); print ''; } elseif($mysoc->localtax2_assuj=="1") { - print ''.$langs->trans("LocalTax2IsUsedES").''; + print ''.$langs->trans("LocalTax2IsUsed",$mysoc->country_code).''; print yn($object->localtax2_assuj); print ''; } From 51d87f8f4ab431b8f3c98daae6214c292a203616 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 29 Nov 2012 11:36:59 +0100 Subject: [PATCH 05/13] function getTypeOfLocalTaxFromRate now receives thirdparty in parameter and returns array of localtax type and amount/rate. no more sql in pdf model. --- htdocs/core/lib/functions.lib.php | 17 ++++----- .../commande/doc/pdf_einstein.modules.php | 36 ++++--------------- .../modules/facture/doc/pdf_crabe.modules.php | 36 ++++--------------- .../modules/propale/doc/pdf_azur.modules.php | 34 ++++-------------- 4 files changed, 29 insertions(+), 94 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d87de10d8cd..7aa197be58f 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4213,25 +4213,26 @@ function getCurrencySymbol($currency_code) * * @param int $vatrate VAT Rate * @param int $number Number of localtax (1 / 2) - * @return int Type of local tax (1 to 7 / 0 if not found) + * @param int $thirdparty company object + * @return array array(Type of local tax (1 to 7 / 0 if not found), rate or amount of localtax) */ -function getTypeOfLocalTaxFromRate($vatrate, $number) +function getTypeOfLocalTaxFromRate($vatrate, $number, $thirdparty) { - global $db, $mysoc; - + global $db; + // Search local taxes - $sql = "SELECT t.localtax1_type, t.localtax2_type"; + $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty->country_code."'"; $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; $resql=$db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); - if ($number == 1) return $obj->localtax1_type; - elseif ($number == 2) return $obj->localtax2_type; + if ($number == 1) return array($obj->localtax1_type, $obj->localtax1); + elseif ($number == 2) return array($obj->localtax2_type, $obj->localtax2); } return 0; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index e6fffa4e03c..434d668826d 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -377,41 +377,19 @@ class pdf_einstein extends ModelePDFCommandes $vatrate=(string) $object->lines[$i]->tva_tx; // TODO : store local taxes types into object lines and remove this + $localtax1_array=getTypeOfLocalTaxFromRate($vatrate,1,$mysoc); + $localtax2_array=getTypeOfLocalTaxFromRate($vatrate,2,$mysoc); if (empty($localtax1_type)) - $localtax1_type=getTypeOfLocalTaxFromRate($vatrate,1); + $localtax1_type = $localtax1_array[0]; if (empty($localtax2_type)) - $localtax2_type=getTypeOfLocalTaxFromRate($vatrate,2); + $localtax2_type = $localtax2_array[0]; //end TODO - + // retrieve global local tax if ($localtax1_type == '7') - { - $sql = "SELECT t.localtax1"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; - - $resql=$db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - $localtax1_rate = $obj->localtax1; - } - } + $localtax1_rate = $localtax1_array[1]; if ($localtax2_type == '7') - { - $sql = "SELECT t.localtax2"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; - - $resql=$db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - $localtax2_rate = $obj->localtax2; - } - } + $localtax2_rate = $localtax2_array[1]; if ($localtax1ligne != 0 || $localtax1_type == '7') $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 2db960300e8..c7d603f0622 100755 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -378,41 +378,19 @@ class pdf_crabe extends ModelePDFFactures $vatrate=(string) $object->lines[$i]->tva_tx; // TODO : store local taxes types into object lines and remove this + $localtax1_array=getTypeOfLocalTaxFromRate($vatrate,1,$mysoc); + $localtax2_array=getTypeOfLocalTaxFromRate($vatrate,2,$mysoc); if (empty($localtax1_type)) - $localtax1_type=getTypeOfLocalTaxFromRate($vatrate,1); + $localtax1_type = $localtax1_array[0]; if (empty($localtax2_type)) - $localtax2_type=getTypeOfLocalTaxFromRate($vatrate,2); + $localtax2_type = $localtax2_array[0]; //end TODO - + // retrieve global local tax if ($localtax1_type == '7') - { - $sql = "SELECT t.localtax1"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; - - $resql=$db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - $localtax1_rate = $obj->localtax1; - } - } + $localtax1_rate = $localtax1_array[1]; if ($localtax2_type == '7') - { - $sql = "SELECT t.localtax2"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; - - $resql=$db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - $localtax2_rate = $obj->localtax2; - } - } + $localtax2_rate = $localtax2_array[1]; if ($localtax1ligne != 0 || $localtax1_type == '7') $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 49972bb9d8f..93a415bd7c1 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -374,41 +374,19 @@ class pdf_azur extends ModelePDFPropales $vatrate=(string) $object->lines[$i]->tva_tx; // TODO : store local taxes types into object lines and remove this + $localtax1_array=getTypeOfLocalTaxFromRate($vatrate,1,$mysoc); + $localtax2_array=getTypeOfLocalTaxFromRate($vatrate,2,$mysoc); if (empty($localtax1_type)) - $localtax1_type=getTypeOfLocalTaxFromRate($vatrate,1); + $localtax1_type = $localtax1_array[0]; if (empty($localtax2_type)) - $localtax2_type=getTypeOfLocalTaxFromRate($vatrate,2); + $localtax2_type = $localtax2_array[0]; //end TODO // retrieve global local tax if ($localtax1_type == '7') - { - $sql = "SELECT t.localtax1"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; - - $resql=$db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - $localtax1_rate = $obj->localtax1; - } - } + $localtax1_rate = $localtax1_array[1]; if ($localtax2_type == '7') - { - $sql = "SELECT t.localtax2"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; - $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$mysoc->country_code."'"; - $sql .= " AND t.taux = ".$vatrate." AND t.active = 1"; - - $resql=$db->query($sql); - if ($resql) - { - $obj = $db->fetch_object($resql); - $localtax2_rate = $obj->localtax2; - } - } + $localtax2_rate = $localtax2_array[1]; if ($localtax1ligne != 0 || $localtax1_type == '7') $this->localtax1[$localtax1_type][$localtax1_rate]+=$localtax1ligne; From 1315e9a2ba9bafb987da926830d8adbb76a24a06 Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 30 Nov 2012 04:40:06 +0100 Subject: [PATCH 06/13] Add import_key attribute into contact class creation SQL request --- htdocs/contact/class/contact.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 4e2d80e7bd1..e95daae621b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -127,6 +127,7 @@ class Contact extends CommonObject $sql.= ", priv"; $sql.= ", canvas"; $sql.= ", entity"; + $sql.= ", import_key"; $sql.= ") VALUES ("; $sql.= "'".$this->db->idate($now)."',"; if ($this->socid > 0) $sql.= " ".$this->socid.","; @@ -136,7 +137,8 @@ class Contact extends CommonObject $sql.= " ".($user->id > 0 ? "'".$user->id."'":"null").","; $sql.= " ".$this->priv.","; $sql.= " ".($this->canvas?"'".$this->canvas."'":"null").","; - $sql.= " ".$conf->entity; + $sql.= " ".$conf->entity.","; + $sql.= " ".$this->import_key.","; $sql.= ")"; dol_syslog(get_class($this)."::create sql=".$sql); From f7b6f447678c42e3e7e311fc84cb36b459a9b152 Mon Sep 17 00:00:00 2001 From: fhenry Date: Fri, 30 Nov 2012 04:51:11 +0100 Subject: [PATCH 07/13] oops, correct version --- htdocs/contact/class/contact.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index e95daae621b..fd8a2c82101 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -138,7 +138,7 @@ class Contact extends CommonObject $sql.= " ".$this->priv.","; $sql.= " ".($this->canvas?"'".$this->canvas."'":"null").","; $sql.= " ".$conf->entity.","; - $sql.= " ".$this->import_key.","; + $sql.= " ".$this->import_key; $sql.= ")"; dol_syslog(get_class($this)."::create sql=".$sql); From dbf1a727bea79693264806815e170b328f42a114 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 30 Nov 2012 16:20:01 +0100 Subject: [PATCH 08/13] Fix: Add to areas not working if we navigate with shownavref --- htdocs/product/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index ce68665cb69..443b0bc4be4 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -1380,7 +1380,7 @@ print "\n
\n"; * All the "Add to" areas */ -if ($id && ($action == '' || $action == 'view') && $object->status) +if ($object->id && ($action == '' || $action == 'view') && $object->status) { print ''; From f0ba52445db9e2e332b087437b29a2ca583ecab5 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 30 Nov 2012 17:36:48 +0100 Subject: [PATCH 09/13] Trad: Add ca_ES and es_ES missing translations --- htdocs/langs/ca_ES/products.lang | 2 ++ htdocs/langs/es_ES/products.lang | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/langs/ca_ES/products.lang b/htdocs/langs/ca_ES/products.lang index f1c0fbb0616..71d8d426d2c 100644 --- a/htdocs/langs/ca_ES/products.lang +++ b/htdocs/langs/ca_ES/products.lang @@ -146,6 +146,8 @@ ProductSpecial=Especial QtyMin=Quantitat mínima PriceQty=Preu per la quantitat PriceQtyMin=Preu quantitat min. +DiscountQtyMin=Descompte per defecte quantitat min. +VATRateForSupplierProduct=Taxa IVA (per aquest producte/proveïdor) NoPriceDefinedForThisSupplier=Cap preu/quant. definit per a aquest proveïdor/producte NoSupplierPriceDefinedForThisProduct=Cap preu/quant. proveïdor definit per a aquest producte RecordedProducts=Productes en venda diff --git a/htdocs/langs/es_ES/products.lang b/htdocs/langs/es_ES/products.lang index 97d4586bae6..a3c2bf41eb7 100644 --- a/htdocs/langs/es_ES/products.lang +++ b/htdocs/langs/es_ES/products.lang @@ -146,6 +146,8 @@ ProductSpecial=Especial QtyMin=Cantidad mínima PriceQty=Precio para la cantidad PriceQtyMin=Precio cantidad mín. +DiscountQtyMin=Descuento por defecto cantidad mín. +VATRateForSupplierProduct=Tasa IVA (para este producto/proveedor) NoPriceDefinedForThisSupplier=Ningún precio/cant. definido para este proveedor/producto NoSupplierPriceDefinedForThisProduct=Ningún precio/cant. proveedor definida para este producto RecordedProducts=Productos en venta From dda12c3d705539ba41b60d7d46b8136389bd89aa Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 30 Nov 2012 17:58:12 +0100 Subject: [PATCH 10/13] Trad: Add missing margins translations --- htdocs/langs/ca_ES/margins.lang | 6 +++++- htdocs/langs/en_US/margins.lang | 1 + htdocs/langs/es_ES/margins.lang | 6 +++++- htdocs/langs/fr_FR/margins.lang | 1 + htdocs/product/fournisseurs.php | 4 +++- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/ca_ES/margins.lang b/htdocs/langs/ca_ES/margins.lang index f502a3274bf..62bb253a587 100644 --- a/htdocs/langs/ca_ES/margins.lang +++ b/htdocs/langs/ca_ES/margins.lang @@ -46,4 +46,8 @@ MargeNette=Marge net MARGIN_TYPE_DETAILS=Marge brut: Preu de venda sense IVA - Preu de compra sense IVA
Marge net: Preu de venda sense IVA - Costos BuyingCost=Costos -UnitCharges=Càrrega unitària \ No newline at end of file +UnitCharges=Càrrega unitària +Charges=Càrreges + +AgentContactType=Tipus de contacte comissionat +AgentContactTypeDetails=Indica el tipus de contacte enllaçat a les factures que seran associats als agents comercials \ No newline at end of file diff --git a/htdocs/langs/en_US/margins.lang b/htdocs/langs/en_US/margins.lang index 41203847ba5..10a8112f87e 100644 --- a/htdocs/langs/en_US/margins.lang +++ b/htdocs/langs/en_US/margins.lang @@ -47,6 +47,7 @@ MARGIN_TYPE_DETAILS=Raw margin : Selling price - Buying price
Net margin : S BuyingCost=Cost price UnitCharges=Unit charges +Charges=Charges AgentContactType=Contact type used for commissioning AgentContactTypeDetails=Défine what contact type (linked on invoices) will be associated with commercial agents \ No newline at end of file diff --git a/htdocs/langs/es_ES/margins.lang b/htdocs/langs/es_ES/margins.lang index 5ff7b74b7d4..0dc08481c46 100644 --- a/htdocs/langs/es_ES/margins.lang +++ b/htdocs/langs/es_ES/margins.lang @@ -46,4 +46,8 @@ MargeNette=Margen neto MARGIN_TYPE_DETAILS=Margen bruto : Precio de venta sin IVA - Precio de compra sin IVA
Margen neto : Precio de venta sin IVA - Costos BuyingCost=Costos -UnitCharges=Carga unitaria \ No newline at end of file +UnitCharges=Carga unitaria +Charges=Cargas + +AgentContactType=Tipo de contacto comisionado +AgentContactTypeDetails=Indica el tipo de contacto enlazado a las facturas que serán asociados a los agentes comerciales \ No newline at end of file diff --git a/htdocs/langs/fr_FR/margins.lang b/htdocs/langs/fr_FR/margins.lang index 02dfedbbe9a..3c81a9a1e4d 100644 --- a/htdocs/langs/fr_FR/margins.lang +++ b/htdocs/langs/fr_FR/margins.lang @@ -47,6 +47,7 @@ MARGIN_TYPE_DETAILS=Marge brute : Prix de vente HT - Prix d'achat HT
Marge n BuyingCost=Coût de revient UnitCharges=Charge unitaire +Charges=Charges AgentContactType=Type de contact commissionné AgentContactTypeDetails=Permet de définir le type de contact associé aux factures qui sera associé aux agents commerciaux \ No newline at end of file diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index eda89ef1c5d..3dca030a921 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -34,6 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $langs->load("products"); $langs->load("suppliers"); $langs->load("bills"); +// Charges ???? +if (! empty($conf->margin->enabled)) $langs->load("margins"); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); From 6487baa08140c9b5dbaea0e01af816e08d8bf7b9 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 30 Nov 2012 18:46:05 +0100 Subject: [PATCH 11/13] New: [ task #314 ] Can define if prof id are mandatory or not --- htdocs/langs/ca_ES/admin.lang | 1 + htdocs/langs/en_US/admin.lang | 1 + htdocs/langs/es_ES/admin.lang | 1 + htdocs/langs/fr_FR/admin.lang | 1 + htdocs/societe/admin/societe.php | 50 ++++++++++++++++++++++---------- 5 files changed, 39 insertions(+), 15 deletions(-) diff --git a/htdocs/langs/ca_ES/admin.lang b/htdocs/langs/ca_ES/admin.lang index 9c10b0fb1f7..768607eca53 100644 --- a/htdocs/langs/ca_ES/admin.lang +++ b/htdocs/langs/ca_ES/admin.lang @@ -963,6 +963,7 @@ DocumentModelOdt=Generació des dels documents amb format OpenDocument (Arxiu .O WatermarkOnDraft=Marca d'aigua en els documents esborrany CompanyIdProfChecker=Id Professional únic MustBeUnique=Ha de ser únic? +MustBeMandatory=Ha de ser obligatori? Miscellanous=Miscel·lània ##### Webcal setup ##### WebCalSetup=Configuració d'enllaç amb el calendari webcalendar diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 6eb9b59b168..0919133f936 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -953,6 +953,7 @@ DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT files for WatermarkOnDraft=Watermark on draft document CompanyIdProfChecker=Professional Id unique MustBeUnique=Must be unique ? +MustBeMandatory=Must be mandatory ? Miscellanous=Miscellaneous ##### Webcal setup ##### WebCalSetup=Webcalendar link setup diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index 63d3180e8a9..7a7a53a6654 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -966,6 +966,7 @@ DocumentModelOdt=Generación desde los documentos OpenDocument (Archivo .ODT Ope WatermarkOnDraft=Marca de agua en los documentos borrador CompanyIdProfChecker=Id Profesional único MustBeUnique=¿Debe ser único? +MustBeMandatory=¿Debe ser obligatorio? Miscellanous=Miscelánea ##### Webcal setup ##### WebCalSetup=Configuración de enlace con el calendario Webcalendar diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 089ae7f5cda..67c1c1f6e19 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -960,6 +960,7 @@ DocumentModelOdt=Genération depuis des modèles OpenDocument (Fichier .ODT Open WatermarkOnDraft=Filigrane sur les documents brouillons CompanyIdProfChecker=Id professionel unique MustBeUnique=Doit être unique ? +MustBeMandatory=Doit être obligatoire? Miscellanous=Divers ##### Webcal setup ##### WebCalSetup= Configuration du lien vers le calendrier Webcalendar diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index bfff310636f..e058869d586 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -195,6 +195,23 @@ if ($action == 'setprofid') } } +//Activate ProfId +if ($action == 'setprofidmandatory') +{ + $status = GETPOST('status','alpha'); + + $idprof="SOCIETE_IDPROF".$value."_MANDATORY"; + if (dolibarr_set_const($db, $idprof,$status,'chaine',0,'',$conf->entity) > 0) + { + header("Location: ".$_SERVER["PHP_SELF"]); + exit; + } + else + { + dol_print_error($db); + } +} + /* * View @@ -522,6 +539,7 @@ print '
'; print ''; print ''; print ''; +print ''; print "\n"; $profid[0][0]=$langs->trans("ProfId1"); @@ -546,21 +564,10 @@ while ($i < $nbofloop) print $profid[$i][1]; print ''; - switch($i) - { - case 0: - $verif=(empty($conf->global->SOCIETE_IDPROF1_UNIQUE)?false:true); - break; - case 1: - $verif=(empty($conf->global->SOCIETE_IDPROF2_UNIQUE)?false:true); - break; - case 2: - $verif=(empty($conf->global->SOCIETE_IDPROF3_UNIQUE)?false:true); - break; - case 3: - $verif=(empty($conf->global->SOCIETE_IDPROF4_UNIQUE)?false:true); - break; - } + $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; + $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; + $verif=(empty($conf->global->$idprof_unique)?false:true); + $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); if ($verif) { @@ -574,6 +581,19 @@ while ($i < $nbofloop) print img_picto($langs->trans("Disabled"),'switch_off'); print ''; } + + if ($mandatory) + { + print ''; + } + else + { + print ''; + } print "\n"; $i++; } From b4e16827dc3b83751172d137a057cda3a1bae788 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 30 Nov 2012 21:23:12 +0100 Subject: [PATCH 12/13] New: [ task #314 ] Can define if prof id are mandatory or not --- ChangeLog | 2 + htdocs/langs/ca_ES/errors.lang | 1 + htdocs/langs/en_US/errors.lang | 1 + htdocs/langs/es_ES/errors.lang | 1 + htdocs/langs/fr_FR/errors.lang | 1 + htdocs/societe/admin/societe.php | 77 +++++++++++++++++--------------- htdocs/societe/soc.php | 43 +++++++++++++++--- 7 files changed, 85 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 361cd1145ba..803703caf9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -62,10 +62,12 @@ For users: - New: Can choose menu entry to show with external site module. - New: Add hidden option MAIN_PDF_MARGIN_LEFT, MAIN_PDF_MARGIN_RIGHT, MAIN_PDF_MARGIN_TOP, MAIN_PDF_MARGIN_BOTTOM to force margins of generated PDF. +- New: [ task #314 ] Can define if prof id are mandatory or not New experimental modules: - New: Add margin management module. - New: Add commissions management module. + - Fix: [ bug #499 ]: Supplier order input method not translated - Fix: No images into product description lines as PDF generation does not work with this. diff --git a/htdocs/langs/ca_ES/errors.lang b/htdocs/langs/ca_ES/errors.lang index fd43de81c10..ec04e3ff9ce 100644 --- a/htdocs/langs/ca_ES/errors.lang +++ b/htdocs/langs/ca_ES/errors.lang @@ -21,6 +21,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=Aquest contacte ja està definit com ErrorCashAccountAcceptsOnlyCashMoney=Aquesta compte bancari és de tipus caixa i només accepta el mètode de pagament de tipus espècie. ErrorFromToAccountsMustDiffers=El compte origen i destinació han de ser diferents. ErrorBadThirdPartyName=Nom de tercer incorrecte +ErrorProdIdIsMandatory=El %s es obligatori ErrorBadCustomerCodeSyntax=La sintaxi del codi client és incorrecta ErrorCustomerCodeRequired=Codi client obligatori ErrorCustomerCodeAlreadyUsed=Codi de client ja utilitzat diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 19a36f64c22..f2f537453e7 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -25,6 +25,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=This contact is already defined as co ErrorCashAccountAcceptsOnlyCashMoney=This bank account is a cash account, so it accepts payments of type cash only. ErrorFromToAccountsMustDiffers=Source and targets bank accounts must be different. ErrorBadThirdPartyName=Bad value for third party name +ErrorProdIdIsMandatory=The %s is mandatory ErrorBadCustomerCodeSyntax=Bad syntax for customer code ErrorCustomerCodeRequired=Customer code required ErrorCustomerCodeAlreadyUsed=Customer code already used diff --git a/htdocs/langs/es_ES/errors.lang b/htdocs/langs/es_ES/errors.lang index 580627e6cab..d723910a5bd 100644 --- a/htdocs/langs/es_ES/errors.lang +++ b/htdocs/langs/es_ES/errors.lang @@ -21,6 +21,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=Este contacto ya está definido como ErrorCashAccountAcceptsOnlyCashMoney=Esta cuenta bancaria es de tipo caja y solo acepta el método de pago de tipo especie. ErrorFromToAccountsMustDiffers=La cuenta origen y destino deben ser diferentes. ErrorBadThirdPartyName=Nombre de tercero incorrecto +ErrorProdIdIsMandatory=El %s es obligatorio ErrorBadCustomerCodeSyntax=La sintaxis del código cliente es incorrecta ErrorCustomerCodeRequired=Código cliente obligatorio ErrorCustomerCodeAlreadyUsed=Código de cliente ya utilizado diff --git a/htdocs/langs/fr_FR/errors.lang b/htdocs/langs/fr_FR/errors.lang index 87715bea1fe..b6fcbb6611b 100644 --- a/htdocs/langs/fr_FR/errors.lang +++ b/htdocs/langs/fr_FR/errors.lang @@ -26,6 +26,7 @@ ErrorThisContactIsAlreadyDefinedAsThisType=Ce contact est déjà défini comme c ErrorCashAccountAcceptsOnlyCashMoney=Ce compte bancaire est de type caisse et n'accepte que les mode de règlement de type espèce. ErrorFromToAccountsMustDiffers=Le compte source et destination doivent être différents. ErrorBadThirdPartyName=Nom de tiers incorrect +ErrorProdIdIsMandatory=Le %s est obligatoire ErrorBadCustomerCodeSyntax=La syntaxe du code client est incorrecte ErrorCustomerCodeRequired=Code client obligatoire ErrorCustomerCodeAlreadyUsed=Code client déjà utilisé diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index e058869d586..32ad23eafbe 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -550,6 +550,10 @@ $profid[2][0]=$langs->trans("ProfId3"); $profid[2][1]=$langs->transcountry('ProfId3', $mysoc->country_code); $profid[3][0]=$langs->trans("ProfId4"); $profid[3][1]=$langs->transcountry('ProfId4', $mysoc->country_code); +$profid[4][0]=$langs->trans("ProfId5"); +$profid[4][1]=$langs->transcountry('ProfId5', $mysoc->country_code); +$profid[5][0]=$langs->trans("ProfId6"); +$profid[5][1]=$langs->transcountry('ProfId6', $mysoc->country_code); $var = true; $i=0; @@ -557,44 +561,47 @@ $i=0; $nbofloop=count($profid); while ($i < $nbofloop) { - $var = !$var; - - print ''; - print ''; - - $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; - $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; - $verif=(empty($conf->global->$idprof_unique)?false:true); - $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); - - if ($verif) + if ($profid[$i][1]!='-') { - print ''; - } - else - { - print ''; - } + $var = !$var; - if ($mandatory) - { - print ''; - } - else - { - print ''; + print ''; + print ''; + + $idprof_unique ='SOCIETE_IDPROF'.($i+1).'_UNIQUE'; + $idprof_mandatory ='SOCIETE_IDPROF'.($i+1).'_MANDATORY'; + $verif=(empty($conf->global->$idprof_unique)?false:true); + $mandatory=(empty($conf->global->$idprof_mandatory)?false:true); + + if ($verif) + { + print ''; + } + else + { + print ''; + } + + if ($mandatory) + { + print ''; + } + else + { + print ''; + } + print "\n"; } - print "\n"; $i++; } diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 528672e3592..9dc51c37737 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Patrick Raguin - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2012 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -202,9 +202,18 @@ if (empty($reshook)) $error++; $errors[] = $langs->trans("ErrorSupplierModuleNotEnabled"); $action = ($action=='add'?'create':'edit'); } + + // We set country_id, country_code and country for the selected country + $object->country_id=GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; + if ($object->country_id) + { + $tmparray=getCountry($object->country_id,'all'); + $object->country_code=$tmparray['code']; + $object->country=$tmparray['label']; + } - // Check for duplicate prof id - for ($i = 1; $i < 3; $i++) + // Check for duplicate or mandatory prof id + for ($i = 1; $i < 5; $i++) { $slabel="idprof".$i; $_POST[$slabel]=trim($_POST[$slabel]); @@ -218,8 +227,18 @@ if (empty($reshook)) $action = ($action=='add'?'create':'edit'); } } + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $error++; + $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); + $action = ($action=='add'?'create':'edit'); + } } } + if (! $error) { if ($action == 'add') @@ -293,7 +312,7 @@ if (empty($reshook)) // Gestion du logo de la société } else - { + { $error=$object->error; $errors=$object->errors; } @@ -834,7 +853,13 @@ else if ($idprof!='-') { if (($j % 2) == 0) print ''; - print ''; @@ -1271,7 +1296,13 @@ else if ($idprof!='-') { if (($j % 2) == 0) print ''; - print ''; From a2123d0fe9ae1e71c450a0f6b93c1beb2c567766 Mon Sep 17 00:00:00 2001 From: simnandez Date: Fri, 30 Nov 2012 21:49:27 +0100 Subject: [PATCH 13/13] Trad: Update ca_ES and es_ES profid of countries --- htdocs/langs/ca_ES/companies.lang | 27 ++++++++++++++++++++++----- htdocs/langs/es_ES/companies.lang | 21 +++++++++++++++++++-- 2 files changed, 41 insertions(+), 7 deletions(-) diff --git a/htdocs/langs/ca_ES/companies.lang b/htdocs/langs/ca_ES/companies.lang index caa0cfe0174..63ae033cd98 100644 --- a/htdocs/langs/ca_ES/companies.lang +++ b/htdocs/langs/ca_ES/companies.lang @@ -108,42 +108,49 @@ ProfId2AR=Ingressos bruts ProfId3AR=- ProfId4AR=- ProfId5AR=- +ProfId6AR=- ProfId1AU=ABN ProfId2AU=- ProfId3AU=- ProfId4AU=- ProfId5AU=- +ProfId6AU=- ProfId1BE=N° col·legiat ProfId2BE=- ProfId3BE=- ProfId4BE=- ProfId5BE=- -ProfId1BR=CNPJ +ProfId6BE=- +ProfId1BR=- ProfId2BR=IE (Inscricao Estadual) ProfId3BR=IM (Inscricao Municipal) ProfId4BR=CPF -#ProfId5BR=CNAE= -#ProfId6BR=INSS= +#ProfId5BR=CNAE +#ProfId6BR=INSS ProfId1CH=- ProfId2CH=- ProfId3CH=Número federat ProfId4CH=Num registre de comerç ProfId5CH=- +ProfId6CH=- ProfId1CL=R.U.T. ProfId2CL=- ProfId3CL=- ProfId4CL=- ProfId5CL=- +ProfId6CL=- ProfId1CO=R.U.T. ProfId2CO=- ProfId3CO=- ProfId4CO=- ProfId5CO=- +ProfId6CO=- ProfId1DE=Id prof. 1 (USt.-IdNr) ProfId2DE=Id prof. 2 (USt.-Nr) ProfId3DE=Id prof. 3 (Handelsregister-Nr.) ProfId4DE=- ProfId5DE=- +ProfId6DE=- ProfId1ES=CIF/NIF ProfId2ES=Núm seguretat social ProfId3ES=CNAE @@ -161,51 +168,61 @@ ProfId2GB=- ProfId3GB=SIC ProfId4GB=- ProfId5GB=- +ProfId6GB=- ProfId1HN=RTN ProfId2HN=- ProfId3HN=- ProfId4HN=- ProfId5HN=- +ProfId6HN=- ProfId1IN=Id prof. 1 (TIN) -ProfId2IN=Id prof. 2 -ProfId3IN=Id prof. 3 +ProfId2IN=Id prof. 2 (PAN) +ProfId3IN=Id prof. 3 (SRVC TAX) ProfId4IN=Id prof. 4 ProfId5IN=Id prof. 5 +ProfId6IN=- ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) ProfId5MA=- +ProfId6MA=- ProfId1MX=R.F.C. ProfId2MX=Registre Patronal IMSS ProfId3MX=Cèdula Professional ProfId4MX=- ProfId5MX=- +ProfId6MX=- ProfId1NL=Número KVK ProfId2NL=- ProfId3NL=- ProfId4NL=- ProfId5NL=- +ProfId6NL=- ProfId1PT=NIPC ProfId2PT=Núm seguretat social ProfId3PT=Num reg. comercial ProfId4PT=Conservatori ProfId5PT=- +ProfId6PT=- ProfId1RU=OGRN ProfId2RU=INN ProfId3RU=KPP ProfId4RU=OKPO ProfId5RU=- +ProfId6RU=- ProfId1SN=RC ProfId2SN=NINEA ProfId3SN=- ProfId4SN=- ProfId5SN=- +ProfId6SN=- ProfId1TN=RC ProfId2TN=Matrícula fiscal ProfId3TN=Codi en aduana ProfId4TN=CCC ProfId5TN=- +ProfId6TN=- VATIntra=NIF intracomunitari VATIntraShort=NIF intra. VATIntraVeryShort=NIF intra. diff --git a/htdocs/langs/es_ES/companies.lang b/htdocs/langs/es_ES/companies.lang index 9313df97434..511921a014b 100644 --- a/htdocs/langs/es_ES/companies.lang +++ b/htdocs/langs/es_ES/companies.lang @@ -109,17 +109,20 @@ ProfId2AR=Ingresos brutos ProfId3AR=- ProfId4AR=- ProfId5AR=- +ProfId6AR=- ProfId1AU=ABN ProfId2AU=- ProfId3AU=- ProfId4AU=- ProfId5AU=- +ProfId6AU=- ProfId1BE=N° colegiado ProfId2BE=- ProfId3BE=- ProfId4BE=- ProfId5BE=- -ProfId1BR=CNPJ +ProfId6BE=- +ProfId1BR=- ProfId2BR=IE (Inscricao Estadual) ProfId3BR=IM (Inscricao Municipal) ProfId4BR=CPF @@ -130,21 +133,25 @@ ProfId2CH=- ProfId3CH=Número federado ProfId4CH=Num registro de comercio ProfId5CH=- +ProfId6CH=- ProfId1CL=R.U.T. ProfId2CL=- ProfId3CL=- ProfId4CL=- ProfId5CL=- +ProfId6CL=- ProfId1CO=R.U.T. ProfId2CO=- ProfId3CO=- ProfId4CO=- ProfId5CO=- +ProfId6CO=- ProfId1DE=Id prof. 1 (USt.-IdNr) ProfId2DE=Id prof. 2 (USt.-Nr) ProfId3DE=Id prof. 3 (Handelsregister-Nr.) ProfId4DE=- ProfId5DE=- +ProfId6DE=- ProfId1ES=CIF/NIF ProfId2ES=Núm seguridad social ProfId3ES=CNAE @@ -162,51 +169,61 @@ ProfId2GB=- ProfId3GB=SIC ProfId4GB=- ProfId5GB=- +ProfId6GB=- ProfId1HN=RTN ProfId2HN=- ProfId3HN=- ProfId4HN=- ProfId5HN=- +ProfId6HN=- ProfId1IN=Id prof. 1 (TIN) ProfId2IN=Id prof. 2 ProfId3IN=Id prof. 3 ProfId4IN=Id prof. 4 ProfId5IN=Id prof. 5 +ProfId6IN=- ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 +ProfId5MA=- +ProfId6MA=- ProfId1MX=R.F.C. ProfId2MX=Registro Patronal IMSS ProfId3MX=Cédula Profesional ProfId4MX=- ProfId5MX=- +ProfId6MX=- ProfId1NL=Número KVK ProfId2NL=- ProfId3NL=- ProfId4NL=- ProfId5NL=- +ProfId6NL=- ProfId1PT=NIPC ProfId2PT=Núm. seguridad social ProfId3PT=Num reg. comercial ProfId4PT=Conservatorio ProfId5PT=- +ProfId6PT=- ProfId1RU=OGRN ProfId2RU=INN ProfId3RU=KPP ProfId4RU=OKPO ProfId5RU=- +ProfId6RU=- ProfId1SN=RC ProfId2SN=NINEA ProfId3SN=- ProfId4SN=- ProfId5SN=- +ProfId6SN=- ProfId1TN=RC ProfId2TN=Matrícula fiscal ProfId3TN=Código en aduana ProfId4TN=CCC ProfId5TN=- +ProfId6TN=- VATIntra=NIF intracomunitario VATIntraShort=NIF intra. VATIntraVeryShort=NIF intra.
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("MustBeUnique").''.$langs->trans("MustBeMandatory").'
'; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print '
'.$profid[$i][0]."\n"; - print $profid[$i][1]; - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print ''; - print img_picto($langs->trans("Activated"),'switch_on'); - print ''; - print img_picto($langs->trans("Disabled"),'switch_off'); - print '
'.$profid[$i][0]."\n"; + print $profid[$i][1]; + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print ''; + print img_picto($langs->trans("Activated"),'switch_on'); + print ''; + print img_picto($langs->trans("Disabled"),'switch_off'); + print '
'.$idprof.''; + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if(empty($conf->global->$idprof_mandatory)) + print ''.$idprof.''; + else + print ''.$idprof.''; + $key='idprof'.$i; print $formcompany->get_input_id_prof($i,'idprof'.$i,$object->$key,$object->country_code); print '
'.$idprof.''; + + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if(empty($conf->global->$idprof_mandatory)) + print ''.$idprof.''; + else + print ''.$idprof.''; + $key='idprof'.$i; print $formcompany->get_input_id_prof($i,'idprof'.$i,$object->$key,$object->country_code); print '