From 5254f102ba5575c211ea2d1f3850058b8a687971 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 May 2013 10:56:48 +0200 Subject: [PATCH 1/4] Fix: Solve duplicate js and solve jmobile problem of cache. --- htdocs/core/get_menudiv.php | 2 -- htdocs/main.inc.php | 23 ++++++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index f320b7cc8eb..59ab4c9ecf3 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -50,8 +50,6 @@ $title=$langs->trans("Menu"); // URL http://mydolibarr/core/get_menudiv.php?dol_use_jmobile=1 can be used for tests $arrayofjs=array(); $arrayofcss=array(); -$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); -$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); print ''."\n"; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d27bb64e6d0..f3f85d53949 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -983,9 +983,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs // jQuery jMobile if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || ! empty($conf->dol_use_jmobile)) { - print ''."\n"; - //$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); - print ''."\n"; + print ''."\n"; } } @@ -1149,11 +1147,22 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs } // jQuery jMobile if (! empty($conf->global->MAIN_USE_JQUERY_JMOBILE) || defined('REQUIRE_JQUERY_JMOBILE') || (! empty($conf->dol_use_jmobile) && $conf->dol_use_jmobile > 0)) - { + { + // We must force not using ajax because cache of jquery does not load js of other pages. + // This also increase seriously speed onto mobile device where complex js code is very slow and memory very low. + if (empty($conf->dol_use_jmobile) || $conf->dol_use_jmobile != 2) + { + print ''; + } print ''."\n"; - //$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); - print ''."\n"; - print ''."\n"; } } From a5962a410e3ec1fafa73a5f2e95cb9f1c4d17ac5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 May 2013 13:21:01 +0200 Subject: [PATCH 2/4] Fix: Bad param used --- htdocs/core/modules/DolibarrModules.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 794ebda1428..ca709ba4e32 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -606,9 +606,11 @@ abstract class DolibarrModules foreach ($this->boxes as $key => $value) { //$titre = $this->boxes[$key][0]; - $file = $this->boxes[$key][1]; + $file = $this->boxes[$key]['file']; //$note = $this->boxes[$key][2]; + if (empty($file)) $file = isset($this->boxes[$key][1])?$this->boxes[$key][1]:''; // For backward compatibility + $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes"; $sql.= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def"; $sql.= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid"; From da73a8d84c4cd47cff1d67d603ce69773d2c64a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 May 2013 13:30:24 +0200 Subject: [PATCH 3/4] Fix: syntax error Fix: Bad field param --- htdocs/core/modules/modAdherent.class.php | 4 +++- htdocs/core/modules/modExternalRss.class.php | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index baf52d30d1a..74fd21da47f 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -42,6 +42,8 @@ class modAdherent extends DolibarrModules */ function __construct($db) { + global $conf; + $this->db = $db; $this->numero = 310; @@ -177,7 +179,7 @@ class modAdherent extends DolibarrModules $this->export_TypeFields_array[$r]=array('a.civilite'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'a.country'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:fk_adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.cotisation'=>'Number'); $this->export_entities_array[$r]=array('a.rowid'=>'member','a.civilite'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'a.country'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription'); // Add extra fields - $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member'"; + $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'member' AND entity = ".$conf->entity; $resql=$this->db->query($sql); while ($obj=$this->db->fetch_object($resql)) { diff --git a/htdocs/core/modules/modExternalRss.class.php b/htdocs/core/modules/modExternalRss.class.php index fc94dd8c405..5e7de7abea5 100644 --- a/htdocs/core/modules/modExternalRss.class.php +++ b/htdocs/core/modules/modExternalRss.class.php @@ -105,9 +105,9 @@ class modExternalRss extends DolibarrModules if (preg_match('/EXTERNAL_RSS_TITLE_([0-9]+)/i',$obj->name,$reg)) { // Definie la boite si on a trouvee une ancienne configuration - $this->boxes[$reg[1]][0] = "(ExternalRSSInformations)"; - $this->boxes[$reg[1]][1] = "box_external_rss.php"; - $this->boxes[$reg[1]][2] = $reg[1]." (".$obj->value.")"; + //$this->boxes[$reg[1]][0] = "(ExternalRSSInformations)"; + $this->boxes[$reg[1]]['file'] = "box_external_rss.php"; + $this->boxes[$reg[1]]['note'] = $reg[1]." (".$obj->value.")"; } } $this->db->free($result); @@ -131,7 +131,7 @@ class modExternalRss extends DolibarrModules $sql = array(); // Delete old declarations of RSS box - $this->boxes[0][1] = "box_external_rss.php"; + $this->boxes[0]['file'] = "box_external_rss.php"; return $this->_remove($sql,$options); } From 743da5a2140f26454725e72125c62aa2bf65e9fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 31 May 2013 21:33:48 +0200 Subject: [PATCH 4/4] Fix: function to get localtax1 or 2 value from vat rate return bad value when countries differs. Conflicts: htdocs/langs/fr_CA/main.lang --- htdocs/core/lib/functions.lib.php | 12 +++++++----- htdocs/core/lib/price.lib.php | 6 ++++-- htdocs/langs/fr_CA/admin.lang | 18 ++++++++++++++++++ htdocs/langs/fr_CA/companies.lang | 7 +++++++ htdocs/langs/fr_CA/main.lang | 11 ++++++++++- 5 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 htdocs/langs/fr_CA/admin.lang create mode 100644 htdocs/langs/fr_CA/companies.lang diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 531fb2f52fa..2b461206f2d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2793,7 +2793,7 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") if (empty($thirdparty_seller) || ! is_object($thirdparty_seller)) $thirdparty_seller=$mysoc; - dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')." thirdparty_seller id=".$thirdparty_seller->id); + dol_syslog("get_localtax tva=".$tva." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer)?$thirdparty_buyer->id:'')."/country_code=".(is_object($thirdparty_buyer)?$thirdparty_buyer->country_code:'')." thirdparty_seller id=".$thirdparty_seller->id."/country_code=".$thirdparty_seller->country_code." thirdparty_seller localtax1_assuj=".$thirdparty_seller->localtax1_assuj." thirdparty_seller localtax2_assuj=".$thirdparty_seller->localtax2_assuj); // Some test to guess with no need to make database access if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe @@ -2819,16 +2819,18 @@ function get_localtax($tva, $local, $thirdparty_buyer="", $thirdparty_seller="") } //if ($local == 0 && ! $thirdparty_seller->localtax1_assuj && ! $thirdparty_seller->localtax2_assuj) return array('localtax1'=>0,'localtax2'=>0); - $code_country=$thirdparty_seller->country_code; + // Do not enabled this. We want localtax that match the vat rate. + // If we forced a vat, we must also force local tax + /* if (is_object($thirdparty_buyer)) { - if ($code_country != $thirdparty_buyer->country_code) return 0; - } + if ($thirdparty_seller->country_code != $thirdparty_buyer->country_code) return 0; + }*/ // Search local taxes $sql = "SELECT t.localtax1, t.localtax2, 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 = '".$code_country."'"; + $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$thirdparty_seller->country_code."'"; $sql .= " AND t.taux = ".$tva." AND t.active = 1"; dol_syslog("get_localtax sql=".$sql); diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index c3af3e2e973..5b4fbee52ff 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -79,7 +79,9 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $seller=$mysoc; // If sell is done to a customer, $seller is not provided, we use $mysoc //var_dump($seller->country_id);exit; } - + // Too verbose. Enable for debug only + //dol_syslog("calcul_price_total qty=".$qty." pu=".$pu." remiserpercent_ligne=".$remise_percent_ligne." txtva=".$txtva." uselocaltax1_rate=".$uselocaltax1_rate." uselocaltax2_rate=".$uselocaltax2_rate); + $countryid=$seller->country_id; if ($uselocaltax1_rate < 0) $uselocaltax1_rate=$seller->localtax1_assuj; if ($uselocaltax2_rate < 0) $uselocaltax2_rate=$seller->localtax2_assuj; @@ -91,7 +93,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $sql.= " FROM ".MAIN_DB_PREFIX."c_tva as cv"; $sql.= " WHERE cv.taux = ".$txtva; $sql.= " AND cv.fk_pays = ".$countryid; - dol_syslog("search vat information sql=".$sql); + dol_syslog("calcul_price_total search vat information sql=".$sql); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/langs/fr_CA/admin.lang b/htdocs/langs/fr_CA/admin.lang new file mode 100644 index 00000000000..69e2630bc9c --- /dev/null +++ b/htdocs/langs/fr_CA/admin.lang @@ -0,0 +1,18 @@ +# Dolibarr language file - Source file is en_US - admin +CHARSET=UTF-8 +VATManagement=Gestion TPS +VATIsUsedDesc=Le taux de TPS proposé par défaut lors de la création de proposition commerciale, facture, commande, etc... répond à la règle standard suivante :
Si vendeur non assujetti à TPS, TPS par défaut=0. Fin de règle.
Si le (pays vendeur= pays acheteur) alors TPS par défaut=TPS du produit vendu. Fin de règle.
Si vendeur et acheteur dans Communauté européenne et bien vendu= moyen de transport neuf (auto, bateau, avion), TPS par défaut=0 (La TPS doit être payée par acheteur au centre d'impôts de son pays et non au vendeur). Fin de règle.
Si vendeur et acheteur dans Communauté européenne et acheteur= particulier alors TPS par défaut=TPS du produit vendu. Fin de règle.
Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TPS par défaut=0. Fin de règle.
Sinon TPS proposée par défaut=0. Fin de règle.
+VATIsNotUsedDesc=Le taux de TPS proposé par défaut est 0. C'est le cas d'associations, particuliers ou certaines petites sociétés. +VATIsUsedExampleFR=En France, il s'agit des sociétés ou organismes ayant choisi un régime fiscale réel (Réel simplifié ou Réel normal), régime dans lequel la TVA est déclarée. +VATIsNotUsedExampleFR=En France, il s'agit des associations ne déclarant pas de TVA ou sociétés, organismes ou professions libérales ayant choisi le régime fiscal micro entreprise (TVA en franchise) et payant une TVA en franchise sans faire de déclaration de TVA. Ce choix fait de plus apparaître la mention "TVA non applicable - art-293B du CGI" sur les factures. +##### Local Taxes ##### +LocalTax1IsUsed=Assujeti +LocalTax1IsNotUsed=Non assujeti +LocalTax1IsUsedDesc=Utilisation de 2ème type taxe (TVQ) +LocalTax1IsNotUsedDesc=Pas d'utilisation de 2ème type taxe (TVQ) +LocalTax1Management=Gestion TVQ +LocalTax1ManagementCA= Gestion TVQ +LocalTax1IsUsedDescCA= +LocalTax1IsNotUsedDescCA= +LocalTax1IsUsedExampleCA= +LocalTax1IsNotUsedExampleCA= diff --git a/htdocs/langs/fr_CA/companies.lang b/htdocs/langs/fr_CA/companies.lang new file mode 100644 index 00000000000..b3028ccfe5a --- /dev/null +++ b/htdocs/langs/fr_CA/companies.lang @@ -0,0 +1,7 @@ +# Dolibarr language file - en_US - companies +CHARSET=UTF-8 +VATIsUsed=Assujetti à la TPS +VATIsNotUsed=Non assujetti à la TPS +##### Local Taxes ##### +LocalTax1IsUsedES= Assujetti à TVQ +LocalTax1IsNotUsedES= Non assujetti à TVQ \ No newline at end of file diff --git a/htdocs/langs/fr_CA/main.lang b/htdocs/langs/fr_CA/main.lang index ca4b13b8480..cb3893d45fc 100644 --- a/htdocs/langs/fr_CA/main.lang +++ b/htdocs/langs/fr_CA/main.lang @@ -13,4 +13,13 @@ FormatDateTextShort=%d %b %Y FormatDateText=%d %B %Y FormatDateHourShort=%d.%m.%Y %H:%M FormatDateHourTextShort=%d %b %Y %H:%M -FormatDateHourText=%d %B %Y %H:%M \ No newline at end of file +FormatDateHourText=%d %B %Y %H:%M +AmountVAT=Montant TPS +AmountLT1=Montant TVQ +TotalVAT=Total TPS +TotalLT1=Total TVQ +IncludedVAT=Dont TPS +VAT=TPS +LT1CA=TVQ +VATRate=Taux TPS +ErrorNoVATRateDefinedForSellerCountry=Erreur, aucun taux de taxe défini pour le pays '%s'. \ No newline at end of file