From 50d530733e7450ff3481baead7cbfb51a9e9fd26 Mon Sep 17 00:00:00 2001 From: jcp Date: Mon, 9 Nov 2020 13:17:24 +0100 Subject: [PATCH 01/53] NEW: ICS fields moved into bank account table --- htdocs/admin/paymentbybanktransfer.php | 6 ++- htdocs/admin/prelevement.php | 9 ++++- htdocs/compta/bank/card.php | 22 ++++++++++- htdocs/compta/bank/class/account.class.php | 20 +++++++++- htdocs/compta/paymentbybanktransfer/index.php | 2 +- .../class/bonprelevement.class.php | 7 ++-- htdocs/compta/prelevement/create.php | 39 +++++++++++++++---- htdocs/core/lib/prelevement.lib.php | 18 ++++++--- .../bank/doc/pdf_sepamandate.modules.php | 2 +- htdocs/langs/en_US/withdrawals.lang | 6 ++- 10 files changed, 107 insertions(+), 24 deletions(-) diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index 6a419d39e53..5449e927a4f 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -71,10 +71,10 @@ if ($action == "set") if (! $res > 0) $error++; */ } else $error++; - +/* Moved to account $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_ICS", GETPOST("PAYMENTBYBANKTRANSFER_ICS"), 'chaine', 0, '', $conf->entity); if (!$res > 0) $error++; - +*/ if (GETPOST("PAYMENTBYBANKTRANSFER_USER") > 0) { $res = dolibarr_set_const($db, "PAYMENTBYBANKTRANSFER_USER", GETPOST("PAYMENTBYBANKTRANSFER_USER"), 'chaine', 0, '', $conf->entity); @@ -156,11 +156,13 @@ print ''; $form->select_comptes($conf->global->PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT, 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT', 0, "courant=1", 1); print ''; +/* Moved to bank account data // ICS print ''.$langs->trans("ICS").''; print ''; print ''; print ''; +*/ //User print ''.$langs->trans("ResponsibleUser").''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index c16b5c30c47..601cefc1dd2 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -70,11 +70,14 @@ if ($action == "set") $res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; */ + } else $error++; +/* Moved to account + $res = dolibarr_set_const($db, "PRELEVEMENT_ICS", GETPOST("PRELEVEMENT_ICS"), 'chaine', 0, '', $conf->entity); if (!$res > 0) $error++; - +*/ if (GETPOST("PRELEVEMENT_USER") > 0) { $res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"), 'chaine', 0, '', $conf->entity); @@ -149,13 +152,16 @@ print ''.$langs->trans("Parameter").''; print ''.$langs->trans("Value").''; print ""; + // Bank account (from Banks module) print ''.$langs->trans("BankToReceiveWithdraw").''; print ''; $form->select_comptes($conf->global->PRELEVEMENT_ID_BANKACCOUNT, 'PRELEVEMENT_ID_BANKACCOUNT', 0, "courant=1", 1); print ''; +/* Moved to bank account data // ICS + print ''; $htmltext = $langs->trans("AskThisIDToYourBank"); print $form->textwithpicto($langs->trans("ICS"), $htmltext); @@ -164,6 +170,7 @@ print ''; print ''; print ''; print ''; +*/ //User print ''.$langs->trans("ResponsibleUser").''; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 8b086516351..83940f4ac43 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -94,6 +94,9 @@ if ($action == 'add') $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); + + $object->ics = trim($_POST["ics"]); + $object->ics_transfer = trim($_POST["ics_transfer"]); $account_number = GETPOST('account_number', 'alphanohtml'); if (empty($account_number) || $account_number == '-1') @@ -195,6 +198,9 @@ if ($action == 'update') $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); + + $object->ics = trim($_POST["ics"]); + $object->ics_transfer = trim($_POST["ics_transfer"]); $account_number = GETPOST('account_number', 'alpha'); if (empty($account_number) || $account_number == '-1') @@ -730,6 +736,14 @@ if ($action == 'create') } } print ''; + + print ''.$langs->trans("ICS").''; + print ''.$object->ics.''; + print ''; + + print ''.$langs->trans("ICSTransfer").''; + print ''.$object->ics_transfer.''; + print ''; print ''.$langs->trans("BankAccountDomiciliation").''; print nl2br($object->domiciliation); @@ -1010,7 +1024,13 @@ if ($action == 'create') print ''.$langs->trans($bickey).''; print ''; - + + print ''.$langs->trans("ICS").''; + print ''; + + print ''.$langs->trans("ICSTransfer").''; + print ''; + print ''.$langs->trans("BankAccountDomiciliation").''; print ''; } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; From f5641f8068d1a9f594d0e71926c61b437a32c0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 30 Dec 2020 22:15:34 +0100 Subject: [PATCH 35/53] remove deprecated --- htdocs/admin/expensereport.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 389766a47ae..61688e18515 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -70,12 +70,12 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == 'specimen') { // For fiche inter +} elseif ($action == 'specimen') { // For fiche expensereport $modele = GETPOST('module', 'alpha'); - $inter = new ExpenseReport($db); - $inter->initAsSpecimen(); - $inter->status = 0; // Force statut draft to show watermark + $expensespecimen = new ExpenseReport($db); + $expensespecimen->initAsSpecimen(); + $expensespecimen->status = 0; // Force statut draft to show watermark // Search template files $file = ''; $classname = ''; $filefound = 0; @@ -94,7 +94,7 @@ if ($action == 'updateMask') { $module = new $classname($db); - if ($module->write_file($inter, $langs) > 0) { + if ($module->write_file($expensespecimen, $langs) > 0) { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expensereport&file=SPECIMEN.pdf"); return; } else { @@ -278,7 +278,7 @@ foreach ($dirmodels as $reldir) { print "
\n"; /* - * Documents models for Interventions + * Documents models for ExpenseReport */ print load_fiche_titre($langs->trans("TemplatePDFExpenseReports"), '', ''); From 65edc377c3515cbea7a40d27e4d69d9e8773e39e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Dec 2020 22:53:21 +0100 Subject: [PATCH 36/53] FIX Visible date of payment --- htdocs/compta/facture/card.php | 10 +++++++++- htdocs/compta/paiement/class/paiement.class.php | 11 ++++++++++- htdocs/takepos/invoice.php | 6 +++--- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index aa07de4867e..0970aff1b45 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4848,7 +4848,15 @@ elseif ($id > 0 || !empty($ref)) print ''; print $paymentstatic->getNomUrl(1); print ''; - print ''.dol_print_date($db->jdate($objp->dp), 'dayhour').''; + print ''; + $dateofpayment = $db->jdate($objp->dp); + $tmparray = dol_getdate($dateofpayment); + if ($tmparray['seconds'] == 0 && $tmparray['minutes'] == 0 && ($tmparray['hours'] == 0 || $tmparray['hours'] == 12)) { // We set hours to 0:00 or 12:00 because we don't know it + print dol_print_date($dateofpayment, 'day'); + } else { // Hours was set to real date of payment (special case for POS for example) + print dol_print_date($dateofpayment, 'dayhour', 'tzuser'); + } + print ''; $label = ($langs->trans("PaymentType".$objp->payment_code) != ("PaymentType".$objp->payment_code)) ? $langs->trans("PaymentType".$objp->payment_code) : $objp->payment_label; print ''.$label.' '.$objp->num_payment.''; if (!empty($conf->banque->enabled)) diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 7a759dde543..4583f0376ae 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1201,7 +1201,16 @@ class Paiement extends CommonObject $result = ''; $label = ''.$langs->trans("ShowPayment").'
'; $label .= ''.$langs->trans("Ref").': '.$this->ref; - if ($this->datepaye ? $this->datepaye : $this->date) $label .= '
'.$langs->trans("Date").': '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour'); + $dateofpayment = ($this->datepaye ? $this->datepaye : $this->date); + if ($dateofpayment) { + $label .= '
'.$langs->trans("Date").': '; + $tmparray = dol_getdate($dateofpayment); + if ($tmparray['seconds'] == 0 && $tmparray['minutes'] == 0 && ($tmparray['hours'] == 0 || $tmparray['hours'] == 12)) { // We set hours to 0:00 or 12:00 because we don't know it + $label .= dol_print_date($dateofpayment, 'day'); + } else { // Hours was set to real date of payment (special case for POS for example) + $label .= dol_print_date($dateofpayment, 'dayhour', 'tzuser'); + } + } if ($mode == 'withlistofinvoices') { $arraybill = $this->getBillsArray(); diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 1022308c308..0909f1b3cca 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -158,7 +158,7 @@ if ($action == 'valid' && $user->rights->facture->creer) if ($invoice->total_ttc < 0) { $invoice->type = $invoice::TYPE_CREDIT_NOTE; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture WHERE "; - $sql .= "fk_soc = '".$invoice->socid."' "; + $sql .= "fk_soc = ".((int) $invoice->socid)." "; $sql .= "AND type <> ".Facture::TYPE_CREDIT_NOTE." "; $sql .= "AND fk_statut >= ".$invoice::STATUS_VALIDATED." "; $sql .= "ORDER BY rowid DESC"; @@ -763,13 +763,13 @@ $( document ).ready(function() { if ($resql) { while ($obj = $db->fetch_object($resql)) { echo '$("#customerandsales").append(\''; - echo 'jdate($obj->datec), '%H:%M'))).'" onclick="place=\\\''; + echo 'jdate($obj->datec), '%H:%M', 'tzuser'))).'" onclick="place=\\\''; $num_sale = str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $obj->ref)); echo $num_sale; if (str_replace("-", "", $num_sale) > $max_sale) $max_sale = str_replace("-", "", $num_sale); echo '\\\';Refresh();">'; if ($placeid == $obj->rowid) echo ""; - echo dol_print_date($db->jdate($obj->datec), '%H:%M'); + echo dol_print_date($db->jdate($obj->datec), '%H:%M', 'tzuser'); if ($placeid == $obj->rowid) echo ""; echo '\');'; } From 1eb88333569da70e46f160ab68a9e80a2b1f2124 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Dec 2020 23:39:51 +0100 Subject: [PATCH 37/53] Fix total when no data --- .../accountancy/bookkeeping/listbyaccount.php | 68 ++++++++++--------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 0b063adb1ff..4847dfd2e9a 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -749,40 +749,42 @@ while ($i < min($num, $limit)) $i++; } -// Show sub-total of last shown account -if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber = 3; - $colnumberend = 7; -} else { - $colnumber = 4; - $colnumberend = 7; +if ($num > 0) { + // Show sub-total of last shown account + if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { + $colnumber = 3; + $colnumberend = 7; + } else { + $colnumber = 4; + $colnumberend = 7; + } + $colspan = $totalarray['nbfield'] - $colnumber; + $colspanend = $totalarray['nbfield'] - $colnumberend; + print ''; + print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; + print ''.price($sous_total_debit).''; + print ''.price($sous_total_credit).''; + print ''; + print ''; + // Show balance of last shown account + $balance = $sous_total_debit - $sous_total_credit; + print ''; + print ''.$langs->trans("Balance").':'; + if ($balance > 0) + { + print ''; + print price($sous_total_debit - $sous_total_credit); + print ''; + print ''; + } else { + print ''; + print ''; + print price($sous_total_credit - $sous_total_debit); + print ''; + } + print ''; + print ''; } -$colspan = $totalarray['nbfield'] - $colnumber; -$colspanend = $totalarray['nbfield'] - $colnumberend; -print ''; -print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; -print ''.price($sous_total_debit).''; -print ''.price($sous_total_credit).''; -print ''; -print ''; -// Show balance of last shown account -$balance = $sous_total_debit - $sous_total_credit; -print ''; -print ''.$langs->trans("Balance").':'; -if ($balance > 0) -{ - print ''; - print price($sous_total_debit - $sous_total_credit); - print ''; - print ''; -} else { - print ''; - print ''; - print price($sous_total_credit - $sous_total_debit); - print ''; -} -print ''; -print ''; // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; From e17d4b8220e2e9e5f1aa27cc4421f9d9cad31706 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Dec 2020 23:51:55 +0100 Subject: [PATCH 38/53] Fix total when no data --- .../bookkeeping/listbysubaccount.php | 68 ++++++++++--------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index 2bdf5e11d09..abbf5df60e7 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -761,40 +761,42 @@ while ($i < min($num, $limit)) $i++; } -// Show sub-total of last shown account -if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { - $colnumber = 3; - $colnumberend = 7; -} else { - $colnumber = 4; - $colnumberend = 7; +if ($num > 0) { + // Show sub-total of last shown account + if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING) || empty($arrayfields['t.lettering_code']['checked'])) { + $colnumber = 3; + $colnumberend = 7; + } else { + $colnumber = 4; + $colnumberend = 7; + } + $colspan = $totalarray['nbfield'] - $colnumber; + $colspanend = $totalarray['nbfield'] - $colnumberend; + print ''; + print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; + print ''.price($sous_total_debit).''; + print ''.price($sous_total_credit).''; + print ''; + print ''; + // Show balance of last shown account + $balance = $sous_total_debit - $sous_total_credit; + print ''; + print ''.$langs->trans("Balance").':'; + if ($balance > 0) + { + print ''; + print price($sous_total_debit - $sous_total_credit); + print ''; + print ''; + } else { + print ''; + print ''; + print price($sous_total_credit - $sous_total_debit); + print ''; + } + print ''; + print ''; } -$colspan = $totalarray['nbfield'] - $colnumber; -$colspanend = $totalarray['nbfield'] - $colnumberend; -print ''; -print ''.$langs->trans("TotalForAccount").' '.$accountg.':'; -print ''.price($sous_total_debit).''; -print ''.price($sous_total_credit).''; -print ''; -print ''; -// Show balance of last shown account -$balance = $sous_total_debit - $sous_total_credit; -print ''; -print ''.$langs->trans("Balance").':'; -if ($balance > 0) -{ - print ''; - print price($sous_total_debit - $sous_total_credit); - print ''; - print ''; -} else { - print ''; - print ''; - print price($sous_total_credit - $sous_total_debit); - print ''; -} -print ''; -print ''; // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; From e187e77acbc0697a5ca27fa8cc6875b083d6bacb Mon Sep 17 00:00:00 2001 From: jcp Date: Thu, 31 Dec 2020 10:12:03 +0100 Subject: [PATCH 39/53] ICS and ICS_transfer hide if module not enabled --- htdocs/compta/bank/card.php | 38 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 469165b4b6e..da02a19129f 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -95,8 +95,8 @@ if ($action == 'add') $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); - $object->ics = trim(GETPOST("ics", 'alpha'); - $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'); + $object->ics = trim(GETPOST("ics", 'alpha')); + $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha')); $account_number = GETPOST('account_number', 'alphanohtml'); if (empty($account_number) || $account_number == '-1') @@ -199,8 +199,8 @@ if ($action == 'update') $object->proprio = trim(GETPOST("proprio", 'alphanohtml')); $object->owner_address = trim(GETPOST("owner_address", 'nohtml')); - $object->ics = trim(GETPOST("ics", 'alpha'); - $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha'); + $object->ics = trim(GETPOST("ics", 'alpha')); + $object->ics_transfer = trim(GETPOST("ics_transfer", 'alpha')); $account_number = GETPOST('account_number', 'alpha'); if (empty($account_number) || $account_number == '-1') @@ -737,13 +737,17 @@ if ($action == 'create') } print ''; - print ''.$langs->trans("ICS").''; - print ''.$object->ics.''; - print ''; + if($conf->prelevement->enabled){ + print ''.$langs->trans("ICS").''; + print ''.$object->ics.''; + print ''; + } - print ''.$langs->trans("ICSTransfer").''; - print ''.$object->ics_transfer.''; - print ''; + if($conf->paymentbybanktransfer->enabled){ + print ''.$langs->trans("ICSTransfer").''; + print ''.$object->ics_transfer.''; + print ''; + } print ''.$langs->trans("BankAccountDomiciliation").''; print nl2br($object->domiciliation); @@ -1025,12 +1029,16 @@ if ($action == 'create') print ''.$langs->trans($bickey).''; print ''; - print ''.$langs->trans("ICS").''; - print ''; - - print ''.$langs->trans("ICSTransfer").''; - print ''; + if($conf->prelevement->enabled){ + print ''.$langs->trans("ICS").''; + print ''; + } + if($conf->paymentbybanktransfer->enabled){ + print ''.$langs->trans("ICSTransfer").''; + print ''; + } + print ''.$langs->trans("BankAccountDomiciliation").''; print '