From 731978fda6a35393f11e304d94fcc21926302092 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sun, 28 Jun 2020 16:33:44 +0200 Subject: [PATCH 01/33] FIX html lost on html extrafield --- htdocs/core/class/extrafields.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index e1a834a42ca..ae5d41dba48 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2086,7 +2086,7 @@ class ExtraFields $value_key = ''; } } - elseif (in_array($key_type, array('price', 'double'))) + elseif (in_array($key_type, array('price', 'double', 'html'))) { $value_arr = GETPOST("options_".$key, 'alpha'); $value_key = price2num($value_arr); From 5d65b5f66025473cfca99bb6bd48f0c5f7fbfc71 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Mon, 29 Jun 2020 09:07:54 +0200 Subject: [PATCH 02/33] fix html should not do price2num --- htdocs/core/class/extrafields.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ae5d41dba48..caf43f94342 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -2086,11 +2086,15 @@ class ExtraFields $value_key = ''; } } - elseif (in_array($key_type, array('price', 'double', 'html'))) + elseif (in_array($key_type, array('price', 'double'))) { $value_arr = GETPOST("options_".$key, 'alpha'); $value_key = price2num($value_arr); } + elseif (in_array($key_type, array('html'))) + { + $value_key = GETPOST("options_".$key, 'alpha'); + } else { $value_key = GETPOST("options_".$key); From f34a3785f07c17e4b9f8ad5c06a6367cae841253 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 16:02:08 +0200 Subject: [PATCH 03/33] FIX CSS --- htdocs/theme/eldy/global.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 06feb97c2dd..ef6dd9a2b68 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -614,10 +614,10 @@ textarea.centpercent { padding-: 2px; } .paddingtop { - padding-bottom: 4px; + padding-top: 4px; } .paddingtop2 { - padding-bottom: 2px; + padding-top: 2px; } .paddingbottom { padding-bottom: 4px; From 9bb0ef04f54a240b7ebf0f98f0bc3a394cd63959 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Jun 2020 18:07:51 +0200 Subject: [PATCH 04/33] Fix upload of file in import module --- htdocs/core/lib/security.lib.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 3ee5739bc6d..72713393025 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -289,6 +289,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (!$user->rights->banque->modifier) { $createok = 0; $nbko++; } } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { $createok = 0; $nbko++; } + } elseif ($feature == 'import') { + if (!$user->rights->import->run) { $createok = 0; $nbko++; } } elseif ($feature == 'ecm') { if (!$user->rights->ecm->upload) { $createok = 0; $nbko++; } } From 6553c40bea8f467b58d79945e0b1b3bde74181d3 Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 30 Jun 2020 11:23:55 +0200 Subject: [PATCH 05/33] FIX : create a deposit with amount using comma didn't work --- htdocs/compta/facture/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ff7a1714757..a65d7f6ed81 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1255,7 +1255,8 @@ if (empty($reshook)) if ($_POST['type'] == Facture::TYPE_DEPOSIT) { $typeamount = GETPOST('typedeposit', 'alpha'); - $valuedeposit = GETPOST('valuedeposit', 'int'); + $valuedeposit = GETPOST('valuedeposit'); + $valuedeposit = price2num($valuedeposit, 'MU'); $amountdeposit = array(); if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) From 4f1ac84a199059a63e373ad7416ce6ebc37383d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jun 2020 12:07:24 +0200 Subject: [PATCH 06/33] Fix can't find link to edit table plan --- htdocs/langs/en_US/cashdesk.lang | 3 ++- htdocs/takepos/admin/bar.php | 23 ++++++++++++++++++++--- htdocs/takepos/admin/setup.php | 1 + htdocs/takepos/index.php | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 71a2a992e19..4494e10545d 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -111,4 +111,5 @@ AutoOrder=Order by the customer himself RestaurantMenu=Menu CustomerMenu=Customer menu ScanToMenu=Scan QR code to see the menu -ScanToOrder=Scan QR code to order \ No newline at end of file +ScanToOrder=Scan QR code to order +DefineTablePlan=Define table plan \ No newline at end of file diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 97f651efdb2..3d4bd490dde 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -66,12 +66,14 @@ if (GETPOST('action', 'alpha') == 'set') $form = new Form($db); $formproduct = new FormProduct($db); -llxHeader('', $langs->trans("CashDeskSetup")); +$arrayofcss = array("/takepos/css/colorbox.css"); + +llxHeader('', $langs->trans("CashDeskSetup"), '', '', 0, 0, $arrayofjs, $arrayofcss); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup'); $head = takepos_prepare_head(); -dol_fiche_head($head, 'bar', 'TakePOS', -1); +dol_fiche_head($head, 'bar', 'TakePOS', -1, 'cash-register'); print '
'; @@ -80,6 +82,20 @@ print '
'; print ''; print ''; +?> + + + + '.$langs->trans("DefineTablePlan").'
'; +print '

'; + print '
'; print ''; print ''; @@ -138,9 +154,9 @@ print ''; - print '
'; print ajax_constantonoff("TAKEPOS_QR_MENU", array(), $conf->entity, 0, 0, 1, 0); print '
'; + if ($conf->global->TAKEPOS_AUTO_ORDER) { print '
'; @@ -168,6 +184,7 @@ if ($conf->global->TAKEPOS_AUTO_ORDER) print ''; } + if ($conf->global->TAKEPOS_QR_MENU) { $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 03607409ea7..a6f8b4968cc 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -121,6 +121,7 @@ if ($action != '') { } } + /* * View */ diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index f4b83138416..63bbc5d1808 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -433,7 +433,7 @@ function CloseBill() { } function Floors() { - console.log("Open box to select floor"); + console.log("Open box to select floor place="+place); $.colorbox({href:"floors.php?place="+place, width:"90%", height:"90%", transition:"none", iframe:"true", title:"trans("Floors"); ?>"}); } From 5afd518718ab4a58308333c451fa42f2c94b5fe1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Jun 2020 13:06:44 +0200 Subject: [PATCH 07/33] Update vat rate for Congo --- htdocs/install/mysql/data/llx_c_tva.sql | 4 ++++ htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 2 ++ 2 files changed, 6 insertions(+) diff --git a/htdocs/install/mysql/data/llx_c_tva.sql b/htdocs/install/mysql/data/llx_c_tva.sql index 0888c68783c..afd3a762ccc 100644 --- a/htdocs/install/mysql/data/llx_c_tva.sql +++ b/htdocs/install/mysql/data/llx_c_tva.sql @@ -86,6 +86,10 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 9 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 93, 9, '3','0','VAT super reduced rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values ( 94, 9, '17','0','VAT standard rate',1); +-- CONGO = REPUBLIQUE DU CONGO (id country=72) +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); + -- CYPRUS (id country=78) insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (781, 78, '0','0','VAT Rate 0',1); insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (782, 78, '9','0','VAT Rate 9',1); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 2a7fc17e77e..1d543fad548 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -322,3 +322,5 @@ UPDATE llx_prelevement_facture_demande SET entity = 1 WHERE entity IS NULL; ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture (fk_facture); ALTER TABLE llx_prelevement_facture_demande ADD INDEX idx_prelevement_facture_demande_fk_facture_fourn (fk_facture_fourn); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (721, 72, '0','0','VAT Rate 0',1); +insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); From 918e669c98755e896326380e3cfc5a3e45dbf03d Mon Sep 17 00:00:00 2001 From: lvessiller Date: Tue, 30 Jun 2020 16:33:18 +0200 Subject: [PATCH 08/33] FIX change selected fields on company card --- htdocs/societe/card.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d277632c348..d2f27419e76 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -846,6 +846,11 @@ if (empty($reshook)) $id=$socid; $object->fetch($socid); + // Selection of new fields + if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD) && (empty($conf->global->SOCIETE_DISABLE_CONTACTS) || !empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))) { + include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php'; + } + // Actions to send emails $trigger_name='COMPANY_SENTBYMAIL'; $paramname='socid'; From 5f37f54675ff7637c88136a04672552f2d437820 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 13:16:06 +0200 Subject: [PATCH 09/33] Fix warning --- htdocs/master.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 4005e6a2ed5..0db06b121fd 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -49,7 +49,7 @@ $conf->db->host = $dolibarr_main_db_host; $conf->db->port = $dolibarr_main_db_port; $conf->db->name = $dolibarr_main_db_name; $conf->db->user = $dolibarr_main_db_user; -$conf->db->pass = $dolibarr_main_db_pass; +$conf->db->pass = empty($dolibarr_main_db_pass)?'':$dolibarr_main_db_pass; $conf->db->type = $dolibarr_main_db_type; $conf->db->prefix = $dolibarr_main_db_prefix; $conf->db->character_set = $dolibarr_main_db_character_set; From 5f2486049eefff6ab31501bb6e3b6bb2b14813f5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 13:22:15 +0200 Subject: [PATCH 10/33] Fix trans --- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/langs/en_US/banks.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index f6e5c2c83d6..0bfa4cfd2db 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1491,7 +1491,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Direct debit order if (!empty($conf->prelevement->enabled)) { - $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("StandingOrders"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw'); + $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw'); if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 7a36346733f..75f9549dca5 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -37,6 +37,7 @@ IbanValid=BAN valid IbanNotValid=BAN not valid StandingOrders=Direct debit orders StandingOrder=Direct debit order +PaymentByDirectDebit=Payment by direct debit PaymentByBankTransfers=Payments by credit transfer PaymentByBankTransfer=Payment by credit transfer AccountStatement=Account statement From e2a9743dd403e9274b82959b9cb375872ebe5e97 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 14:19:47 +0200 Subject: [PATCH 11/33] Debug module credit transfer --- htdocs/compta/facture/prelevement.php | 76 +++++++++++++------ htdocs/compta/paymentbybanktransfer/index.php | 11 +-- .../class/bonprelevement.class.php | 21 +++-- htdocs/compta/prelevement/create.php | 7 +- htdocs/compta/prelevement/index.php | 7 +- htdocs/core/lib/fourn.lib.php | 4 +- 6 files changed, 83 insertions(+), 43 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index dd9c1394563..b24723330a0 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -48,13 +48,12 @@ $ref = GETPOST('ref', 'alpha'); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'alpha'); $type = GETPOST('type', 'aZ09'); -$mode = GETPOST('mode', 'aZ09'); $fieldid = (!empty($ref) ? 'ref' : 'rowid'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid); -if ($mode == 'bank-transfer') { +if ($type == 'bank-transfer') { $object = new FactureFournisseur($db); } else { $object = new Facture($db); @@ -94,6 +93,7 @@ if (empty($reshook)) $sourcetype = 'facture'; if ($type == 'bank-transfer') { $sourcetype = 'supplier_invoice'; + $newtype = 'bank-transfer'; } $result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype); @@ -119,7 +119,7 @@ if (empty($reshook)) $result = $object->demande_prelevement_delete($user, GETPOST('did', 'int')); if ($result == 0) { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&mode='.$mode); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id.'&type='.$type); exit; } } @@ -135,7 +135,7 @@ $form = new Form($db); $now = dol_now(); -if ($mode == 'bank-transfer') { +if ($type == 'bank-transfer') { $title = $langs->trans('InvoiceSupplier')." - ".$langs->trans('CreditTransfer'); $helpurl = ""; } else { @@ -170,7 +170,7 @@ if ($object->id > 0) if ($object->paye) $resteapayer = 0; $resteapayeraffiche = $resteapayer; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { // Never use this $filterabsolutediscount = "fk_invoice_supplier_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice $filtercreditnote = "fk_invoice_supplier_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice @@ -204,7 +204,7 @@ if ($object->id > 0) $author->fetch($object->user_author); } - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $head = facturefourn_prepare_head($object); } else { $head = facture_prepare_head($object); @@ -213,7 +213,7 @@ if ($object->id > 0) dol_fiche_head($head, 'standingorders', $title, -1, 'bill'); // Invoice content - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $linkback = ''.$langs->trans("BackToList").''; } else { $linkback = ''.$langs->trans("BackToList").''; @@ -221,7 +221,7 @@ if ($object->id > 0) $morehtmlref = '
'; // Ref customer - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); } else { @@ -230,7 +230,7 @@ if ($object->id > 0) } // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } else { if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; @@ -290,7 +290,7 @@ if ($object->id > 0) } if ($object->type == $object::TYPE_REPLACEMENT) { - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $facreplaced = new FactureFournisseur($db); } else { $facreplaced = new Facture($db); @@ -300,7 +300,7 @@ if ($object->id > 0) } if ($object->type == $object::TYPE_CREDIT_NOTE) { - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $facusing = new FactureFournisseur($db); } else { $facusing = new Facture($db); @@ -318,7 +318,7 @@ if ($object->id > 0) { if ($i == 0) print ' '; else print ','; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $facavoir = new FactureFournisseur($db); } else { $facavoir = new Facture($db); @@ -341,7 +341,7 @@ if ($object->id > 0) // Discounts print ''.$langs->trans('Discounts').''; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { //$societe = new Fournisseur($db); //$result = $societe->fetch($object->socid); $thirdparty = $object->thirdparty; @@ -357,7 +357,7 @@ if ($object->id > 0) print ''; // Label - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { print ''; print ''.$form->editfieldkey("Label", 'label', $object->label, $object, 0).''; print ''.$form->editfieldval("Label", 'label', $object->label, $object, 0).''; @@ -427,7 +427,7 @@ if ($object->id > 0) if ($object->type != $object::TYPE_CREDIT_NOTE) { $duedate = $object->date_lim_reglement; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $duedate = $object->date_echeance; } @@ -488,7 +488,7 @@ if ($object->id > 0) print ''; $title = 'CustomerIBAN'; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $title = 'SupplierIBAN'; } print ''.$langs->trans($title).''; @@ -649,7 +649,7 @@ if ($object->id > 0) print "\n
\n"; $buttonlabel = $langs->trans("MakeWithdrawRequest"); - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { $buttonlabel = $langs->trans("MakeBankTransferOrder"); } @@ -665,6 +665,7 @@ if ($object->id > 0) print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -694,7 +695,7 @@ if ($object->id > 0) print "

\n"; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { print '
'.$langs->trans("DoCreditTransferBeforePayments").'

'; } else { print '
'.$langs->trans("DoStandingOrdersBeforePayments").'

'; @@ -711,7 +712,7 @@ if ($object->id > 0) print ''.$langs->trans("DateRequest").''; print ''.$langs->trans("User").''; print ''.$langs->trans("Amount").''; - if ($mode == 'bank-transfer') { + if ($type == 'bank-transfer') { print ''.$langs->trans("BankTransferReceipt").''; } else { print ''.$langs->trans("WithdrawalReceipt").''; @@ -723,7 +724,7 @@ if ($object->id > 0) $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande as date_demande,"; $sql .= " pfd.date_traite as date_traite, pfd.amount,"; - $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login"; + $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; @@ -743,14 +744,29 @@ if ($object->id > 0) { $i = 0; + $tmpuser = new User($db); + $num = $db->num_rows($result); while ($i < $num) { $obj = $db->fetch_object($result_sql); + $tmpuser->id = $obj->user_id; + $tmpuser->login = $obj->login; + $tmpuser->ref = $obj->login; + $tmpuser->email = $obj->email; + $tmpuser->lastname = $obj->lastname; + $tmpuser->firstname = $obj->firstname; + $tmpuser->statut = $obj->user_status; + print ''; + print ''.dol_print_date($db->jdate($obj->date_demande), 'dayhour')."\n"; - print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.''; + + print ''; + print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login'); + print ''; + print ''.price($obj->amount).''; print '-'; print ' '; @@ -758,7 +774,7 @@ if ($object->id > 0) print ''.$langs->trans("OrderWaiting").''; print ''; - print ''; + print ''; print img_delete(); print ''; @@ -778,7 +794,7 @@ if ($object->id > 0) $sql = "SELECT pfd.rowid, pfd.traite, pfd.date_demande, pfd.date_traite, pfd.fk_prelevement_bons, pfd.amount,"; $sql .= " pb.ref,"; - $sql .= " u.rowid as user_id, u.lastname, u.firstname, u.login"; + $sql .= " u.rowid as user_id, u.email, u.lastname, u.firstname, u.login, u.statut as user_status"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on pfd.fk_user_demande = u.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_bons as pb ON pb.rowid = pfd.fk_prelevement_bons"; @@ -798,15 +814,27 @@ if ($object->id > 0) $numclosed = $num; $i = 0; + $tmpuser = new User($db); + while ($i < $num) { $obj = $db->fetch_object($result); + $tmpuser->id = $obj->user_id; + $tmpuser->login = $obj->login; + $tmpuser->ref = $obj->login; + $tmpuser->email = $obj->email; + $tmpuser->lastname = $obj->lastname; + $tmpuser->firstname = $obj->firstname; + $tmpuser->statut = $obj->user_status; + print ''; print ''.dol_print_date($db->jdate($obj->date_demande), 'day')."\n"; - print ''.img_object($langs->trans("ShowUser"), 'user').' '.$obj->login.''; + print ''; + print $tmpuser->getNomUrl(1, '', 0, 0, 0, 0, 'login'); + print ''; print ''.price($obj->amount).''; diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 6172b3f1284..792507c56fd 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -94,11 +94,11 @@ 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.rowid as socid"; -$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; +$sql .= " s.nom as name, s.email, s.rowid as socid"; +$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; -$sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; +$sql .= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE s.rowid = f.fk_soc"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; $sql .= " AND f.total_ttc > 0"; @@ -133,14 +133,15 @@ if ($resql) $invoicestatic->type = $obj->type; $alreadypayed = $invoicestatic->getSommePaiement(); + $thirdpartystatic->id = $obj->socid; + $thirdpartystatic->name = $obj->name; + $thirdpartystatic->email = $obj->email; print ''; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''; print ''; - $thirdpartystatic->id = $obj->socid; - $thirdpartystatic->name = $obj->name; print $thirdpartystatic->getNomUrl(1, 'customer'); print ''; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 1a13eb2edb9..193d352ae35 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -703,9 +703,16 @@ class BonPrelevement extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,"; } $sql .= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - $sql .= " WHERE f.fk_statut = 1"; - $sql .= " AND f.entity IN (".getEntity('invoice').")"; - $sql .= " AND f.rowid = pfd.fk_facture"; + $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; + if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) + { + $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; + } + if ($mode != 'bank-transfer') { + $sql .= " AND f.rowid = pfd.fk_facture"; + } else { + $sql .= " AND f.rowid = pfd.fk_facture_fourn"; + } $sql .= " AND f.paye = 0"; $sql .= " AND pfd.traite = 0"; $sql .= " AND f.total_ttc > 0"; @@ -744,16 +751,16 @@ class BonPrelevement extends CommonObject /** * Get number of invoices to withdrawal * - * @param string $mode 'direct-debit' or 'bank-transfer' + * @param string $type 'direct-debit' or 'bank-transfer' * @return int '; print ''; - print ''.$langs->trans("Invoice").''; + print ''.$langs->trans($tradinvoice).''; print ''.$langs->trans("ThirdParty").''; print ''.$langs->trans("RIB").''; print ''.$langs->trans("RUM").''; diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index eaec6d92f16..72c318a1024 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -94,7 +94,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.rowid as socid"; +$sql .= " s.nom as name, s.email, s.rowid as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; $sql .= " ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -133,14 +133,15 @@ if ($resql) $invoicestatic->type = $obj->type; $alreadypayed = $invoicestatic->getSommePaiement(); + $thirdpartystatic->id = $obj->socid; + $thirdpartystatic->name = $obj->name; + $thirdpartystatic->email = $obj->email; print ''; print $invoicestatic->getNomUrl(1, 'withdraw'); print ''; print ''; - $thirdpartystatic->id = $obj->socid; - $thirdpartystatic->name = $obj->name; print $thirdpartystatic->getNomUrl(1, 'customer'); print ''; diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index 8d0e767c943..201d74a9ff9 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -68,7 +68,7 @@ function facturefourn_prepare_head($object) if ($obj) $nbStandingOrders = $obj->nb; } else dol_print_error($db); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&mode=bank-transfer'; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'&type=bank-transfer'; $head[$h][1] = $langs->trans('BankTransfer'); if ($nbStandingOrders > 0) $head[$h][1] .= ''.$nbStandingOrders.''; $head[$h][2] = 'standingorders'; @@ -233,8 +233,6 @@ function supplierorder_admin_prepare_head() $head[$h][2] = 'supplierorderdet'; $h++; - - $head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoices"); $head[$h][2] = 'supplierinvoice'; From 5e259d26ab3cbe4b0eebfa010107f695dc93d466 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 1 Jul 2020 15:20:42 +0200 Subject: [PATCH 12/33] FIX takepos hook can add more than 1 button within 1 module --- htdocs/takepos/index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 63bbc5d1808..51358e24080 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -932,8 +932,14 @@ if ($resql) $hookmanager->initHooks(array('takeposfrontend')); $reshook = $hookmanager->executeHooks('ActionButtons'); if (!empty($reshook)) { +if (is_array($reshook) && !isset($reshook['title'])) { + foreach ($reshook as $reshook) { +$menus[$r++] = $reshook; + } +} else { $menus[$r++] = $reshook; } +} if ($r % 3 == 2) $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;'); From 92f4744d11c49d2ec6a5dede2c75920a54f9a0fa Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 1 Jul 2020 13:22:43 +0000 Subject: [PATCH 13/33] Fixing style errors. --- htdocs/takepos/index.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 51358e24080..af9c3062ba3 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -932,13 +932,13 @@ if ($resql) $hookmanager->initHooks(array('takeposfrontend')); $reshook = $hookmanager->executeHooks('ActionButtons'); if (!empty($reshook)) { -if (is_array($reshook) && !isset($reshook['title'])) { - foreach ($reshook as $reshook) { -$menus[$r++] = $reshook; - } -} else { - $menus[$r++] = $reshook; -} + if (is_array($reshook) && !isset($reshook['title'])) { + foreach ($reshook as $reshook) { + $menus[$r++] = $reshook; + } + } else { + $menus[$r++] = $reshook; + } } if ($r % 3 == 2) $menus[$r++] = array('title'=>'', 'style'=>'visibility: hidden;'); From cc132775f3a896a63e0746bf3a4c966b79a048aa Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 1 Jul 2020 16:18:19 +0200 Subject: [PATCH 14/33] FIX non numeric value on comm/car.php --- htdocs/comm/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 4a97dc0f98c..9b385ea7ead 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -943,7 +943,7 @@ if ($object->id > 0) $late = ''; foreach ($contrat->lines as $line) { if ($contrat->statut == Contrat::STATUS_VALIDATED && $line->statut == ContratLigne::STATUS_OPEN) { - if (($line->date_fin_validite + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late")); + if (((!empty($line->date_fin_validite)?$line->date_fin_validite:0) + $conf->contrat->services->expires->warning_delay) < $now) $late = img_warning($langs->trans("Late")); } } From 92a36dbeee93b6387bd32394b83e10e08f22e5df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 15/33] FIX Use of office365 TLS with SMTPs method. --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 51e375c5279..09a1f7f2949 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -428,7 +428,7 @@ class SMTPs $host = preg_replace('@ssl://@i', '', $host); // Remove prefix $host = preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host = 'tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -565,6 +565,8 @@ class SMTPs $host = preg_replace('@ssl://@i', '', $host); // Remove prefix $host = preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (!empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From 324c8e9b54930f2a0fc95e0cc8659a59f5fe2620 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 16/33] FIX Use of office365 TLS with SMTPs method. Conflicts: htdocs/core/class/smtps.class.php --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index df7647b330c..9c071a36f23 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -428,7 +428,7 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host='tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -568,6 +568,8 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From d3c23428d5cf773172ebeb573c234c1f10a12cc1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 17:00:52 +0200 Subject: [PATCH 17/33] FIX Use of office365 TLS with SMTPs method. Conflicts: htdocs/core/class/smtps.class.php --- htdocs/core/class/smtps.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f978fd47fba..bce175b3872 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -428,7 +428,7 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix - if ($usetls) $host='tls://'.$host; + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; $hosth = $host; @@ -555,6 +555,8 @@ class SMTPs $host=preg_replace('@ssl://@i', '', $host); // Remove prefix $host=preg_replace('@tls://@i', '', $host); // Remove prefix + if ($usetls && ! empty($conf->global->MAIN_SMTPS_ADD_TLS_TO_HOST_FOR_HELO)) $host = 'tls://'.$host; + $hosth = $host; if (! empty($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO)) From ae0c73898098ab949fb1a9eb80358fcfb941f07c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 1 Jul 2020 19:42:28 +0200 Subject: [PATCH 18/33] FIX Entry from stripe intent were reported into SEPA payments FIX Label of popup on thirdparty FIX Missing the tooltip when creating bank account --- htdocs/compta/paymentbybanktransfer/index.php | 9 +- .../class/bonprelevement.class.php | 156 +++++++++++------- htdocs/compta/prelevement/create.php | 20 ++- htdocs/compta/prelevement/index.php | 14 +- htdocs/societe/class/societe.class.php | 20 +-- htdocs/societe/paymentmodes.php | 17 +- 6 files changed, 155 insertions(+), 81 deletions(-) diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index 792507c56fd..1fc6c53cf99 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".FactureFournisseur::STATUS_VALIDATED; } -$sql .= " AND pfd.traite = 0 AND pfd.fk_facture_fourn = f.rowid"; +$sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; +$sql .= " AND pfd.fk_facture_fourn = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql .= " AND f.fk_soc = ".$socid; @@ -195,7 +197,8 @@ if ($result) print"\n\n"; print '
'; print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -222,7 +225,7 @@ if ($result) $i++; } } else { - print ''; + print ''; } print "
'.$langs->trans("LatestBankTransferReceipts", $limit).'
'.$langs->trans("LatestBankTransferReceipts", $limit).''.$langs->trans("Date").''.$langs->trans("Amount").''.$langs->trans("Status").'
'.$langs->trans("None").'
'.$langs->trans("None").'

"; diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 193d352ae35..5db9ccde671 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; @@ -118,7 +119,7 @@ class BonPrelevement extends CommonObject /** * Add invoice to withdrawal * - * @param int $facture_id id invoice to add + * @param int $invoice_id id invoice to add * @param int $client_id id invoice customer * @param string $client_nom customer name * @param int $amount amount of invoice @@ -126,14 +127,16 @@ class BonPrelevement extends CommonObject * @param string $code_guichet code of bank's office * @param string $number bank account number * @param string $number_key number key of account number + * @param string $type 'debit-order' or 'bank-transfer' * @return int >0 if OK, <0 if KO */ - public function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) + public function AddFacture($invoice_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $type = 'debit-order') { // phpcs:enable $result = 0; $line_id = 0; + // Add lines $result = $this->addline($line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key); if ($result == 0) @@ -141,10 +144,14 @@ class BonPrelevement extends CommonObject if ($line_id > 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_facture ("; - $sql .= "fk_facture"; + if ($type != 'bank-transfer') { + $sql .= "fk_facture"; + } else { + $sql .= "fk_facture_fourn"; + } $sql .= ",fk_prelevement_lignes"; $sql .= ") VALUES ("; - $sql .= $facture_id; + $sql .= $invoice_id; $sql .= ", ".$line_id; $sql .= ")"; @@ -155,19 +162,19 @@ class BonPrelevement extends CommonObject else { $result = -1; - dol_syslog(get_class($this)."::AddFacture Erreur $result"); + dol_syslog(get_class($this)."::AddFacture Error $result"); } } else { $result = -2; - dol_syslog(get_class($this)."::AddFacture Erreur $result"); + dol_syslog(get_class($this)."::AddFacture Error $result"); } } else { $result = -3; - dol_syslog(get_class($this)."::AddFacture Erreur $result"); + dol_syslog(get_class($this)."::AddFacture Error $result"); } return $result; @@ -686,7 +693,7 @@ class BonPrelevement extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Returns amount of withdrawal + * Returns amount waiting for direct debit payment or credit transfer payment * * @param string $mode 'direct-debit' or 'bank-transfer' * @return double db->query($sql); @@ -749,7 +757,7 @@ class BonPrelevement extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Get number of invoices to withdrawal + * Get number of invoices to pay * * @param string $type 'direct-debit' or 'bank-transfer' * @return int global->PRELEVEMENT_CODE_BANQUE."'"; //if ($agence) $sql.= " AND sr.code_guichet = '".$conf->global->PRELEVEMENT_CODE_GUICHET."'"; @@ -874,6 +893,12 @@ class BonPrelevement extends CommonObject { $row = $this->db->fetch_row($resql); $factures[$i] = $row; // All fields + if ($row[7] == 0) { + $error++; + dol_syslog(__METHOD__."::Read invoices error Found a null invoice", LOG_ERR); + $this->invoice_in_error[$row[0]] = "Error for invoice id ".$row[0].", found a null amount"; + break; + } $i++; } $this->db->free($resql); @@ -891,15 +916,19 @@ class BonPrelevement extends CommonObject require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; $soc = new Societe($this->db); - // Check RIB + // Check BAN $i = 0; - dol_syslog(__METHOD__."::Check RIB", LOG_DEBUG); + dol_syslog(__METHOD__."::Check BAN", LOG_DEBUG); if (count($factures) > 0) { foreach ($factures as $key => $fac) { - $fact = new Facture($this->db); + if ($type != 'bank-transfer') { + $fact = new Facture($this->db); + } else { + $fact = new FactureFournisseur($this->db); + } $resfetch = $fact->fetch($fac[0]); if ($resfetch >= 0) // Field 0 of $fac is rowid of invoice { @@ -908,13 +937,15 @@ class BonPrelevement extends CommonObject $bac = new CompanyBankAccount($this->db); $bac->fetch(0, $soc->id); - if ($format == 'FRST' && $bac->frstrecur != 'FRST') - { - continue; - } - if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) - { - continue; + if ($type != 'bank-transfer') { + if ($format == 'FRST' && $bac->frstrecur != 'FRST') + { + continue; + } + if ($format == 'RCUR' && ($bac->frstrecur != 'RCUR' && $bac->frstrecur != 'RECUR')) + { + continue; + } } if ($bac->verif() >= 1) @@ -927,32 +958,32 @@ class BonPrelevement extends CommonObject } else { - dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); } } else { - dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN Failed to read company", LOG_WARNING); } } else { - dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN Failed to read invoice", LOG_WARNING); } } } else { - dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING); + dol_syslog(__METHOD__."::Check BAN No invoice to process", LOG_WARNING); } } $ok = 0; // Withdraw invoices in factures_prev array - $out = count($factures_prev)." invoices will be withdrawn."; + $out = count($factures_prev)." invoices will be included."; //print $out."\n"; dol_syslog($out); @@ -982,14 +1013,14 @@ class BonPrelevement extends CommonObject { /* * We are in real mode. - * We create withdraw receipt and build withdraw into disk + * We create order and build file into disk */ $this->db->begin(); $now = dol_now(); /* - * Traitements + * Process order generation */ if (!$error) { @@ -1001,7 +1032,7 @@ class BonPrelevement extends CommonObject $sql .= " AND entity = ".$conf->entity; $sql .= " ORDER BY ref DESC LIMIT 1"; - dol_syslog(get_class($this)."::Create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) @@ -1009,18 +1040,23 @@ class BonPrelevement extends CommonObject $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); - $dir = $conf->prelevement->dir_output.'/receipts'; + if ($type != 'bank-transfer') { + $dir = $conf->prelevement->dir_output.'/receipts'; + } else { + $dir = $conf->paymentbybanktransfer->dir_output.'/receipts'; + } if (!is_dir($dir)) dol_mkdir($dir); $this->filename = $dir.'/'.$ref.'.xml'; // Create withdraw receipt in database $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons ("; - $sql .= " ref, entity, datec"; + $sql .= " ref, entity, datec, type"; $sql .= ") VALUES ("; $sql .= "'".$this->db->escape($ref)."'"; $sql .= ", ".$conf->entity; $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'"; $sql .= ")"; $resql = $this->db->query($sql); @@ -1058,7 +1094,9 @@ class BonPrelevement extends CommonObject /* * Add standing order * - * + * $fac[0] : invoice_id + * $fac[1] : ??? + * $fac[2] : third party id * $fac[3] : banque * $fac[4] : guichet * $fac[5] : number @@ -1067,7 +1105,8 @@ class BonPrelevement extends CommonObject * $fac[8] : client nom * $fac[2] : client id */ - $ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6]); + + $ri = $this->AddFacture($fac[0], $fac[2], $fac[8], $fac[7], $fac[3], $fac[4], $fac[5], $fac[6], $type); if ($ri <> 0) { $error++; @@ -1080,13 +1119,12 @@ class BonPrelevement extends CommonObject $sql .= ", fk_prelevement_bons = ".$this->id; $sql .= " WHERE rowid = ".$fac[1]; - dol_syslog(__METHOD__."::Update Orders::Sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { $error++; - dol_syslog(__METHOD__."::Update Orders::Error=".$this->db->error(), LOG_ERR); + dol_syslog(__METHOD__."::Update Error=".$this->db->error(), LOG_ERR); } } } @@ -1095,11 +1133,10 @@ class BonPrelevement extends CommonObject if (!$error) { /* - * Create direct debit order in a XML file + * Create file of direct debit order or credit transfer into a XML file */ - dol_syslog(__METHOD__."::Init withdraw receipt for ".count($factures_prev)." invoices", LOG_DEBUG); - + dol_syslog(__METHOD__."::Init direct debit file for ".count($factures_prev)." invoices", LOG_DEBUG); if (count($factures_prev) > 0) { @@ -1126,7 +1163,7 @@ class BonPrelevement extends CommonObject $this->context['factures_prev'] = $factures_prev; // Generation of SEPA file $this->filename - $this->generate($format, $executiondate); + $result = $this->generate($format, $executiondate); } dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG); } @@ -1149,8 +1186,13 @@ class BonPrelevement extends CommonObject if (!$error && !$notrigger) { + $triggername = 'DIRECT_DEBIT_ORDER_CREATE'; + if ($type != 'bank-transfer') { + $triggername = 'CREDIT_TRANSFER_ORDER_CREATE'; + } + // Call trigger - $result = $this->call_trigger('DIRECT_DEBIT_ORDER_CREATE', $user); + $result = $this->call_trigger($triggername, $user); if ($result < 0) $error++; // End call triggers } @@ -1419,9 +1461,9 @@ class BonPrelevement extends CommonObject * - Others countries: Warning message * File is generated with name this->filename * - * @param string $format FRST, RCUR or ALL - * @param string $executiondate Date to execute transfer - * @return int 0 if OK, <0 if KO + * @param string $format FRST, RCUR or ALL + * @param string $executiondate Date to execute transfer + * @return int >=0 if OK, <0 if KO */ public function generate($format = 'ALL', $executiondate = '') { @@ -1468,7 +1510,7 @@ class BonPrelevement extends CommonObject $this->total = 0; /* - * section Debiteur (sepa Debiteurs bloc lines) + * Section Debitor (sepa Debiteurs bloc lines) */ $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; @@ -1593,13 +1635,15 @@ class BonPrelevement extends CommonObject $langs->load('withdrawals'); // TODO Add here code to generate a generic file - fputs($this->file, $langs->trans('WithdrawalFileNotCapable', $mysoc->country_code)); + fputs($this->file, $langs->transnoentitiesnoconv('WithdrawalFileNotCapable', $mysoc->country_code)); } fclose($this->file); - if (!empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) { @chmod($this->file, octdec($conf->global->MAIN_UMASK)); - return $result; + } + + return $result; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index f05e4f422d4..a6bc41734d4 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -5,7 +5,7 @@ * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Frédéric France - * Copyright (C) 2019 Markus Welters + * Copyright (C) 2019 Markus Welters * * 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 @@ -24,7 +24,7 @@ /** * \file htdocs/compta/prelevement/create.php * \ingroup prelevement - * \brief Prelevement creation page + * \brief Page to create a direct debit order or a credit transfer order */ require '../../main.inc.php'; @@ -77,11 +77,17 @@ if (empty($reshook)) } if ($action == 'create') { - // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty + $delayindays = 0; + if ($type != 'bank-transfer') { + $conf->global->PRELEVEMENT_ADDDAYS; + } else { + $conf->global->PAYMENTBYBANKTRANSFER_ADDDAYS; + } $bprev = new BonPrelevement($db); - $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday') + $conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear')); + $executiondate = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), (GETPOST('reday', 'int') + $delayindays), GETPOST('reyear', 'int')); - $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate); + // $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty (we don't use them anymore) + $result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate, 0, $type); if ($result < 0) { setEventMessages($bprev->error, $bprev->errors, 'errors'); @@ -257,8 +263,10 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } -$sql .= " AND f.total_ttc > 0"; +//$sql .= " AND pfd.amount > 0"; +$sql .= " AND f.total_ttc > 0"; // Avoid credit notes $sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; if ($type == 'bank-transfer') { $sql .= " AND pfd.fk_facture_fourn = f.rowid"; } else { diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 72c318a1024..ef451146f55 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -22,7 +22,7 @@ /** * \file htdocs/compta/prelevement/index.php * \ingroup prelevement - * \brief Prelevement index page + * \brief Home page for direct debit orders */ @@ -106,7 +106,9 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) { $sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; } -$sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; +$sql .= " AND pfd.traite = 0"; +$sql .= " AND pfd.ext_payment_id IS NULL"; +$sql .= " AND pfd.fk_facture = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; if ($socid) $sql .= " AND f.fk_soc = ".$socid; @@ -176,8 +178,9 @@ print '
'; /* - * Withdraw receipts + * Direct debit orders */ + $limit = 5; $sql = "SELECT p.rowid, p.ref, p.amount, p.datec, p.statut"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; @@ -194,7 +197,8 @@ if ($result) print"\n\n"; print '
'; print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -222,7 +226,7 @@ if ($result) $i++; } } else { - print ''; + print ''; } print "
'.$langs->trans("LastWithdrawalReceipt", $limit).'
'.$langs->trans("LastWithdrawalReceipt", $limit).''.$langs->trans("Date").''.$langs->trans("Amount").''.$langs->trans("Status").'
'.$langs->trans("None").'
'.$langs->trans("None").'

"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e80d433e7e0..730e66eaab8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2388,44 +2388,44 @@ class Societe extends CommonObject $label .= '
'; - if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier') + if ($option == 'customer' || $option == 'compta' || $option == 'category') { - $label .= ''.$langs->trans("ShowCustomer").''; + $label .= ''.$langs->trans("Customer").''; $linkstart = ''; + $label .= ''.$langs->trans("Prospect").''; $linkstart = ''; + $label .= ''.$langs->trans("Supplier").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = ''; + $label .= ''.$langs->trans("ThirdParty").''; $linkstart = 'LT12 1000 0111 0100 1000
FR14 2004 1010 0505 0001 3M02 606
LU28 0019 4006 4475 0000
DE89 3704 0044 0532 0130 00'; } elseif ($val == 'BIC') { $name = 'bic'; $size = 12; + $content = $companybankaccount->bic; if ($companybankaccount->needIBAN()) $require = true; + $tooltip = $langs->trans("Example").': LIABLT2XXXX'; } - print ''.$langs->trans($val).''; + print ''; + if ($tooltip) { + print $form->textwithpicto($langs->trans($val), $tooltip, 4, 'help', '', 0, 3, $name); + } else { + print $langs->trans($val); + } + print ''; print ''; print ''; } From d6ded950ac9d0f6eca6ef3996d57c2524f5a392b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 00:07:18 +0200 Subject: [PATCH 19/33] Update doc --- ChangeLog | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a39c27e119f..edb66756ff2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -104,8 +104,8 @@ NEW: class tool for converting units NEW: Close #13011 Add button create thirdparty when creating intervention NEW: Colorful theme for TakePOS NEW: columns units in product list -NEW: compatibility of translabel with more dict -NEW: Confirm file delete on fracture card +NEW: compatibility of translabel with more dictionaries +NEW: Confirm file delete on invoice card NEW: "contact_civility" for ODT templates NEW: CUPS printing compatibility for TakePOS NEW: Customer command list - Add date start & date end @@ -113,16 +113,11 @@ NEW: display weight in shipment list NEW: Documentation about PHP support in Dolibarr NEW: Donation - Update FR CERFA to 11580*04 NEW: Easier way to setup the different types of tax. Better visibility. -NEW: enable put for agendaevents api NEW: Expedition list - Add date start & date end NEW: Experiment supplier packaging with option PRODUCT_USE_SUPPLIER_PACKAGING: Using price according to the minimum quantity NEW: Export module, add extrafields for Contract and Contract line NEW: Extend retained warranty to be available for all invoices -NEW: filter by product on supplier order API NEW: French new regions -NEW: get documents for categories with RESP API -NEW: get proposal by ref with API -NEW: Hidden option MAIN_TEMP_DIR NEW: hook and data id NEW: hook on ics generation to add more events in eventarray NEW: hook on product load stats @@ -209,6 +204,11 @@ NEW: Bookkeeping by account - Add selectfields & hook NEW: Can force position of legend of graph on right (instead of top) NEW: Can change destination of "Back to list" using a "backtolist" parameter NEW: add more category types from hook +NEW: enable put for agendaevents api +NEW: filter by product on supplier order API +NEW: get documents for categories with RESP API +NEW: get proposal by ref with API +NEW: Hidden option MAIN_TEMP_DIR WARNING: From d76ca6f569588de73f7156040b8838921e5d82ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 00:09:52 +0200 Subject: [PATCH 20/33] Update doc --- ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index edb66756ff2..19c77c702fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -190,7 +190,6 @@ NEW: API filter bankaccounts by category NEW: API filter contacts by category NEW: API filter members by category NEW: API filter projects by category -NEW: API filter thirdpartie by category NEW: API filter thirdparty by category NEW: API filter user by category NEW: API filter warehouses by categorie From a5431a40daf64c1e7025ba3e838cee2cea2fb7a0 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 2 Jul 2020 10:16:20 +0200 Subject: [PATCH 21/33] FIX missing possibility to change entity when propal cloning --- htdocs/comm/propal/card.php | 15 +++++++-------- htdocs/comm/propal/class/propal.class.php | 4 +++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 28fdc7845d2..996ad2e31af 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -194,7 +194,7 @@ if (empty($reshook)) } } - $result = $object->createFromClone($user, $socid); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null)); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); @@ -1832,10 +1832,9 @@ if ($action == 'create') print ''; print ''.$langs->trans("CreateEmptyPropal").''; + print ''; } - if (!empty($conf->global->PROPAL_CLONE_ON_CREATE_PAGE)) print ''; - dol_fiche_end(); $langs->load("bills"); @@ -1878,11 +1877,11 @@ if ($action == 'create') if ($action == 'clone') { // Create an array for form $formquestion = array( - // 'text' => $langs->trans("ConfirmClone"), - // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => - // 1), - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); + // 'text' => $langs->trans("ConfirmClone"), + // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), + // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) + ); if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0101805cd88..3fd122c0103 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1324,9 +1324,10 @@ class Propal extends CommonObject * * @param User $user User making the clone * @param int $socid Id of thirdparty + * @param int $forceentity Entity id to force * @return int New id of clone */ - public function createFromClone(User $user, $socid = 0) + public function createFromClone(User $user, $socid = 0, $forceentity = null) { global $conf, $hookmanager; @@ -1382,6 +1383,7 @@ class Propal extends CommonObject $object->id = 0; $object->ref = ''; + $object->entity = (! empty($forceentity) ? $forceentity : $object->entity); $object->statut = self::STATUS_DRAFT; // Clear fields From 642e75c3dd29b03d7eaf71f21678f05d2f5521d1 Mon Sep 17 00:00:00 2001 From: quentin Date: Thu, 2 Jul 2020 11:34:59 +0200 Subject: [PATCH 22/33] FIX wrong origin --- htdocs/commande/class/commande.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 54506a4a816..c92de067c8e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1014,7 +1014,7 @@ class Commande extends CommonOrder // Complete vat rate with code $vatrate = $line->tva_tx; if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')'; - + $origin = !empty($line->origin) ? $line->origin : $this->element; $result = $this->addline( $line->desc, $line->subprice, @@ -1039,7 +1039,7 @@ class Commande extends CommonOrder $line->label, $line->array_options, $line->fk_unit, - $this->element, + $origin, $line->id ); if ($result < 0) From 16b327f1066ab297ef065f4ed959433c671a2fb4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Jul 2020 15:45:11 +0200 Subject: [PATCH 23/33] Debug module credit transfer --- htdocs/compta/prelevement/create.php | 20 ++++++++++++++++---- htdocs/langs/en_US/withdrawals.lang | 4 ++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index a6bc41734d4..80055b20d72 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2015 Laurent Destailleur + * Copyright (C) 2010-2020 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2012 Juanjo Menent * Copyright (C) 2018 Nicolas ZABOURI @@ -120,7 +120,11 @@ if (empty($reshook)) $form = new Form($db); $thirdpartystatic = new Societe($db); -$invoicestatic = new Facture($db); +if ($type != 'bank-transfer') { + $invoicestatic = new Facture($db); +} else { + $invoicestatic = new FactureFournisseur($db); +} $bprev = new BonPrelevement($db); llxHeader('', $langs->trans("NewStandingOrder")); @@ -183,6 +187,7 @@ print '
'."\n"; print ''; print ''; +print ''; if ($nb) { if ($pricetowithdraw) { print $langs->trans('ExecutionDate').' '; @@ -190,8 +195,13 @@ if ($nb) { if ($mysoc->isInEEC()) { $title = $langs->trans("CreateForSepa"); + if ($type == 'bank-transfer') { + $title = $langs->trans("CreateSepaFileForPaymentByBankTransfer"); + } - print ''; + if ($type != 'bank-transfer') { + print ''; + } print ''; } else { $title = $langs->trans("CreateAll"); @@ -363,7 +373,9 @@ if ($resql) print ''; print $thirdpartystatic->display_rib('rum'); $format = $thirdpartystatic->display_rib('format'); - if ($format) print ' ('.$format.')'; + if ($type != 'bank-transfer') { + if ($format) print ' ('.$format.')'; + } print ''; // Amount print ''; diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 1f9c91719da..df8aada28dc 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -10,8 +10,8 @@ PaymentByBankTransferReceipts=Credit transfer orders PaymentByBankTransferLines=Credit transfer order lines WithdrawalsReceipts=Direct debit orders WithdrawalReceipt=Direct debit order -BankTransferReceipts=Credit transfer receipts -BankTransferReceipt=Credit transfer receipt +BankTransferReceipts=Credit transfer order +BankTransferReceipt=Credit transfer order LatestBankTransferReceipts=Latest %s credit transfer orders LastWithdrawalReceipts=Latest %s direct debit files WithdrawalsLine=Direct debit order line From 6c01cc16f8fc46667d55c5b5a7af619f48caa0a0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jul 2020 00:14:22 +0200 Subject: [PATCH 24/33] Update commande.class.php --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c92de067c8e..e356a4d5936 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1014,7 +1014,7 @@ class Commande extends CommonOrder // Complete vat rate with code $vatrate = $line->tva_tx; if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')'; - $origin = !empty($line->origin) ? $line->origin : $this->element; + $origin = (!empty($line->origin) ? $line->origin : $this->element); $result = $this->addline( $line->desc, $line->subprice, From 0a13e037923e34cd149ded1085bb521277b499c6 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Wed, 1 Jul 2020 22:19:10 +0200 Subject: [PATCH 25/33] FIX : Correct ModuleBuilder left menu --- htdocs/modulebuilder/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 30cde322422..ee750447636 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2934,7 +2934,7 @@ elseif (!empty($module)) print ''; print ''; - print $menu['left']; + print $menu['leftmenu']; print ''; print ''; From bce0a93227cf989c0a8ebde77b1033da81b3a9ad Mon Sep 17 00:00:00 2001 From: Tim Otte Date: Tue, 30 Jun 2020 15:20:30 +0200 Subject: [PATCH 26/33] Hotfix for an error in v12 --- htdocs/comm/propal/card.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 996ad2e31af..8f743015f06 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1138,6 +1138,9 @@ if (empty($reshook)) $outputlangs->setDefaultLang($newlang); } $ret = $object->fetch($id); // Reload to get new records + if ($ret > 0) { + $object->fetch_thirdparty(); + } $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } From b45bfd258df2e7ab09e707fb5e4850a19b091116 Mon Sep 17 00:00:00 2001 From: Je2fb <46494485+Je2fb@users.noreply.github.com> Date: Sun, 28 Jun 2020 17:53:48 +0200 Subject: [PATCH 27/33] fix #14143 --- htdocs/core/class/evalmath.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index b0fcc963eba..984324a7563 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -194,7 +194,7 @@ class EvalMath * * @return string Output */ - private function vars() + public function vars() { $output = $this->v; unset($output['pi']); From fd617658efd5c51a822eea2d816de81ca7942292 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jul 2020 00:36:56 +0200 Subject: [PATCH 28/33] Fix syntax --- htdocs/core/class/evalmath.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/evalmath.class.php b/htdocs/core/class/evalmath.class.php index 984324a7563..7e02aa57032 100644 --- a/htdocs/core/class/evalmath.class.php +++ b/htdocs/core/class/evalmath.class.php @@ -270,10 +270,11 @@ class EvalMath // =============== } elseif ($op == ')' and $expecting_op) { // ready to close a parenthesis? while (($o2 = $stack->pop()) != '(') { // pop off the stack back to the last ( - if (is_null($o2)) + if (is_null($o2)) { return $this->trigger(5, "unexpected ')'", ")"); - else + } else { $output[] = $o2; + } } if (preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) { // did we just close a function? $fnn = $matches[1]; // get the function name @@ -293,10 +294,11 @@ class EvalMath // =============== } elseif ($op == ',' and $expecting_op) { // did we just finish a function argument? while (($o2 = $stack->pop()) != '(') { - if (is_null($o2)) + if (is_null($o2)) { return $this->trigger(5, "unexpected ','", ","); // oops, never had a ( - else + } else { $output[] = $o2; // pop the argument expression stuff and push onto the output + } } // make sure there was a function if (!preg_match("/^([a-z]\w*)\($/", $stack->last(2), $matches)) From 18fa4c41058a446ff57ec0c5a8cfcc10b083f1be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jul 2020 00:38:31 +0200 Subject: [PATCH 29/33] Update card.php --- htdocs/compta/facture/card.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a65d7f6ed81..336b39224f1 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1255,8 +1255,7 @@ if (empty($reshook)) if ($_POST['type'] == Facture::TYPE_DEPOSIT) { $typeamount = GETPOST('typedeposit', 'alpha'); - $valuedeposit = GETPOST('valuedeposit'); - $valuedeposit = price2num($valuedeposit, 'MU'); + $valuedeposit = price2num(GETPOST('valuedeposit', 'alpha'), 'MU'); $amountdeposit = array(); if (!empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) From ca66eac76c86585536344be88935b229ff9d121a Mon Sep 17 00:00:00 2001 From: oscim Date: Mon, 29 Jun 2020 14:01:48 +0200 Subject: [PATCH 30/33] Update project.class.php Fix order of delete extra prev table of project --- htdocs/projet/class/project.class.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 860a6b6b92f..a0b6e38423b 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -747,7 +747,18 @@ class Project extends CommonObject } } + if (!$error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_extrafields"; + $sql .= " WHERE fk_object=".$this->id; + $resql = $this->db->query($sql); + if (!$resql) + { + $this->errors[] = $this->db->lasterror(); + $error++; + } + } // Delete project if (!$error) @@ -763,18 +774,7 @@ class Project extends CommonObject } } - if (!$error) - { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_extrafields"; - $sql .= " WHERE fk_object=".$this->id; - $resql = $this->db->query($sql); - if (!$resql) - { - $this->errors[] = $this->db->lasterror(); - $error++; - } - } if (empty($error)) { // We remove directory From 636f1e642dfb6c29793225f9f5caef3414feeef7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jul 2020 01:31:48 +0200 Subject: [PATCH 31/33] Fix param of product id to switch to list of order --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 56b9dd4781f..34a6f61bbb0 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -766,7 +766,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) print ''.$warning.$stock.''; // Already ordered - print ''.$ordered.' '.$picto.''; + print ''.$ordered.' '.$picto.''; // To order //print ''; From e256ce5c4b68030ec5a0e25c1c6ecc136b1a5750 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Jul 2020 19:27:23 +0200 Subject: [PATCH 32/33] Debug credit transfer module --- .../class/bonprelevement.class.php | 304 ++++++++++-------- htdocs/compta/prelevement/create.php | 8 +- 2 files changed, 181 insertions(+), 131 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 5db9ccde671..8cf77667a62 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -819,7 +819,7 @@ class BonPrelevement extends CommonObject * @param string $executiondate Date to execute the transfer * @param int $notrigger Disable triggers * @param string $type 'direct-debit' or 'bank-transfer' - * @return int <0 if KO, nbre of invoice withdrawed if OK + * @return int <0 if KO, No of invoice included into file if OK */ public function create($banque = 0, $agence = 0, $mode = 'real', $format = 'ALL', $executiondate = '', $notrigger = 0, $type = 'direct-debit') { @@ -831,7 +831,12 @@ class BonPrelevement extends CommonObject require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"; - if (empty($format)) return 'ErrorBadParametersForDirectDebitFileCreate'; + if ($type != 'bank-transfer') { + if (empty($format)) { + $this->error = 'ErrorBadParametersForDirectDebitFileCreate'; + return -1; + } + } $error = 0; @@ -1091,6 +1096,7 @@ class BonPrelevement extends CommonObject // Fetch invoice $fact = new Facture($this->db); $fact->fetch($fac[0]); + /* * Add standing order * @@ -1163,14 +1169,15 @@ class BonPrelevement extends CommonObject $this->context['factures_prev'] = $factures_prev; // Generation of SEPA file $this->filename - $result = $this->generate($format, $executiondate); + // This also the the property $this->total that is included into file + $result = $this->generate($format, $executiondate, $type); } dol_syslog(__METHOD__."::End withdraw receipt, file ".$this->filename, LOG_DEBUG); } //var_dump($factures_prev);exit; /* - * Update total + * Update total defined after generation of file */ $sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; $sql .= " SET amount = ".price2num($this->total); @@ -1455,7 +1462,7 @@ class BonPrelevement extends CommonObject /** - * Generate a withdrawal file. + * Generate a direct debit or credit transfer file. * Generation Formats: * - Europe: SEPA (France: CFONB no more supported, Spain: AEB19 if external module EsAEB is enabled) * - Others countries: Warning message @@ -1463,9 +1470,10 @@ class BonPrelevement extends CommonObject * * @param string $format FRST, RCUR or ALL * @param string $executiondate Date to execute transfer + * @param string $type 'direct-debit' or 'credit-transfer' * @return int >=0 if OK, <0 if KO */ - public function generate($format = 'ALL', $executiondate = '') + public function generate($format = 'ALL', $executiondate = '', $type = 'direct-debit') { global $conf, $langs, $mysoc; @@ -1473,7 +1481,7 @@ class BonPrelevement extends CommonObject $result = 0; - dol_syslog(get_class($this)."::generate build file ".$this->filename); + dol_syslog(get_class($this)."::generate build file=".$this->filename." type=".$type); $this->file = fopen($this->filename, "w"); if (empty($this->file)) @@ -1483,153 +1491,191 @@ class BonPrelevement extends CommonObject } $found = 0; + $this->total = 0; // Build file for European countries if ($mysoc->isInEEC()) { $found++; - /** - * SECTION CREATION FICHIER SEPA - */ - // SEPA Initialisation - $CrLf = "\n"; + if ($type == 'bank-transfer') { + print 'TODO'; + exit; + } else { + /** + * SECTION CREATION FICHIER SEPA + */ + // SEPA Initialisation + $CrLf = "\n"; - $now = dol_now(); + $now = dol_now(); - $dateTime_ECMA = dol_print_date($now, '%Y-%m-%dT%H:%M:%S'); + $dateTime_ECMA = dol_print_date($now, '%Y-%m-%dT%H:%M:%S'); - $date_actu = $now; - if (!empty($executiondate)) $date_actu = $executiondate; + $date_actu = $now; + if (!empty($executiondate)) $date_actu = $executiondate; - $dateTime_YMD = dol_print_date($date_actu, '%Y%m%d'); - $dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S'); - $fileDebiteurSection = ''; - $fileEmetteurSection = ''; - $i = 0; - $this->total = 0; + $dateTime_YMD = dol_print_date($date_actu, '%Y%m%d'); + $dateTime_YMDHMS = dol_print_date($date_actu, '%Y%m%d%H%M%S'); + $fileDebiteurSection = ''; + $fileEmetteurSection = ''; + $i = 0; - /* - * Section Debitor (sepa Debiteurs bloc lines) - */ + /* + * Section Debitor (sepa Debiteurs bloc lines) + */ - $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; - $sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; - $sql .= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum"; - $sql .= " FROM"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; - $sql .= " ".MAIN_DB_PREFIX."facture as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,"; - $sql .= " ".MAIN_DB_PREFIX."societe as soc,"; - $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; - $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; - $sql .= " WHERE pl.fk_prelevement_bons = ".$this->id; - $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; - $sql .= " AND pf.fk_facture = f.rowid"; - $sql .= " AND soc.fk_pays = c.rowid"; - $sql .= " AND soc.rowid = f.fk_soc"; - $sql .= " AND rib.fk_soc = f.fk_soc"; - $sql .= " AND rib.default_rib = 1"; - $sql .= " AND rib.type = 'ban'"; - //print $sql; + $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; + $sql .= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; + $sql .= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum"; + $sql .= " FROM"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; + $sql .= " ".MAIN_DB_PREFIX."facture as f,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf,"; + $sql .= " ".MAIN_DB_PREFIX."societe as soc,"; + $sql .= " ".MAIN_DB_PREFIX."c_country as c,"; + $sql .= " ".MAIN_DB_PREFIX."societe_rib as rib"; + $sql .= " WHERE pl.fk_prelevement_bons = ".$this->id; + $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; + $sql .= " AND pf.fk_facture = f.rowid"; + $sql .= " AND soc.fk_pays = c.rowid"; + $sql .= " AND soc.rowid = f.fk_soc"; + $sql .= " AND rib.fk_soc = f.fk_soc"; + $sql .= " AND rib.default_rib = 1"; + $sql .= " AND rib.type = 'ban'"; + //print $sql; - // Define $fileDebiteurSection. One section DrctDbtTxInf per invoice. - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - while ($i < $num) + // Define $fileDebiteurSection. One section DrctDbtTxInf per invoice. + $resql = $this->db->query($sql); + if ($resql) { - $obj = $this->db->fetch_object($resql); - $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum); - $this->total = $this->total + $obj->somme; - $i++; + $num = $this->db->num_rows($resql); + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum); + $this->total = $this->total + $obj->somme; + $i++; + } + $nbtotalDrctDbtTxInf = $i; + } + else + { + fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers + $result = -2; } - $nbtotalDrctDbtTxInf = $i; - } - else - { - fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers - $result = -2; - } - // Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all DrctDbtTxInf - if ($result != -2) - { - $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format); - } - else - { - fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company - } + // Define $fileEmetteurSection. Start of bloc PmtInf. Will contains all DrctDbtTxInf + if ($result != -2) + { + $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format); + } + else + { + fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company + } - /** - * SECTION CREATION SEPA FILE - */ - // SEPA File Header - fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf); - fputs($this->file, ''.$CrLf); - fputs($this->file, ' '.$CrLf); - // SEPA Group header - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.('PREL'.$dateTime_YMD.'/REF'.$this->id).''.$CrLf); - fputs($this->file, ' '.$dateTime_ECMA.''.$CrLf); - fputs($this->file, ' '.$i.''.$CrLf); - fputs($this->file, ' '.$this->total.''.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.strtoupper(dol_string_unaccent($this->raison_sociale)).''.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$conf->global->PRELEVEMENT_ICS.''.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$CrLf); - // SEPA File Emetteur - if ($result != -2) - { fputs($this-> file, $fileEmetteurSection); } - // SEPA File Debiteurs - if ($result != -2) - { fputs($this-> file, $fileDebiteurSection); } - // SEPA FILE FOOTER - fputs($this->file, ' '.$CrLf); - fputs($this->file, ' '.$CrLf); - fputs($this->file, ''.$CrLf); + /** + * SECTION CREATION SEPA FILE + */ + // SEPA File Header + fputs($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf); + fputs($this->file, ''.$CrLf); + fputs($this->file, ' '.$CrLf); + // SEPA Group header + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.('PREL'.$dateTime_YMD.'/REF'.$this->id).''.$CrLf); + fputs($this->file, ' '.$dateTime_ECMA.''.$CrLf); + fputs($this->file, ' '.$i.''.$CrLf); + fputs($this->file, ' '.$this->total.''.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.strtoupper(dol_string_unaccent($this->raison_sociale)).''.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$conf->global->PRELEVEMENT_ICS.''.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + // SEPA File Emetteur + if ($result != -2) + { fputs($this-> file, $fileEmetteurSection); } + // SEPA File Debiteurs + if ($result != -2) + { fputs($this-> file, $fileDebiteurSection); } + // SEPA FILE FOOTER + fputs($this->file, ' '.$CrLf); + fputs($this->file, ' '.$CrLf); + fputs($this->file, ''.$CrLf); + } } // Build file for Other Countries with unknow format if (!$found) { - $this->total = 0; - $sql = "SELECT pl.amount"; - $sql .= " FROM"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; - $sql .= " ".MAIN_DB_PREFIX."facture as f,"; - $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; - $sql .= " WHERE pl.fk_prelevement_bons = ".$this->id; - $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; - $sql .= " AND pf.fk_facture = f.rowid"; + if ($type == 'bank-transfer') { + $sql = "SELECT pl.amount"; + $sql .= " FROM"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; + $sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; + $sql .= " WHERE pl.fk_prelevement_bons = ".$this->id; + $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; + $sql .= " AND pf.fk_facture_fourn = f.rowid"; - //Lines - $i = 0; - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - - while ($i < $num) + // Lines + $i = 0; + $resql = $this->db->query($sql); + if ($resql) { - $obj = $this->db->fetch_object($resql); - $this->total = $this->total + $obj->amount; - $i++; + $num = $this->db->num_rows($resql); + + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $this->total = $this->total + $obj->amount; + + // TODO Write record into file + $i++; + } + } + else + { + $result = -2; + } + } else { + $sql = "SELECT pl.amount"; + $sql .= " FROM"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; + $sql .= " ".MAIN_DB_PREFIX."facture as f,"; + $sql .= " ".MAIN_DB_PREFIX."prelevement_facture as pf"; + $sql .= " WHERE pl.fk_prelevement_bons = ".$this->id; + $sql .= " AND pl.rowid = pf.fk_prelevement_lignes"; + $sql .= " AND pf.fk_facture = f.rowid"; + + // Lines + $i = 0; + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + + while ($i < $num) + { + $obj = $this->db->fetch_object($resql); + $this->total = $this->total + $obj->amount; + + // TODO Write record into file + $i++; + } + } + else + { + $result = -2; } - } - else - { - $result = -2; } $langs->load('withdrawals'); diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 80055b20d72..ff25af5e0e9 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -191,7 +191,8 @@ print ''; if ($nb) { if ($pricetowithdraw) { print $langs->trans('ExecutionDate').' '; - print $form->selectDate(); + $datere = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); + print $form->selectDate($datere, 're'); if ($mysoc->isInEEC()) { $title = $langs->trans("CreateForSepa"); @@ -200,7 +201,10 @@ if ($nb) { } if ($type != 'bank-transfer') { - print ''; + print ''; } print ''; } else { From 4819e58d06db60802016df80a57141916f05d5a9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 4 Jul 2020 13:04:53 +0200 Subject: [PATCH 33/33] Fix trans --- htdocs/core/lib/holiday.lib.php | 2 +- htdocs/langs/en_US/holiday.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/holiday.lib.php b/htdocs/core/lib/holiday.lib.php index bb114b6a62e..3c98f14a385 100644 --- a/htdocs/core/lib/holiday.lib.php +++ b/htdocs/core/lib/holiday.lib.php @@ -35,7 +35,7 @@ function holiday_prepare_head($object) $head = array(); $head[$h][0] = DOL_URL_ROOT.'/holiday/card.php?id='.$object->id; - $head[$h][1] = $langs->trans("Holiday"); + $head[$h][1] = $langs->trans("Leave"); $head[$h][2] = 'card'; $h++; diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 82de49f9c5f..eb2cd89adf1 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -15,6 +15,7 @@ CancelCP=Canceled RefuseCP=Refused ValidatorCP=Approbator ListeCP=List of leave +Leave=Leave request LeaveId=Leave ID ReviewedByCP=Will be approved by UserID=User ID