From 43ea5f73e3d2d7a7520c4b96a27a1cf51105e800 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Fri, 22 Jul 2022 13:41:24 +0200 Subject: [PATCH 01/10] Add missing require for MoLine --- htdocs/mrp/class/mo.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 09f4ad8d268..0a953ea869c 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -25,6 +25,7 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; From e9ae888fc7d746584ffaf23519dba7c584645d0f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 22 Jul 2022 16:01:39 +0200 Subject: [PATCH 02/10] FIX Accountancy - Label of VAT account is empty --- htdocs/accountancy/journal/expensereportsjournal.php | 2 +- htdocs/accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 96ab150dd24..8a2bbcdf81c 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -328,7 +328,7 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { - $accountingaccount->fetch($k, null, true); // TODO Use a cache for label + $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label $account_label = $accountingaccount->label; // get compte id and label diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 9a65844871d..dbee23abaa8 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -441,7 +441,7 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { - $accountingaccount->fetch($k, null, true); // TODO Use a cache for label + $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label $label_account = $accountingaccount->label; $bookkeeping = new BookKeeping($db); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index bd476173427..84d4b616ec3 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -453,7 +453,7 @@ if ($action == 'writebookkeeping') { foreach ($arrayofvat[$key] as $k => $mt) { if ($mt) { - $accountingaccount->fetch($k, null, true); // TODO Use a cache for label + $accountingaccount->fetch(null, $k, true); // TODO Use a cache for label $label_account = $accountingaccount->label; $bookkeeping = new BookKeeping($db); From 1dec64e32042af4c04fea7d352e6f9c0288ccc54 Mon Sep 17 00:00:00 2001 From: Chl Date: Fri, 22 Jul 2022 19:03:08 +0200 Subject: [PATCH 03/10] FIX #20476 migration postgresql 13.0.x to 14.0.x packaging type Taken from ff35bf8d47650b453f7224ced7857e2bbc53ecd5 --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 0b6d36d6743..a1b6a210a5b 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -85,7 +85,8 @@ UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'c DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', 'amarok', 'cameleo'); ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging real DEFAULT NULL; -ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL; +-- VMYSQL4.3 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL; +-- VPGSQL8.2 ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL USING packaging::real; -- For v14 From 56a8912c9b59cbe22487c78da1c967d3243ba9f9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jul 2022 19:47:59 +0200 Subject: [PATCH 04/10] Fix do not erase global option when configuring ticket --- htdocs/admin/ticket_public.php | 3 ++- htdocs/langs/en_US/admin.lang | 2 +- htdocs/public/ticket/create_ticket.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 0fd654b5d28..fdb3117423b 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -183,7 +183,8 @@ if ($action == 'setTICKET_ENABLE_PUBLIC_INTERFACE') { } // enable captcha by default - $res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA', 1, 'chaine', 0, '', $conf->entity); + // TODO Add a visible option in this setup page for this + $res = dolibarr_set_const($db, 'MAIN_SECURITY_ENABLECAPTCHA_TICKET', 1, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { $error++; $errors[] = $db->lasterror(); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fa6fa693bb0..13e5fde204c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -109,7 +109,7 @@ NextValueForReplacements=Next value (replacements) MustBeLowerThanPHPLimit=Note: your PHP configuration currently limits the maximum filesize for upload to %s %s, irrespective of the value of this parameter NoMaxSizeByPHPLimit=Note: No limit is set in your PHP configuration MaxSizeForUploadedFiles=Maximum size for uploaded files (0 to disallow any upload) -UseCaptchaCode=Use graphical code (CAPTCHA) on login page +UseCaptchaCode=Use graphical code (CAPTCHA) on login page and some public pages AntiVirusCommand=Full path to antivirus command AntiVirusCommandExample=Example for ClamAv Daemon (require clamav-daemon): /usr/bin/clamdscan
Example for ClamWin (very very slow): c:\\Progra~1\\ClamWin\\bin\\clamscan.exe AntiVirusParam= More parameters on command line diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index f7e6e023a7f..1c302c33b2e 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -209,7 +209,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { } // Check Captcha code if is enabled - if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { + if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA) || !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA_TICKET)) { $sessionkey = 'dol_antispam_value'; $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) === strtolower(GETPOST('code', 'restricthtml')))); if (!$ok) { From 7275ac1511d4ed868fa7b046e091f0ae66df4d84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Jul 2022 20:14:25 +0200 Subject: [PATCH 05/10] Trans --- htdocs/categories/viewcat.php | 2 +- htdocs/langs/en_US/categories.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 7d12f571c06..238329a3486 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -1047,7 +1047,7 @@ if ($type == Categorie::TYPE_USER) { print ''; print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 62c2752ff9f..1b39825d4ac 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -100,3 +100,4 @@ ActionCommCategoriesArea=Event Categories WebsitePagesCategoriesArea=Page-Container Categories KnowledgemanagementsCategoriesArea=KM article Categories UseOrOperatorForCategories=Use 'OR' operator for categories +AddObjectIntoCategory=Add object into category From 3af167db6c656d144ade2d84eca2b6c0f9beb7a5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 23 Jul 2022 13:54:07 +0200 Subject: [PATCH 06/10] fix: #21553, fourn prod Id is required to find emballage value --- htdocs/fourn/commande/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 35e5257fce0..8a3a303c522 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -590,7 +590,7 @@ if (empty($reshook)) { $localtax1_tx, $localtax2_tx, $idprod, - 0, // We already have the $idprod always defined + $productsupplier->product_fourn_price_id, $ref_supplier, $remise_percent, $price_base_type, From da519f3ab583378b61a2ff8de83fb0963dc31434 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 23 Jul 2022 23:55:57 +0200 Subject: [PATCH 07/10] Fix bad constructor --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3212766a573..222bc55e7b8 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1871,7 +1871,7 @@ class CommandeFournisseur extends CommonOrder // Predefine quantity according to packaging if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $prod = new Product($this->db, $fk_product); + $prod = new Product($this->db); $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); if ($qty < $prod->packaging) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index df10ed07632..2c6bb846db6 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2074,7 +2074,7 @@ class FactureFournisseur extends CommonInvoice if (!empty($conf->global->SUPPLIER_INVOICE_WITH_PREDEFINED_PRICES_ONLY)) { // Check quantity is enough dol_syslog(get_class($this)."::addline we check supplier prices fk_product=".$fk_product." qty=".$qty." ref_supplier=".$ref_supplier); - $prod = new Product($this->db, $fk_product); + $prod = new Product($this->db); if ($prod->fetch($fk_product) > 0) { $product_type = $prod->type; $label = $prod->label; From 274b0ff6b8828c701a645be72d91ed77c04c43f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jul 2022 00:01:03 +0200 Subject: [PATCH 08/10] Remove useless test --- htdocs/product/class/product.class.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 01d401e384d..d0a51c3d9de 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1933,10 +1933,8 @@ class Product extends CommonObject $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.remise_percent,"; $sql .= " pfp.fk_product, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_soc, pfp.tva_tx, pfp.fk_supplier_price_expression,"; $sql .= " pfp.default_vat_code,"; - $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { - $sql .= ", pfp.packaging"; - } + $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,"; + $sql .= " pfp.packaging"; $sql .= " FROM ".$this->db->prefix()."product_fournisseur_price as pfp"; $sql .= " WHERE pfp.rowid = ".((int) $prodfournprice); if ($qty > 0) { From c7fd9f5a3aa005f5dd875da26a8dd6b3cb82d2e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jul 2022 10:57:46 +0200 Subject: [PATCH 09/10] Trans --- htdocs/install/mysql/migration/repair.sql | 13 +++++++++---- htdocs/langs/en_US/accountancy.lang | 2 +- htdocs/langs/fr_FR/accountancy.lang | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 4add688b880..1cf808d9dd9 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -270,7 +270,7 @@ update llx_product set barcode = null where barcode in ('', '-1', '0'); update llx_societe set barcode = null where barcode in ('', '-1', '0'); --- Sequence to removed duplicated values of llx_links. Use several times if you still have duplicate. +-- Sequence to removed duplicated values of llx_links. Run several times if you still have duplicate. drop table tmp_links_double; --select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2; create table tmp_links_double as (select objectid, label, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_links where label is not null group by objectid, label having count(rowid) >= 2); @@ -279,7 +279,7 @@ delete from llx_links where (rowid, label) in (select max_rowid, label from tmp_ drop table tmp_links_double; --- Sequence to removed duplicated values of barcode in llx_product. Use several times if you still have duplicate. +-- Sequence to removed duplicated values of barcode in llx_product. Run several times if you still have duplicate. drop table tmp_product_double; --select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2; create table tmp_product_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_product where barcode is not null group by barcode having count(rowid) >= 2); @@ -288,7 +288,7 @@ update llx_product set barcode = null where (rowid, barcode) in (select max_rowi drop table tmp_product_double; --- Sequence to removed duplicated values of barcode in llx_societe. Use several times if you still have duplicate. +-- Sequence to removed duplicated values of barcode in llx_societe. Run several times if you still have duplicate. drop table tmp_societe_double; --select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2; create table tmp_societe_double as (select barcode, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_societe where barcode is not null group by barcode having count(rowid) >= 2); @@ -297,7 +297,7 @@ update llx_societe set barcode = null where (rowid, barcode) in (select max_rowi drop table tmp_societe_double; --- Sequence to removed duplicated values of llx_accounting_account. Use several times if you still have duplicate. +-- Sequence to removed duplicated values of llx_accounting_account. Run several times if you still have duplicate. drop table tmp_accounting_account_double; --select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2; create table tmp_accounting_account_double as (select account_number, fk_pcg_version, max(rowid) as max_rowid, count(rowid) as count_rowid from llx_accounting_account where label is not null group by account_number, fk_pcg_version having count(rowid) >= 2); @@ -415,6 +415,11 @@ ALTER TABLE llx_accounting_account DROP INDEX uk_accounting_account; ALTER TABLE llx_accounting_account ADD UNIQUE INDEX uk_accounting_account (account_number, entity, fk_pcg_version); +UPDATE llx_facturedet SET fk_code_ventilation = 0 WHERE fk_code_ventilation > 0 AND fk_code_ventilation NOT IN (select rowid FROM llx_accounting_account); +UPDATE llx_facture_fourn_det SET fk_code_ventilation = 0 WHERE fk_code_ventilation > 0 AND fk_code_ventilation NOT IN (select rowid FROM llx_accounting_account); +UPDATE llx_expensereport_det SET fk_code_ventilation = 0 WHERE fk_code_ventilation > 0 AND fk_code_ventilation NOT IN (select rowid FROM llx_accounting_account); + + -- VMYSQL4.1 update llx_projet_task_time set task_datehour = task_date where task_datehour < task_date or task_datehour > DATE_ADD(task_date, interval 1 day); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index b059cc9952a..fcdbca76d5c 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -279,7 +279,7 @@ DescVentilExpenseReportMore=If you setup accounting account on type of expense r DescVentilDoneExpenseReport=Consult here the list of the lines of expenses reports and their fees accounting account Closure=Annual closure -DescClosure=Consult here the number of movements by month who are not yet validated & locked +DescClosure=Consult here the number of movements by month not yet validated & locked OverviewOfMovementsNotValidated=Overview of movements not validated and locked AllMovementsWereRecordedAsValidated=All movements were recorded as validated and locked NotAllMovementsCouldBeRecordedAsValidated=Not all movements could be recorded as validated and locked diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 190905c760d..80454f73215 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -279,7 +279,7 @@ DescVentilExpenseReportMore=Si vous avez défini des comptes comptables au nivea DescVentilDoneExpenseReport=Consultez ici la liste des lignes des notes de frais et leur compte comptable Closure=Clôture annuelle -DescClosure=Consulter le nombre de mouvements par mois non validés et les périodes fiscales déjà ouvertes +DescClosure=Consulter le nombre de mouvements par mois non validés et vérrouillés OverviewOfMovementsNotValidated=Aperçu des mouvements non validés et verrouillés AllMovementsWereRecordedAsValidated=Tous les mouvements ont été enregistrés comme validés et ont été verrouillés NotAllMovementsCouldBeRecordedAsValidated=Certains mouvements n'ont pas pu être enregistrés comme validés et n'ont pas été verrouillés From e9c42bf715de8aa5b77ebc817e4f63d9f12ead13 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 24 Jul 2022 11:09:59 +0200 Subject: [PATCH 10/10] Add option ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE Conflicts: htdocs/accountancy/bookkeeping/list.php --- htdocs/accountancy/bookkeeping/list.php | 22 ++++----- .../accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/accountancy/closure/index.php | 45 ++++++++++++++----- 3 files changed, 46 insertions(+), 23 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 4bc6d50de89..8b8620f123d 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -197,7 +197,7 @@ $arrayfields = array( 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0), 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), - 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1), + 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), ); @@ -769,16 +769,18 @@ if ($action == 'export_file') { $form_question['separator'] = array('name'=>'separator', 'type'=>'separator'); - // If 0 or not set, we NOT check by default. - $checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE)); - $form_question['notifiedvalidationdate'] = array( - 'name' => 'notifiedvalidationdate', - 'type' => 'checkbox', - 'label' => $langs->trans('NotifiedValidationDate'), - 'value' => $checked, - ); + if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { + // If 0 or not set, we NOT check by default. + $checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE)); + $form_question['notifiedvalidationdate'] = array( + 'name' => 'notifiedvalidationdate', + 'type' => 'checkbox', + 'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")), + 'value' => $checked, + ); - $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator'); + $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator'); + } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600); } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index d638a7c0c84..bb864fc39e3 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -166,7 +166,7 @@ $arrayfields = array( 't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1), 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1), 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1), - 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1), + 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")), 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100), ); diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index f02eda61bf6..a1d75440b56 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -112,6 +112,7 @@ if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting- } } + /* * View */ @@ -178,20 +179,40 @@ for ($i = 1; $i <= 12; $i++) { } print ''; -$sql = "SELECT COUNT(b.rowid) as detail,"; -for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; - if ($j > 12) { - $j -= 12; +if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { + // TODO Analyse is done by finding record not into a closed period + $sql = "SELECT COUNT(b.rowid) as detail,"; + for ($i = 1; $i <= 12; $i++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + if ($j > 12) { + $j -= 12; + } + $sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).","; } - $sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).","; + $sql .= " COUNT(b.rowid) as total"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; + $sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'"; + $sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'"; + $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy + // Loop on each closed period + $sql .= " AND b.doc_date BETWEEN 0 AND 0"; +} else { + // Analyse closed record using the unitary flag/date on each record + $sql = "SELECT COUNT(b.rowid) as detail,"; + for ($i = 1; $i <= 12; $i++) { + $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + if ($j > 12) { + $j -= 12; + } + $sql .= " SUM(".$db->ifsql("MONTH(b.doc_date)=".$j, "1", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).","; + } + $sql .= " COUNT(b.rowid) as total"; + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; + $sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'"; + $sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'"; + $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy + $sql .= " AND date_validated IS NULL"; } -$sql .= " COUNT(b.rowid) as total"; -$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; -$sql .= " WHERE b.doc_date >= '".$db->idate($search_date_start)."'"; -$sql .= " AND b.doc_date <= '".$db->idate($search_date_end)."'"; -$sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy -$sql .= " AND date_validated IS NULL"; dol_syslog('htdocs/accountancy/closure/index.php', LOG_DEBUG); $resql = $db->query($sql);
'; - print $langs->trans("AddProjectIntoCategory").'  '; + print $langs->trans("AddObjectIntoCategory").'  '; print $form->select_dolusers('', 'elemid'); print '
'.$langs->trans("Total").'