From f85b666e72b2ec2b56f55eaacf2f73c64f95244a Mon Sep 17 00:00:00 2001 From: Alexandre Boin Date: Tue, 14 Mar 2023 16:18:25 +0100 Subject: [PATCH 01/14] Test deployment --- htdocs/test-deploy.php | 1 + 1 file changed, 1 insertion(+) create mode 100644 htdocs/test-deploy.php diff --git a/htdocs/test-deploy.php b/htdocs/test-deploy.php new file mode 100644 index 00000000000..4138a886454 --- /dev/null +++ b/htdocs/test-deploy.php @@ -0,0 +1 @@ + From 1907891b140c3c56041e5c499d8ced3e26f5ddbf Mon Sep 17 00:00:00 2001 From: Alexandre Boin Date: Tue, 14 Mar 2023 16:19:18 +0100 Subject: [PATCH 02/14] Remove deployment test --- htdocs/test-deploy.php | 1 - 1 file changed, 1 deletion(-) delete mode 100644 htdocs/test-deploy.php diff --git a/htdocs/test-deploy.php b/htdocs/test-deploy.php deleted file mode 100644 index 4138a886454..00000000000 --- a/htdocs/test-deploy.php +++ /dev/null @@ -1 +0,0 @@ - From 249eaeb22d4106b46da60258e21247ed57940dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 Apr 2023 20:34:46 +0200 Subject: [PATCH 03/14] fix warnings --- htdocs/accountancy/journal/bankjournal.php | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 89f495a97bc..4720a01e9be 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -195,13 +195,13 @@ if ($result) { //print $sql; // Variables - $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word - $account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word - $account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word - $account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word - $account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word - $account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word - $account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word + $account_supplier = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', 'NotDefined'); // NotDefined is a reserved word + $account_customer = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined'); // NotDefined is a reserved word + $account_employee = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined'); // NotDefined is a reserved word + $account_pay_vat = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT', 'NotDefined'); // NotDefined is a reserved word + $account_pay_donation = getDolGlobalString('DONATION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word + $account_pay_subscription = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word + $account_transfer = getDolGlobalString('ACCOUNTING_ACCOUNT_TRANSFER_CASH', 'NotDefined'); // NotDefined is a reserved word $tabcompany = array(); $tabuser = array(); @@ -1088,9 +1088,9 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger - if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' - || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1' - || empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { + if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER' == "") || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' + || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1' + || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { print ($desc ? '' : '
').'
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); @@ -1105,8 +1105,8 @@ if (empty($action) || $action == 'view') { print ''; } - if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' - || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { + if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' + || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1') { print ''; } else { if ($in_bookkeeping == 'notyet') { From 5be9203d546bf6d1cadd231f10e6c194b62feac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 28 Apr 2023 20:46:19 +0200 Subject: [PATCH 04/14] fix nedd buy new glasses --- htdocs/accountancy/journal/bankjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 4720a01e9be..b79d63cfbce 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1088,7 +1088,7 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger - if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER' == "") || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' + if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1' || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { print ($desc ? '' : '
').'
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); From 0c93c89a94f448d51941174a1f2aa242952b0e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 29 Apr 2023 09:08:38 +0200 Subject: [PATCH 05/14] clean code --- htdocs/accountancy/journal/bankjournal.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index b79d63cfbce..3e2aa4b3b4a 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -7,7 +7,7 @@ * Copyright (C) 2013-2022 Open-DSI * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy - * Copyright (C) 2017-2021 Frédéric France + * Copyright (C) 2017-2023 Frédéric France * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Eric Seigne * Copyright (C) 2021 Gauthier VERDOL @@ -148,7 +148,7 @@ if ($date_start && $date_end) { } // Define begin binding date if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { - $sql .= " AND b.dateo >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; + $sql .= " AND b.dateo >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; } // Already in bookkeeping or not if ($in_bookkeeping == 'already') { @@ -912,7 +912,7 @@ if (!$error && $action == 'writebookkeeping') { // Export if ($action == 'exportcsv') { // ISO and not UTF8 ! - $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV'); $filename = 'journal'; $type_export = 'journal'; @@ -983,13 +983,13 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$val["type_payment"].'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; if ($tabtype[$key] == 'payment_supplier') { - print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep; + print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER').'"'.$sep; } elseif ($tabtype[$key] == 'payment') { - print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep; + print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER').'"'.$sep; } elseif ($tabtype[$key] == 'payment_expensereport') { - print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep; + print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep; } elseif ($tabtype[$key] == 'payment_salary') { - print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep; + print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep; } else { print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; } @@ -1014,8 +1014,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$key.'"'.$sep; print '"'.$date.'"'.$sep; print '"'.$val["type_payment"].'"'.$sep; - print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep; - print '"'.length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep; + print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep; + print '"'.length_accounta(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep; print "".$sep; print '"'.$reflabel.'"'.$sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; From ffaf748ac8450bdbe74d95760b47ac3fc2b57441 Mon Sep 17 00:00:00 2001 From: Romain Neil Date: Mon, 1 May 2023 19:45:33 +0200 Subject: [PATCH 06/14] feat(api/documents): upload contract --- htdocs/api/class/api_documents.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index d7fd1ea7118..01677456cb3 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -672,6 +672,10 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $object = new Contact($this->db); $fetchbyid = true; + } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { + $modulepart = 'contrat'; + require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; + $object = new Contrat($this->db); } else { // TODO Implement additional moduleparts throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); From 458fb18b5d905246a2834cb95f0e1c2ef69f9e5c Mon Sep 17 00:00:00 2001 From: Romain Neil Date: Mon, 1 May 2023 20:10:48 +0200 Subject: [PATCH 07/14] feat(api/documents): list contract --- htdocs/api/class/api_documents.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 01677456cb3..042b48707fb 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -502,6 +502,17 @@ class Documents extends DolibarrApi // $upload_dir = $conf->ecm->dir_output; // $type = 'all'; // $recursive = 0; + } elseif($modulepart == 'contrat' || $modulepart == 'contract') { + $modulepart = 'contrat'; + require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; + + $object = new Contrat($this->db); + $result = $object->fetch($id, $ref); + if (!$result) { + throw new RestException(404, 'Contract not found'); + } + + $upload_dir = $conf->contrat->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'contract'); } else { throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); } From 1f8671ed84afb2121e2d595311fed3b85057f02d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 1 May 2023 18:11:31 +0000 Subject: [PATCH 08/14] Fixing style errors. --- htdocs/api/class/api_documents.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 042b48707fb..1ee47667b46 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -502,7 +502,7 @@ class Documents extends DolibarrApi // $upload_dir = $conf->ecm->dir_output; // $type = 'all'; // $recursive = 0; - } elseif($modulepart == 'contrat' || $modulepart == 'contract') { + } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { $modulepart = 'contrat'; require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; From a4fd13e3e46ebed071312333a41a73a81fff7d3f Mon Sep 17 00:00:00 2001 From: Romain Neil Date: Mon, 1 May 2023 22:11:27 +0200 Subject: [PATCH 09/14] feat(api/documents): build contract --- htdocs/api/class/api_documents.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 1ee47667b46..fbfde850935 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -221,6 +221,22 @@ class Documents extends DolibarrApi if ($result <= 0) { throw new RestException(500, 'Error generating document'); } + } elseif ($modulepart == 'contrat' || $modulepart == 'contract') { + require_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php'; + + $this->contract = new Contrat($this->db); + $result = $this->contract->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + + if (!$result) { + throw new RestException(404, 'Contract not found'); + } + + $templateused = $doctemplate ? $doctemplate : $this->contract->model_pdf; + $result = $this->contract->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); + + if ($result <= 0) { + throw new RestException(500, 'Error generating document missing doctemplate parameter'); + } } else { throw new RestException(403, 'Generation not available for this modulepart'); } From a804999d92e3a1145d831ddab85a46164546eef1 Mon Sep 17 00:00:00 2001 From: Sarah Mainguet Date: Mon, 1 May 2023 22:11:35 +0200 Subject: [PATCH 10/14] Can now add documents to events in agenda --- htdocs/api/class/api_documents.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 78442622c7e..bec16dfc8b7 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -666,6 +666,10 @@ class Documents extends DolibarrApi $modulepart = 'propale'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $object = new Propal($this->db); + } elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { + $modulepart = 'agenda'; + require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; + $object = new ActionComm($this->db); } else { // TODO Implement additional moduleparts throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); @@ -742,6 +746,11 @@ class Documents extends DolibarrApi throw new RestException(500, "File with name '".$original_file."' already exists."); } + // in case temporary directory doesn't exist + if (!dol_is_dir(dirname(DOL_DATA_ROOT . '/admin/temp/'))) { + dol_mkdir(DOL_DATA_ROOT . '/admin/temp/'); + } + $fhandle = @fopen($destfiletmp, 'w'); if ($fhandle) { $nbofbyteswrote = fwrite($fhandle, $newfilecontent); From 1487c233f0c4a741d04556b0addc33f3a7d6aa21 Mon Sep 17 00:00:00 2001 From: rneil Date: Tue, 2 May 2023 00:56:10 +0200 Subject: [PATCH 11/14] add missing copyright --- htdocs/api/class/api_documents.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index fbfde850935..02955c21c77 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2016 Xebax Christy * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2016 Jean-François Ferry + * COpyright (C) 2023 Romain Neil * * 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 From 2c13d26b69c376704553ad1bc86f22a8fd8cb659 Mon Sep 17 00:00:00 2001 From: Romain Neil Date: Tue, 2 May 2023 00:59:51 +0200 Subject: [PATCH 12/14] Update api_documents.class.php typo fix --- htdocs/api/class/api_documents.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 02955c21c77..1bab0c282e6 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Xebax Christy * Copyright (C) 2016 Laurent Destailleur * Copyright (C) 2016 Jean-François Ferry - * COpyright (C) 2023 Romain Neil + * Copyright (C) 2023 Romain Neil * * 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 From 06979fa0168d929db8f0a7b0fd3c6bbe10b40ff6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 May 2023 05:58:18 +0200 Subject: [PATCH 13/14] Update api_documents.class.php --- htdocs/api/class/api_documents.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 9c357dc5679..1c4e7a8ea11 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -756,9 +756,9 @@ class Documents extends DolibarrApi throw new RestException(500, "File with name '".$original_file."' already exists."); } - // in case temporary directory doesn't exist - if (!dol_is_dir(dirname(DOL_DATA_ROOT . '/admin/temp/'))) { - dol_mkdir(DOL_DATA_ROOT . '/admin/temp/'); + // in case temporary directory admin/temp doesn't exist + if (!dol_is_dir(dirname($destfiletmp))) { + dol_mkdir(dirname($destfiletmp)); } $fhandle = @fopen($destfiletmp, 'w'); From 0a89cb6c50b6af54a9ff788073e6958c20c82f77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 May 2023 06:11:23 +0200 Subject: [PATCH 14/14] Update bankjournal.php --- htdocs/accountancy/journal/bankjournal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 3e2aa4b3b4a..76f25557662 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -147,8 +147,8 @@ if ($date_start && $date_end) { $sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'"; } // Define begin binding date -if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { - $sql .= " AND b.dateo >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND b.dateo >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } // Already in bookkeeping or not if ($in_bookkeeping == 'already') {