From 7d01ea7fc32ea504a464bf9837dba266239e0120 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Nov 2012 19:42:03 +0100 Subject: [PATCH 1/9] Fix: Do not break dolibarr usage if log fails --- htdocs/core/modules/syslog/mod_syslog_file.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 4fbc9a39c4d..6920d35bb48 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -99,7 +99,9 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface if (!$filefd && ! defined("SYSLOG_FILE_NO_ERROR")) { - throw new Exception('Failed to open log file '.$logfile); + // Do not break dolibarr usage if log fails + //throw new Exception('Failed to open log file '.basename($logfile)); + print 'Failed to open log file '.basename($logfile); } $logLevels = array( From e5fdb468f364c5393791a1ce3df37b5c1023651f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Nov 2012 22:57:38 +0100 Subject: [PATCH 2/9] Add info file --- dev/iso-normes/world_tax_rates.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 dev/iso-normes/world_tax_rates.txt diff --git a/dev/iso-normes/world_tax_rates.txt b/dev/iso-normes/world_tax_rates.txt new file mode 100644 index 00000000000..e5bb64a86f2 --- /dev/null +++ b/dev/iso-normes/world_tax_rates.txt @@ -0,0 +1 @@ +http://www.taxrates.cc/index.html \ No newline at end of file From 831fe6a29e9abc497a8c52eadff22753faa9c630 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Nov 2012 23:45:16 +0100 Subject: [PATCH 3/9] Fix: More fix about the new localtax system --- htdocs/compta/facture.php | 4 +- htdocs/core/lib/functions.lib.php | 124 +++++++++++++++++++++--------- test/phpunit/FunctionsTest.php | 97 +++++++++++++++++++++-- 3 files changed, 181 insertions(+), 44 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 92ff891cca9..73e8555a8a3 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -281,7 +281,7 @@ else if ($action == 'setconditions' && $user->rights->facture->creer) $object->cond_reglement_id=0; // To clean property $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); if ($result < 0) dol_print_error($db,$object->error); - + $old_date_lim_reglement=$object->date_lim_reglement; $new_date_lim_reglement=$object->calculate_date_lim_reglement(); if ($new_date_lim_reglement > $old_date_lim_reglement) $object->date_lim_reglement=$new_date_lim_reglement; @@ -2834,7 +2834,7 @@ else if ($id > 0 || ! empty($ref)) print ''; // Margin Infos - if (! empty($conf->margin->enabled)) + if (! empty($conf->margin->enabled)) { print '
'; $object->displayMarginInfos($object->statut > 0); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4422e6d6453..aef25a6d679 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2681,13 +2681,15 @@ function price2num($amount,$rounding='',$alreadysqlnb=0) } /** - * Return localtaxe rate for a particular vat + * Return localtax rate for a particular vat, when selling a product with vat $tva, from a $thirdparty_buyer to a $thirdparty_seller + * Note: It applies same rule than get_default_tva * * @param float $tva Vat taxe * @param int $local Local tax to search and return (1 or 2 return only tax rate 1 or tax rate 2) * @param Societe $thirdparty_buyer Object of buying third party * @param Societe $thirdparty_seller Object of selling third party * @return int 0 if not found, localtax if found + * @see get_default_tva */ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") { @@ -2706,9 +2708,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") if (is_object($thirdparty_buyer)) { - if ($code_country!=$thirdparty_buyer->country_code) return 0; - if ($local==1 && !$thirdparty_buyer->localtax1_assuj) return 0; // TODO Not sure this is good - elseif ($local==2 && !$thirdparty_buyer->localtax2_assuj) return 0; // TODO Not sure this is good + if ($code_country != $thirdparty_buyer->country_code) return 0; } // Search local taxes @@ -2731,14 +2731,13 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") } /** - * Return vat rate of a product in a particular selling country or default country - * vat if product is unknown + * Return vat rate of a product in a particular selling country or default country vat if product is unknown * * @param int $idprod Id of product or 0 if not a predefined product * @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...) * @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice) * @return int <0 if KO, Vat rate if OK - * TODO May be this should be better as a method of product class + * @see get_product_localtax_for_country */ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice=0) { @@ -2804,25 +2803,71 @@ function get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournpr } /** - * Return localtax rate of a product in a particular selling country + * Return localtax vat rate of a product in a particular selling country or default country vat if product is unknown * - * @param int $idprod Id of product - * @param int $local 1 for localtax1, 2 for localtax 2 - * @param string $countrycode Country code (FR, US, IT, ...) - * @return int <0 if KO, Vat rate if OK - * TODO May be this should be better as a method of product class + * @param int $idprod Id of product + * @param int $local 1 for localtax1, 2 for localtax 2 + * @param Societe $thirdparty_seller Thirdparty with a ->country_code defined (FR, US, IT, ...) + * @return int <0 if KO, Vat rate if OK + * @see get_product_vat_for_country */ -function get_product_localtax_for_country($idprod, $local, $countrycode) +function get_product_localtax_for_country($idprod, $local, $thirdparty_seller) { - global $db; + global $db,$mysoc; - $product=new Product($db); - $product->fetch($idprod); + if (! class_exists('Product')) { + require DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + } - if ($local==1) return $product->localtax1_tx; - elseif ($local==2) return $product->localtax2_tx; + $ret=0; + $found=0; - return -1; + if ($idprod > 0) + { + // Load product + $product=new Product($db); + $result=$product->fetch($idprod); + + if ($mysoc->country_code == $thirdparty_seller->country_code) // If selling country is ours + { + /* Not defined yet, so we don't use this + if ($local==1) $ret=$product->localtax1_tx; + elseif ($local==2) $ret=$product->localtax2_tx; + $found=1; + */ + } + else + { + // TODO Read default product vat according to countrycode and product + + + } + } + + if (! $found) + { + // If vat of product for the country not found or not defined, we return higher vat of country. + $sql = "SELECT taux as vat_rate, localtax1, localtax2"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql.= " WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$thirdparty_seller->country_code."'"; + $sql.= " ORDER BY t.taux DESC, t.recuperableonly ASC"; + $sql.= $db->plimit(1); + + $resql=$db->query($sql); + if ($resql) + { + $obj=$db->fetch_object($resql); + if ($obj) + { + if ($local==1) $ret=$obj->localtax1; + elseif ($local==2) $ret=$obj->localtax2; + } + } + else dol_print_error($db); + } + + dol_syslog("get_product_localtax_for_country: ret=".$ret); + return $ret; } /** @@ -2839,6 +2884,7 @@ function get_product_localtax_for_country($idprod, $local, $countrycode) * @param int $idprod Id product * @param int $idprodfournprice Id product_fournisseur_price (for supplier order/invoice) * @return float Taux de tva a appliquer, -1 si ne peut etre determine + * @see get_default_localtax */ function get_default_tva($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idprodfournprice=0) { @@ -2926,36 +2972,40 @@ function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod) /** * Function that return localtax of a product line (according to seller, buyer and product vat rate) + * Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle. + * Si le (pays vendeur = pays acheteur) alors TVA par defaut=TVA du produit vendu. Fin de regle. + * Sinon TVA proposee par defaut=0. Fin de regle. * * @param Societe $thirdparty_seller Objet societe vendeuse * @param Societe $thirdparty_buyer Objet societe acheteuse * @param int $local Localtax to process (1 or 2) * @param int $idprod Id product - * @return float Taux de localtax appliquer, -1 si ne peut etre determine + * @return float localtax, -1 si ne peut etre determine + * @see get_default_tva */ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $idprod=0) { if (!is_object($thirdparty_seller)) return -1; if (!is_object($thirdparty_buyer)) return -1; - if ($thirdparty_seller->country_id=='ES' || $thirdparty_seller->country_code=='ES') + if ($local==1) //RE { - if ($local==1) //RE - { - // Si achatteur non assujeti a RE, localtax1 par default=0 - if (is_numeric($thirdparty_buyer->localtax1_assuj) && ! $thirdparty_buyer->localtax1_assuj) return 0; - if (! is_numeric($thirdparty_buyer->localtax1_assuj) && $thirdparty_buyer->localtax1_assuj=='localtax1off') return 0; - } - elseif ($local==2) //IRPF - { - // Si vendeur non assujeti a IRPF, localtax2 par default=0 - if (is_numeric($thirdparty_seller->localtax2_assuj) && ! $thirdparty_seller->localtax2_assuj) return 0; - if (! is_numeric($thirdparty_seller->localtax2_assuj) && $thirdparty_seller->localtax2_assuj=='localtax2off') return 0; - } else return -1; - - if ($idprod) return get_product_localtax_for_country($idprod, $local, $thirdparty_seller->country_code); - else return -1; + // Si vendeur non assujeti a RE, localtax1 par default=0 + if (is_numeric($thirdparty_seller->localtax1_assuj) && ! $thirdparty_seller->localtax1_assuj) return 0; + if (! is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj=='localtax1off') return 0; } + elseif ($local==2) //IRPF + { + // Si vendeur non assujeti a IRPF, localtax2 par default=0 + if (is_numeric($thirdparty_seller->localtax2_assuj) && ! $thirdparty_seller->localtax2_assuj) return 0; + if (! is_numeric($thirdparty_seller->localtax2_assuj) && $thirdparty_seller->localtax2_assuj=='localtax2off') return 0; + } + + if ($thirdparty_seller->country_code == $thirdparty_buyer->country_code) + { + return get_product_localtax_for_country($idprod, $local, $thirdparty_seller); + } + return 0; } diff --git a/test/phpunit/FunctionsTest.php b/test/phpunit/FunctionsTest.php index 9dc7ff30580..92400d36e9f 100755 --- a/test/phpunit/FunctionsTest.php +++ b/test/phpunit/FunctionsTest.php @@ -530,9 +530,9 @@ class FunctionsTest extends PHPUnit_Framework_TestCase $companyfr->country_code='FR'; $companyfr->tva_assuj=1; - $companymo=new Societe($db); - $companymo->country_code='MC'; - $companymo->tva_assuj=1; + $companymc=new Societe($db); + $companymc->country_code='MC'; + $companymc->tva_assuj=1; $companyit=new Societe($db); $companyit->country_code='IT'; @@ -551,7 +551,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase $companyus->tva_intra=''; // Test RULE 1-2 - $vat=get_default_tva($companyfrnovat,$companymo,0); + $vat=get_default_tva($companyfrnovat,$companymc,0); $this->assertEquals(0,$vat); // Test RULE 3 (FR-FR) @@ -559,7 +559,7 @@ class FunctionsTest extends PHPUnit_Framework_TestCase $this->assertEquals(19.6,$vat); // Test RULE 3 (FR-MC) - $vat=get_default_tva($companyfr,$companymo,0); + $vat=get_default_tva($companyfr,$companymc,0); $this->assertEquals(19.6,$vat); // Test RULE 4 (FR-IT) @@ -577,5 +577,92 @@ class FunctionsTest extends PHPUnit_Framework_TestCase $vat=get_default_tva($companyfr,$companyus,0); $this->assertEquals(0,$vat); } + + /** + * testGetDefaultTva + * + * @return void + */ + public function testGetDefaultLocalTax() + { + global $conf,$user,$langs,$db; + $this->savconf=$conf; + $this->savuser=$user; + $this->savlangs=$langs; + $this->savdb=$db; + + $companyfrnovat=new Societe($db); + $companyfrnovat->country_code='FR'; + $companyfrnovat->tva_assuj=0; + $companyfrnovat->localtax1_assuj=0; + $companyfrnovat->localtax2_assuj=0; + + $companyes=new Societe($db); + $companyes->country_code='ES'; + $companyes->tva_assuj=1; + $companyes->localtax1_assuj=1; + $companyes->localtax2_assuj=1; + + $companymc=new Societe($db); + $companymc->country_code='MC'; + $companymc->tva_assuj=1; + $companymc->localtax1_assuj=0; + $companymc->localtax2_assuj=0; + + $companyit=new Societe($db); + $companyit->country_code='IT'; + $companyit->tva_assuj=1; + $companyit->tva_intra='IT99999'; + $companyit->localtax1_assuj=0; + $companyit->localtax2_assuj=0; + + $notcompanyit=new Societe($db); + $notcompanyit->country_code='IT'; + $notcompanyit->tva_assuj=1; + $notcompanyit->tva_intra=''; + $notcompanyit->typent_code='TE_PRIVATE'; + $notcompanyit->localtax1_assuj=0; + $notcompanyit->localtax2_assuj=0; + + $companyus=new Societe($db); + $companyus->country_code='US'; + $companyus->tva_assuj=1; + $companyus->tva_intra=''; + $companyus->localtax1_assuj=0; + $companyus->localtax2_assuj=0; + + // Test RULE FR-MC + $vat1=get_default_localtax($companyfrnovat,$companymc,1,0); + $vat2=get_default_localtax($companyfrnovat,$companymc,2,0); + $this->assertEquals(0,$vat1); + $this->assertEquals(0,$vat2); + + // Test RULE ES-ES + $vat1=get_default_localtax($companyes,$companyes,1,0); + $vat2=get_default_localtax($companyes,$companyes,2,0); + $this->assertEquals(5.2,$vat1); + $this->assertEquals(-15,$vat2); + + // Test RULE ES-IT + $vat1=get_default_localtax($companyes,$companyit,1,0); + $vat2=get_default_localtax($companyes,$companyit,2,0); + $this->assertEquals(0,$vat1); + $this->assertEquals(0,$vat2); + + // Test RULE ES-IT + $vat1=get_default_localtax($companyes,$notcompanyit,1,0); + $vat2=get_default_localtax($companyes,$notcompanyit,2,0); + $this->assertEquals(0,$vat1); + $this->assertEquals(0,$vat2); + + // Test RULE FR-IT + // Not tested + + // Test RULE ES-US + $vat1=get_default_localtax($companyes,$companyus,1,0); + $vat2=get_default_localtax($companyes,$companyus,2,0); + $this->assertEquals(0,$vat1); + $this->assertEquals(0,$vat2); + } } ?> \ No newline at end of file From 579544aa2fa2e37a423b4eaff9a018af5763bcc4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Nov 2012 02:22:25 +0100 Subject: [PATCH 4/9] Add example of comment --- htdocs/robots.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/robots.txt b/htdocs/robots.txt index c7711001558..a6a27039016 100644 --- a/htdocs/robots.txt +++ b/htdocs/robots.txt @@ -2,4 +2,5 @@ User-agent: * Allow: /public/agenda/agendaexport.php Allow: /public/demo/ Allow: /index.php -Disallow: / \ No newline at end of file +#Allow: /$ +Disallow: / From 40725e72a51a6fa0b161122757888662ca152326 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 7 Nov 2012 11:49:28 +0100 Subject: [PATCH 5/9] Fix: missing spanish localtax values update --- htdocs/install/mysql/migration/3.2.0-3.3.0.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 57ed77a5126..ebc11b84e82 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -262,6 +262,12 @@ UPDATE llx_c_tva SET localtax2_type = '1' WHERE rowid = 41 AND fk_pays = 4 AND l UPDATE llx_c_tva SET localtax2_type = '1' WHERE rowid = 42 AND fk_pays = 4 AND localtax2_type = '0'; UPDATE llx_c_tva SET localtax2_type = '1' WHERE rowid = 43 AND fk_pays = 4 AND localtax2_type = '0'; +-- update localtax values for spain +UPDATE llx_c_tva set localtax1 = '5.2', localtax2 = '-15' where rowid= 41 and fk_pays= 4 AND localtax1_type='3'; +UPDATE llx_c_tva set localtax1 = '1.4', localtax2 = '-15' where rowid= 42 and fk_pays= 4 AND localtax1_type='3'; +UPDATE llx_c_tva set localtax1 = '0.5', localtax2 = '-15' where rowid= 43 and fk_pays= 4 AND localtax1_type='3'; + +-- update type of localtax for tunisia UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 101 and fk_pays= 10 AND localtax1_type='0'; UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 102 and fk_pays= 10 AND localtax1_type='0'; UPDATE llx_c_tva set localtax1 = 1, localtax1_type = '4', localtax2 = 0.4, localtax2_type = '7' where rowid= 103 and fk_pays= 10 AND localtax1_type='0'; From afe339a2e233769c6e42429902772c4143bc432c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 7 Nov 2012 12:00:17 +0100 Subject: [PATCH 6/9] Fix: strict mode --- htdocs/admin/dict.php | 46 +++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 98678e758ec..92111cd9a2c 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -502,9 +502,9 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) $result = $db->query($sql); if ($result) // Add is ok { - $oldid=$id; - $_POST=array('id'=>$oldid); // Clean $_POST array, we keep only - $_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition + //$oldid=$id; + //$_POST=array('id'=>$oldid); // Clean $_POST array, we keep only + //$_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition } else { @@ -558,12 +558,12 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) } if ($msg) $msg='
'.$msg.'
'; - $_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } if (GETPOST('actioncancel')) { - $_GET["id"]=$_POST["id"]; // Force affichage dictionnaire en cours d'edition + //$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition } if ($action == 'confirm_delete' && $confirm == 'yes') // delete @@ -778,7 +778,7 @@ if ($id) } $tmpaction = 'create'; - $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$_GET["id"]]); + $parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error=$hookmanager->error; $errors=$hookmanager->errors; @@ -947,69 +947,69 @@ if ($id) $valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); $valuetoshow=nl2br($valuetoshow); } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_pays') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_pays') { $key=$langs->trans("Country".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_availability') { + else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') { $langs->load("propal"); $key=$langs->trans("AvailabilityType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_actioncomm') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') { $key=$langs->trans("Action".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if (! empty($obj->code_iso) && $fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_currencies') { + else if (! empty($obj->code_iso) && $fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') { $key=$langs->trans("Currency".strtoupper($obj->code_iso)); $valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_typent') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') { $key=$langs->trans(strtoupper($obj->code)); $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_prospectlevel') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') { $key=$langs->trans(strtoupper($obj->code)); $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_civilite') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_civilite') { $key=$langs->trans("Civility".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_type_contact') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') { $key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_payment_term') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') { $langs->load("bills"); $key=$langs->trans("PaymentConditionShort".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_paiement') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') { $langs->load("bills"); $key=$langs->trans("PaymentType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_input_reason') { + else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') { $key=$langs->trans("DemandReasonType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_input_method') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') { $langs->load("orders"); $key=$langs->trans($obj->code); $valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->$fieldlist[$field]; } - else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_shipment_mode') { + else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') { $langs->load("sendings"); $key=$langs->trans("SendingMethod".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->$fieldlist[$field]); } - else if ($fieldlist[$field] == 'libelle' && $tabname[$_GET['id']]==MAIN_DB_PREFIX.'c_paper_format') + else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format') { $key = $langs->trans('PaperFormat'.strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->$fieldlist[$field]); } - else if ($fieldlist[$field] == 'libelle' && $tabname[$_GET['id']] == MAIN_DB_PREFIX.'c_type_fees') + else if ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') { $langs->load('trips'); $key = $langs->trans(strtoupper($obj->code)); @@ -1022,7 +1022,7 @@ if ($id) $valuetoshow = getCurrencySymbol($obj->code); } - else if (($fieldlist[$field] == 'unit') && ($tabname[$_GET['id']] == MAIN_DB_PREFIX.'c_paper_format')) + else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) { $key = $langs->trans('SizeUnit'.strtolower($obj->unit)); $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->$fieldlist[$field]); @@ -1269,7 +1269,7 @@ function fieldList($fieldlist,$obj='',$tabname='') elseif ($fieldlist[$field] == 'localtax1_type' || $fieldlist[$field] == 'localtax2_type') { print ''; - print $form->selectarray($fieldlist[$field], $localtax_typeList,$obj->$fieldlist[$field]); + print $form->selectarray($fieldlist[$field], $localtax_typeList, (! empty($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'')); print ''; } else From 066d72b5ecb97926837d84c05e8b96f2b1404060 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Nov 2012 13:59:26 +0100 Subject: [PATCH 7/9] typo error --- build/pad/pad_dolibarr.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pad/pad_dolibarr.xml b/build/pad/pad_dolibarr.xml index f0caca389b3..dc16effcee1 100644 --- a/build/pad/pad_dolibarr.xml +++ b/build/pad/pad_dolibarr.xml @@ -70,7 +70,7 @@ dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp Dolibarr ERP & CRM Dolibarr ERP & CRM, the easy to use open source software to manage your activity - Dolibarr ERP & CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to follow. + Dolibarr ERP & CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to manage. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this. Dolibarr ERP & CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install From 365c0397f641e0e9ca2cd819411279195c6124dd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Nov 2012 20:04:33 +0100 Subject: [PATCH 8/9] Doc --- build/pad/pad_dolibarr.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pad/pad_dolibarr.xml b/build/pad/pad_dolibarr.xml index dc16effcee1..e8c88ca8968 100644 --- a/build/pad/pad_dolibarr.xml +++ b/build/pad/pad_dolibarr.xml @@ -83,8 +83,8 @@ Note that Dolibarr is also available with an auto-installer for Windows or Ubunt Dolibarr ERP & CRM Dolibarr ERP & CRM, le gestionnaire simple pour gérer votre activité Dolibarr ERP & CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations) - Dolibarr ERP/CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). - Dolibarr ERP/CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): + Dolibarr ERP & CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). + Dolibarr ERP & CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S): Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle) Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie) Simple pour le développement (pas de frameworks lourds). From 661d37eacf817ffcdc0d3a0ce802af1a6ee59b0b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Nov 2012 12:15:15 +0100 Subject: [PATCH 9/9] Fix: New vat for switzerland --- htdocs/install/mysql/data/llx_c_tva.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 2a9746c7080..b0b051a8dcf 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -202,9 +202,9 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (20 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (204,20, '0','0','VAT Rate 0', 1); -- SWITZERLAND (id country=6) -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 61, 6, '7.6','0','VAT standard rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 62, 6, '3.6','0','VAT reduced rate',1); -insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 63, 6, '2.4','0','VAT super-reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 61, 6, '8','0','VAT standard rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 62, 6, '3.8','0','VAT reduced rate',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 63, 6, '2.5','0','VAT super-reduced rate',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 64, 6, '0','0','VAT Rate 0', 1); -- TUNISIA (id country=10)