From c2f2f982357b95c7ff205f426cc7b41e2d28fdad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 15:25:10 +0200 Subject: [PATCH 01/11] css --- htdocs/compta/paymentbybanktransfer/index.php | 2 +- htdocs/compta/prelevement/index.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index b8675b3a7e5..70379b8285c 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -159,7 +159,7 @@ if ($resql) { print ''; print ''; - print price($obj->amount); + print ''.price($obj->amount).''; print ''; print ''; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 4aef7e8b9e4..63c8bbcf344 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -148,6 +148,7 @@ if ($resql) { $thirdpartystatic->id = $obj->socid; $thirdpartystatic->name = $obj->name; $thirdpartystatic->email = $obj->email; + $thirdpartystatic->tva_intra = $obj->tva_intra; print ''; print $invoicestatic->getNomUrl(1, 'withdraw'); @@ -158,7 +159,7 @@ if ($resql) { print ''; print ''; - print price($obj->amount); + print ''.price($obj->amount).''; print ''; print ''; From 2e91b0107af160b6bd629a11c015397067157362 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 15:35:49 +0200 Subject: [PATCH 02/11] Fix missing data in tooltip --- htdocs/compta/paymentbybanktransfer/index.php | 11 ++++++++++- htdocs/compta/prelevement/index.php | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 70379b8285c..1bdbaa33da8 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -102,7 +102,7 @@ print '
'; */ $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql .= " pfd.date_demande, pfd.amount,"; -$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra"; +$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (empty($user->rights->societe->client->voir) && !$socid) { @@ -149,6 +149,15 @@ if ($resql) { $thirdpartystatic->name = $obj->name; $thirdpartystatic->email = $obj->email; $thirdpartystatic->tva_intra = $obj->tva_intra; + $thirdpartystatic->siren = $obj->idprof1; + $thirdpartystatic->siret = $obj->idprof2; + $thirdpartystatic->ape = $obj->idprof3; + $thirdpartystatic->idprof1 = $obj->idprof1; + $thirdpartystatic->idprof2 = $obj->idprof2; + $thirdpartystatic->idprof3 = $obj->idprof3; + $thirdpartystatic->idprof4 = $obj->idprof4; + $thirdpartystatic->idprof5 = $obj->idprof5; + $thirdpartystatic->idprof6 = $obj->idprof6; print ''; print $invoicestatic->getNomUrl(1, 'withdraw'); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 63c8bbcf344..fc640eccc1c 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -102,7 +102,7 @@ print '
'; */ $sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; $sql .= " pfd.date_demande, pfd.amount,"; -$sql .= " s.nom as name, s.email, s.rowid as socid"; +$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (empty($user->rights->societe->client->voir) && !$socid) { @@ -149,6 +149,15 @@ if ($resql) { $thirdpartystatic->name = $obj->name; $thirdpartystatic->email = $obj->email; $thirdpartystatic->tva_intra = $obj->tva_intra; + $thirdpartystatic->siren = $obj->idprof1; + $thirdpartystatic->siret = $obj->idprof2; + $thirdpartystatic->ape = $obj->idprof3; + $thirdpartystatic->idprof1 = $obj->idprof1; + $thirdpartystatic->idprof2 = $obj->idprof2; + $thirdpartystatic->idprof3 = $obj->idprof3; + $thirdpartystatic->idprof4 = $obj->idprof4; + $thirdpartystatic->idprof5 = $obj->idprof5; + $thirdpartystatic->idprof6 = $obj->idprof6; print ''; print $invoicestatic->getNomUrl(1, 'withdraw'); From 0b8f4489c87f6ab24c19b5c086c46fd40540ddbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 15:55:43 +0200 Subject: [PATCH 03/11] css --- htdocs/societe/paymentmodes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 7405fcedb18..dedb1ad445d 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1469,7 +1469,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if (!empty($conf->prelevement->enabled)) { $colspan += 2; } - print ''.$langs->trans("NoBANRecord").''; + print ''.$langs->trans("NoBANRecord").''; } print ''; From 5a8d5618f2cbf6bb5397c6c59c678ea7c876cb20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 16:15:34 +0200 Subject: [PATCH 04/11] Fix error message on IBAN/BIC validation --- htdocs/compta/bank/class/account.class.php | 8 ++++++-- htdocs/compta/prelevement/create.php | 14 +++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index c2745b31426..5a484e9e97c 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1441,9 +1441,13 @@ class Account extends CommonObject // Call function to check BAN - if (!checkIbanForAccount($this) || !checkSwiftForAccount($this)) { + if (!checkIbanForAccount($this)) { $this->error_number = 12; - $this->error_message = 'IBANSWIFTControlError'; + $this->error_message = 'IBANNotValid'; + } + if (!checkSwiftForAccount($this)) { + $this->error_number = 12; + $this->error_message = 'SwiftNotValid'; } /*if (! checkBanForAccount($this)) { diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 3f00a4f0660..1049ce4cf1a 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -449,9 +449,17 @@ if ($resql) { // RIB print ''; - print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic; - if ($bac->verif() <= 0) { - print img_warning('Error on default bank number for IBAN : '.$bac->error_message); + if ($bac->id > 0) { + if (!empty($bac->iban) || !empty($bac->bic)) { + print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic; + if ($bac->verif() <= 0) { + print img_warning('Error on default bank number for IBAN : '.$langs->trans($bac->error_message)); + } + } else { + print img_warning($langs->trans("IBANNotDefined")); + } + } else { + print img_warning($langs->trans("NoBankAccountDefined")); } print ''; From 33b5605a728eb3120081918145300eb154a0b751 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 16:49:59 +0200 Subject: [PATCH 05/11] Code comment --- .../prelevement/class/bonprelevement.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index e5697ab3cb3..27c96bd47db 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -918,7 +918,7 @@ class BonPrelevement extends CommonObject if (!$error) { $ref = substr($year, -2).$month; - $sql = "SELECT substring(ref from char_length(ref) - 1)"; + $sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX" $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; $sql .= " WHERE ref LIKE '%".$this->db->escape($ref)."%'"; $sql .= " AND entity = ".((int) $conf->entity); @@ -929,8 +929,14 @@ class BonPrelevement extends CommonObject if ($resql) { $row = $this->db->fetch_row($resql); - $ref = "T".$ref.str_pad(dol_substr("00".intval($row[0]) + 1, 0, 2), 2, "0", STR_PAD_LEFT); + // Build the new ref + $ref = "T".$ref.str_pad(dol_substr("00".(intval($row[0]) + 1), 0, 2), 2, "0", STR_PAD_LEFT); + + // $conf->abc->dir_output may be: + // /home/ldestailleur/git/dolibarr_15.0/documents/abc/ + // or + // /home/ldestailleur/git/dolibarr_15.0/documents/X/abc with X >= 2 with multicompany. if ($type != 'bank-transfer') { $dir = $conf->prelevement->dir_output.'/receipts'; } else { @@ -947,7 +953,7 @@ class BonPrelevement extends CommonObject $sql .= "ref, entity, datec, type"; $sql .= ") VALUES ("; $sql .= "'".$this->db->escape($ref)."'"; - $sql .= ", ".$conf->entity; + $sql .= ", ".((int) $conf->entity); $sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'"; $sql .= ")"; From 8f93584f974c9d15b62def68694325251cabc352 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 16:56:23 +0200 Subject: [PATCH 06/11] Fix trans --- htdocs/compta/paymentbybanktransfer/index.php | 2 +- htdocs/langs/en_US/withdrawals.lang | 1 + htdocs/langs/fr_FR/withdrawals.lang | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 1bdbaa33da8..bf7e31611d2 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -90,7 +90,7 @@ print $bprev->nbOfInvoiceToPay('bank-transfer'); print ''; print ''; -print ''.$langs->trans("AmountToWithdraw").''; +print ''.$langs->trans("AmountToTransfer").''; print ''; print price($bprev->SommeAPrelever('bank-transfer'), '', '', 1, -1, -1, 'auto'); print '
'; diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index eb25d563f62..9d145ef354d 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -31,6 +31,7 @@ SupplierInvoiceWaitingWithdraw=Vendor invoice waiting for payment by credit tran InvoiceWaitingWithdraw=Invoice waiting for direct debit InvoiceWaitingPaymentByBankTransfer=Invoice waiting for credit transfer AmountToWithdraw=Amount to withdraw +AmountToTransfer=Amount to transfer NoInvoiceToWithdraw=No invoice open for '%s' is waiting. Go on tab '%s' on invoice card to make a request. NoSupplierInvoiceToWithdraw=No supplier invoice with open 'Direct credit requests' is waiting. Go on tab '%s' on invoice card to make a request. ResponsibleUser=User Responsible diff --git a/htdocs/langs/fr_FR/withdrawals.lang b/htdocs/langs/fr_FR/withdrawals.lang index fae9c7e2f78..03b60e71bca 100644 --- a/htdocs/langs/fr_FR/withdrawals.lang +++ b/htdocs/langs/fr_FR/withdrawals.lang @@ -31,6 +31,7 @@ SupplierInvoiceWaitingWithdraw=Facture fournisseur en attente de paiement par vi InvoiceWaitingWithdraw=Factures en attente de prélèvement InvoiceWaitingPaymentByBankTransfer=Facture en attente de virement AmountToWithdraw=Somme à prélever +AmountToTransfer=Somme à transferrer NoInvoiceToWithdraw=Aucune facture ouverte pour '%s' n'est en attente. Allez sur l'onglet '%s' sur la facture pour faire une demande. NoSupplierInvoiceToWithdraw=Aucune facture fournisseur avec des demandes de virement ouvertes n'est en attente. Allez sur l'onglet '%s' sur la fiche facture pour faire une demande. ResponsibleUser=Utilisateur responsable From 32875a1e6ca5cd20e171815e18c8b66a02ff05f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 17:06:49 +0200 Subject: [PATCH 07/11] Fix trans --- htdocs/compta/paymentbybanktransfer/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index bf7e31611d2..6c14987e5ba 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -66,7 +66,7 @@ if (prelevement_check_config('bank-transfer') < 0) { $newcardbutton = ''; if ($usercancreate) { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type=bank-transfer'); + $newcardbutton .= dolGetButtonTitle($langs->trans('NewPaymentByBankTransfer'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type=bank-transfer'); } print load_fiche_titre($langs->trans("SuppliersStandingOrdersArea"), $newcardbutton); From afdefad55b998f1b040b108715d2f445c6e02833 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Apr 2022 21:01:04 +0200 Subject: [PATCH 08/11] FIX bad link to add a customer price (token duplicated) --- htdocs/product/price.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 42066170f17..47322e2c692 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -1298,7 +1298,7 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''; + print ''; } else { print '
' . $langs->trans("AddCustomerPrice") . '
'; } From 291002fe1129a050bd1031198ba81a90a69992e4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 7 Apr 2022 10:31:54 +0200 Subject: [PATCH 09/11] fix: bad poermission int modulebuilder template --- htdocs/modulebuilder/template/myobject_document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index d1040364182..aa213461e24 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -132,7 +132,7 @@ if ($enablepermissioncheck) { $permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php } else { $permissiontoread = 1; - $permission = 1; + $permissiontoadd = 1; } // Security check (enable the most restrictive one) From ed9435321f764d21c6db6f635d7ae3256eb7a02f Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 6 Apr 2022 21:08:23 +0200 Subject: [PATCH 10/11] Update societe.class.php note_public => NotePublic note_private => NotePrivate see #20419 --- htdocs/societe/class/societe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e04c05ddaca..0f7ad23acb0 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -193,8 +193,8 @@ class Societe extends CommonObject 'tva_intra' =>array('type'=>'varchar(20)', 'label'=>'Tva intra', 'enabled'=>1, 'visible'=>-1, 'position'=>210), 'capital' =>array('type'=>'double(24,8)', 'label'=>'Capital', 'enabled'=>1, 'visible'=>-1, 'position'=>215), 'fk_stcomm' =>array('type'=>'integer', 'label'=>'CommercialStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230), 'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>'$conf->global->SOCIETE_USEPREFIX', 'visible'=>-1, 'position'=>235), 'client' =>array('type'=>'tinyint(4)', 'label'=>'Client', 'enabled'=>1, 'visible'=>-1, 'position'=>240), 'fournisseur' =>array('type'=>'tinyint(4)', 'label'=>'Fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>245), From 37fbe859df0d9d22a2d9afcce4ba52c326db98c0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 7 Apr 2022 16:32:03 +0200 Subject: [PATCH 11/11] FIX country not visible into list of states --- htdocs/core/class/html.formcompany.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index edc431819da..103db86998c 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -406,7 +406,7 @@ class FormCompany extends Form // Show break $key = $langs->trans("Country".strtoupper($obj->country_code)); $valuetoshow = ($key != "Country".strtoupper($obj->country_code)) ? $obj->country_code." - ".$key : $obj->country; - print '\n"; + print '\n"; $country = $obj->country; }