From c94689e9a972e431de79965d223af5c0c416f5f2 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Wed, 12 Sep 2018 09:21:23 +0200 Subject: [PATCH 01/11] FIX remain to pay for credit note was wrong on invoice list --- htdocs/compta/facture/list.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 859889966eb..1fbdfcf380a 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1014,6 +1014,9 @@ if ($resql) $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; $facturestatic->statut=$obj->fk_statut; + $facturestatic->total_ttc=$obj->total_ttc; + $facturestatic->paye=$obj->paye; + $facturestatic->fk_soc=$obj->fk_soc; $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $facturestatic->note_public=$obj->note_public; $facturestatic->note_private=$obj->note_private; @@ -1022,7 +1025,13 @@ if ($resql) $totalcreditnotes = $facturestatic->getSumCreditNotesUsed(); $totaldeposits = $facturestatic->getSumDepositsUsed(); $totalpay = $paiement + $totalcreditnotes + $totaldeposits; - $remaintopay = $obj->total_ttc - $totalpay; + $remaintopay = $facturestatic->total_ttc - $totalpay; + if($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { + $discount = new DiscountAbsolute($db); + $remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id); + $remaintopay = -$remaincreditnote; + $totalpay = $facturestatic->total_ttc - $remaintopay; + } print ''; if (! empty($arrayfields['f.facnumber']['checked'])) From b68523b9c1333504fbc851c22accb167efca2451 Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 13 Sep 2018 14:12:31 +0200 Subject: [PATCH 02/11] FIX : According to french law, if seller is in France and buyer isn't in UE and isn't a company, TVA used = TVA product --- htdocs/core/lib/functions.lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f27c1fbf0a0..26a34af374b 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4744,6 +4744,11 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, } } + // Si (vendeur en France et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle + if($seller_country_code === 'FR' && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany()) { + return get_product_vat_for_country($idprod,$thirdparty_seller,$idprodfournprice); + } + // Sinon la TVA proposee par defaut=0. Fin de regle. // Rem: Cela signifie qu'au moins un des 2 est hors Communaute europeenne et que le pays differe //print 'VATRULE 5'; From d62118dca83ca6f57758deabf3cbb82c759cddbc Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 19 Sep 2018 14:53:56 +0200 Subject: [PATCH 03/11] FIX : langs fr --- htdocs/langs/fr_FR/agenda.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/fr_FR/agenda.lang b/htdocs/langs/fr_FR/agenda.lang index dbbf3513041..5efd3959e6e 100644 --- a/htdocs/langs/fr_FR/agenda.lang +++ b/htdocs/langs/fr_FR/agenda.lang @@ -108,7 +108,7 @@ MyAvailability=Ma disponibilité ActionType=Type événement DateActionBegin=Date début événément CloneAction=Cloner l'événement -ConfirmCloneEvent=Êtes-vous sûr de vouloir cloner cette facture %s ? +ConfirmCloneEvent=Êtes-vous sûr de vouloir cloner l'événement %s ? RepeatEvent=Répétez événement EveryWeek=Chaque semaine EveryMonth=Chaque mois From 4597cd44e55ac484a7f6c0a0de9b4d5211b4bc6c Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Thu, 20 Sep 2018 17:52:44 +0200 Subject: [PATCH 04/11] FIX #9432 --- htdocs/societe/card.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index e1f257cbf8f..ba2e92fe573 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -535,12 +535,13 @@ if (empty($reshook)) } // Links with users - $salesreps = GETPOST('commercial', 'array'); - $result = $object->setSalesRep($salesreps); - if ($result < 0) - { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); + if (!empty($user->rights->societe->client->voir)) { + $salesreps = GETPOST('commercial', 'array'); + $result = $object->setSalesRep($salesreps); + if ($result < 0) { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } } // Customer categories association From 1a7b38f22a0074147886258b138cf1dd458c5388 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 21 Sep 2018 10:14:23 +0200 Subject: [PATCH 05/11] FIX #9432 --- htdocs/societe/card.php | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ba2e92fe573..13fedebfa88 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -535,13 +535,12 @@ if (empty($reshook)) } // Links with users - if (!empty($user->rights->societe->client->voir)) { - $salesreps = GETPOST('commercial', 'array'); - $result = $object->setSalesRep($salesreps); - if ($result < 0) { - $error++; - setEventMessages($object->error, $object->errors, 'errors'); - } + $salesreps = GETPOST('commercial', 'array'); + $result = $object->setSalesRep($salesreps); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); } // Customer categories association @@ -1378,16 +1377,13 @@ else print ''; } - if ($user->rights->societe->client->voir) - { - // Assign a Name - print ''; - print ''.fieldLabel('AllocateCommercial','commercial_id').''; - print ''; - $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); - print $form->multiselectarray('commercial', $userlist, GETPOST('commercial', 'array'), null, null, null, null, "90%"); - print ''; - } + // Assign a Name + print ''; + print ''.fieldLabel('AllocateCommercial','commercial_id').''; + print ''; + $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); + print $form->multiselectarray('commercial', $userlist, (count(GETPOST('commercial', 'array')) > 0?GETPOST('commercial', 'array'):array($user->id)), null, null, null, null, "90%"); + print ''; // Incoterms if (!empty($conf->incoterm->enabled)) From d6d58b1f6803e98b44888c17bb5aeb814d53a010 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 21 Sep 2018 10:18:54 +0200 Subject: [PATCH 06/11] FIX #9432 --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 13fedebfa88..d90c8f2a1f0 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1382,7 +1382,7 @@ else print ''.fieldLabel('AllocateCommercial','commercial_id').''; print ''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); - print $form->multiselectarray('commercial', $userlist, (count(GETPOST('commercial', 'array')) > 0?GETPOST('commercial', 'array'):array($user->id)), null, null, null, null, "90%"); + print $form->multiselectarray('commercial', $userlist, (count(GETPOST('commercial', 'array')) > 0?GETPOST('commercial', 'array'):(empty($user->rights->societe->client->voir)?array($user->id):array())), null, null, null, null, "90%"); print ''; // Incoterms From 7b46bedce63aff7c8ae47f24248048f2b656ddaf Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 21 Sep 2018 14:35:36 +0200 Subject: [PATCH 07/11] NEW : hidden configuration --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 26a34af374b..f9399b7ab55 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4745,7 +4745,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, } // Si (vendeur en France et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle - if($seller_country_code === 'FR' && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany()) { + if(!empty($conf->global->MAIN_USE_PRODUCT_TVA_WHEN_FRENCH_SELLER_AND_INDIVIDUAL_CUSTOMER) && $seller_country_code === 'FR' && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany()) { return get_product_vat_for_country($idprod,$thirdparty_seller,$idprodfournprice); } From 77dd51602311aa429a050fd39d001ce33414e954 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 22 Sep 2018 14:45:15 +0200 Subject: [PATCH 08/11] fix number mailing for a contact / multicompany --- htdocs/contact/class/contact.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 59ca7caaf99..7c27d172af1 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1051,8 +1051,9 @@ class Contact extends CommonObject { $sql = "SELECT count(mc.email) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; - $sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'"; - $sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mailing as m on mc.fk_mailing=m.rowid"; + $sql.= " WHERE mc.email = '".$this->db->escape($this->email)."' "; + $sql.= " AND m.entity IN (".getEntity($this->element).") AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes $resql=$this->db->query($sql); if ($resql) From 1569770855e7fa3e03700d20fd061591dd3012b0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Sep 2018 15:41:22 +0200 Subject: [PATCH 09/11] Rename hidden conf into MAIN_USE_VAT_OF_PRODUCT_FOR_INDIVIDUAL_CUSTOMER_OUT_OF_EEC --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f9399b7ab55..1797617a26d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4745,7 +4745,8 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, } // Si (vendeur en France et acheteur hors Communaute europeenne et acheteur particulier) alors TVA par defaut=TVA du produit vendu. Fin de regle - if(!empty($conf->global->MAIN_USE_PRODUCT_TVA_WHEN_FRENCH_SELLER_AND_INDIVIDUAL_CUSTOMER) && $seller_country_code === 'FR' && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany()) { + if (! empty($conf->global->MAIN_USE_VAT_OF_PRODUCT_FOR_INDIVIDUAL_CUSTOMER_OUT_OF_EEC) && empty($buyer_in_cee) && !$thirdparty_buyer->isACompany()) + { return get_product_vat_for_country($idprod,$thirdparty_seller,$idprodfournprice); } From 39e9029e4119c50250acb6312597fd20fe87d68b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Sep 2018 15:44:44 +0200 Subject: [PATCH 10/11] Update contact.class.php --- htdocs/contact/class/contact.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 7c27d172af1..fa31d91c6c4 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1050,10 +1050,9 @@ class Contact extends CommonObject function getNbOfEMailings() { $sql = "SELECT count(mc.email) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."mailing as m on mc.fk_mailing=m.rowid"; - $sql.= " WHERE mc.email = '".$this->db->escape($this->email)."' "; - $sql.= " AND m.entity IN (".getEntity($this->element).") AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes + $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m"; + $sql.= " WHERE mc.fk_mailing=m.rowid AND mc.email = '".$this->db->escape($this->email)."' "; + $sql.= " AND m.entity IN (".getEntity($this->element).") AND mc.statut NOT IN (-1,0)"; // -1 error, 0 not sent, 1 sent with success $resql=$this->db->query($sql); if ($resql) From 12690666e2cbe0ccb4b961bd00e6120b348badf7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Sep 2018 10:03:08 +0200 Subject: [PATCH 11/11] Missing trans --- htdocs/langs/en_US/admin.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index f932ec05959..6f2a8a951b5 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1705,6 +1705,7 @@ BaseCurrency=Reference currency of the company (go into setup of company to chan WarningNoteModuleInvoiceForFrenchLaw=This module %s is compliant with french laws (Loi Finance 2016). WarningNoteModulePOSForFrenchLaw=This module %s is compliant with french laws (Loi Finance 2016) because module Non Reversible Logs is automatically activated. WarningInstallationMayBecomeNotCompliantWithLaw=You try to install the module %s that is an external module. Activating an external module means you trust the publisher of the module and you are sure that this module does not alterate negatively the behavior of your application and is compliant with laws of your country (%s). If the module bring a non legal feature, you become responsible for the use of a non legal software. +NothingToSetup=There is no specific setup to do for this module. ##### Resource #### ResourceSetup=Configuration du module Resource UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).