From 6814488d86cf2435aaa335a5143f697771289f7d Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 00:51:19 +0200 Subject: [PATCH 01/64] Update list.php --- htdocs/commande/list.php | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index db6bba130b1..d345bd033be 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -274,7 +274,15 @@ if (empty($reshook)) { $objectclass = 'Commande'; $objectlabel = 'Orders'; $permissiontoread = $user->rights->commande->lire; + $permissiontoadd = $user->rights->commande->creer; $permissiontodelete = $user->rights->commande->supprimer; + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)){ + $permissiontovalidate = $user->rights->commande->order_advance->validate; + $permissiontoclose = $user->rights->commande->order_advance->close; + }else{ + $permissiontovalidate = $user->rights->commande->creer; + $permissiontoclose = $user->rights->commande->creer; + } $uploaddir = $conf->commande->multidir_output[$conf->entity]; $triggersendname = 'ORDER_SENTBYMAIL'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -700,16 +708,21 @@ if ($resql) { // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>$langs->trans("ReGeneratePDF"), - 'builddoc'=>$langs->trans("PDFMerge"), - 'cancelorders'=>$langs->trans("Cancel"), - 'presend'=>$langs->trans("SendByMail"), + 'generate_doc'=>img_picto('', 'pdf').' '.$langs->trans("ReGeneratePDF"), + 'builddoc'=>img_picto('', 'pdf').' '.$langs->trans("PDFMerge"), + 'cancelorders'=>img_picto('', 'close_title').' '.$langs->trans("Cancel"), + 'presend'=>img_picto('', 'email').' '.$langs->trans("SendByMail"), ); if ($user->rights->facture->creer) { - $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisCustomer"); + $arrayofmassactions['createbills'] = img_picto('', 'bill').' '.$langs->trans("CreateInvoiceForThisCustomer"); } - if ($user->rights->commande->supprimer) { - $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); + if ($conf->global->MAIN_FEATURES_LEVEL == '2'){ //BB2A + if ($permissiontoclose) { + $arrayofmassactions['setbilled'] = img_picto('', 'bill').' '.$langs->trans("ClassifyBilled"); + } + } + if ($permissiontodelete) { + $arrayofmassactions['predelete'] = img_picto('', 'delete').' '.$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { $arrayofmassactions = array(); @@ -720,7 +733,7 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $user->rights->commande->creer); + $newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $permissiontoadd); // Lines of title fields print '
'; @@ -1740,8 +1753,8 @@ if ($resql) { $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; - $genallowed = $user->rights->commande->lire; - $delallowed = $user->rights->commande->creer; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; print $formfile->showdocuments('massfilesarea_orders', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } else { From 25ac8bed68b3b512d68c54e5686b223ec0dde8e7 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 01:54:30 +0200 Subject: [PATCH 02/64] Update list.php --- htdocs/commande/list.php | 86 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index d345bd033be..4c1a06a9a5d 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2021 Anthony Berton * * 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 @@ -279,15 +280,83 @@ if (empty($reshook)) { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)){ $permissiontovalidate = $user->rights->commande->order_advance->validate; $permissiontoclose = $user->rights->commande->order_advance->close; + $permissiontocancel = $user->rights->commande->order_advance->annuler; + $permissiontosendbymail = $user->rights->commande->order_advance->send; }else{ $permissiontovalidate = $user->rights->commande->creer; $permissiontoclose = $user->rights->commande->creer; + $permissiontocancel = $user->rights->commande->creer; + $permissiontosendbymail = $user->rights->commande->creer; } $uploaddir = $conf->commande->multidir_output[$conf->entity]; $triggersendname = 'ORDER_SENTBYMAIL'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } +if ($action == 'validate' && $permissiontoadd) { + if (GETPOST('confirm') == 'yes') { + $objecttmp = new $objectclass($db); + $db->begin(); + $error = 0; + foreach ($toselect as $checked) { + if ($objecttmp->fetch($checked)) { + if ($objecttmp->statut == 0) { + if ($objecttmp->valid($user)) { + setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); + } else { + setEventMessage($langs->trans('CantBeValidated'), 'errors'); + $error++; + } + } else { + setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors'); + $error++; + } + }else{ + dol_print_error($db); + $error++; + } + } + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } +} +// Closed records +if (!$error && $massaction === 'setbilled' && $permissiontoclose) { + $db->begin(); + $objecttmp = new $objectclass($db); + $nbok = 0; + foreach ($toselect as $toselectid) { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + $result = $objecttmp->classifyBilled($user, 0); + if ($result <= 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } else { + $nbok++; + } + } else { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (!$error) { + if ($nbok > 1) { + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + } else { + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + } + $db->commit(); + } else { + $db->rollback(); + } +} /* * View @@ -710,9 +779,18 @@ if ($resql) { $arrayofmassactions = array( 'generate_doc'=>img_picto('', 'pdf').' '.$langs->trans("ReGeneratePDF"), 'builddoc'=>img_picto('', 'pdf').' '.$langs->trans("PDFMerge"), - 'cancelorders'=>img_picto('', 'close_title').' '.$langs->trans("Cancel"), - 'presend'=>img_picto('', 'email').' '.$langs->trans("SendByMail"), ); + if ($conf->global->MAIN_FEATURES_LEVEL == '2'){ //BB2A + if ($permissiontovalidate) { + $arrayofmassactions['prevalidate'] = img_picto('', 'check').' '.$langs->trans("Validate"); + } + } + if ($permissiontosendbymail) { + $arrayofmassactions['presend'] = img_picto('', 'email').' '.$langs->trans("SendByMail"); + } + if ($permissiontocancel) { + $arrayofmassactions['cancelorders'] = img_picto('', 'close_title').' '.$langs->trans("Cancel"); + } if ($user->rights->facture->creer) { $arrayofmassactions['createbills'] = img_picto('', 'bill').' '.$langs->trans("CreateInvoiceForThisCustomer"); } @@ -757,6 +835,10 @@ if ($resql) { $trackid = 'ord'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($massaction == 'prevalidate') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); + } + if ($massaction == 'createbills') { //var_dump($_REQUEST); print ''; From 92ca59d20b2d51bfc2e0f6510dbb03799f28008c Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Wed, 14 Apr 2021 02:23:23 +0200 Subject: [PATCH 03/64] Update list.php --- htdocs/commande/list.php | 55 +++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4c1a06a9a5d..78adb797b88 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -300,7 +300,42 @@ if ($action == 'validate' && $permissiontoadd) { foreach ($toselect as $checked) { if ($objecttmp->fetch($checked)) { if ($objecttmp->statut == 0) { - if ($objecttmp->valid($user)) { + if (!empty($objecttmp->fk_warehouse)){ + $idwarehouse = $objecttmp->fk_warehouse; + }else{ + $idwarehouse = 0; + } + if ($objecttmp->valid($user, $idwarehouse)) { + setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); + } else { + setEventMessage($langs->trans('CantBeValidated'), 'errors'); + $error++; + } + } else { + setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors'); + $error++; + } + }else{ + dol_print_error($db); + $error++; + } + } + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } +} +if ($action == 'shipped' && $permissiontoadd) { + if (GETPOST('confirm') == 'yes') { + $objecttmp = new $objectclass($db); + $db->begin(); + $error = 0; + foreach ($toselect as $checked) { + if ($objecttmp->fetch($checked)) { + if ($objecttmp->statut == 1) { + if ($objecttmp->cloture($user)) { setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); } else { setEventMessage($langs->trans('CantBeValidated'), 'errors'); @@ -780,24 +815,23 @@ if ($resql) { 'generate_doc'=>img_picto('', 'pdf').' '.$langs->trans("ReGeneratePDF"), 'builddoc'=>img_picto('', 'pdf').' '.$langs->trans("PDFMerge"), ); - if ($conf->global->MAIN_FEATURES_LEVEL == '2'){ //BB2A - if ($permissiontovalidate) { - $arrayofmassactions['prevalidate'] = img_picto('', 'check').' '.$langs->trans("Validate"); - } + if ($permissiontovalidate) { + $arrayofmassactions['prevalidate'] = img_picto('', 'check').' '.$langs->trans("Validate"); } if ($permissiontosendbymail) { $arrayofmassactions['presend'] = img_picto('', 'email').' '.$langs->trans("SendByMail"); } + if ($permissiontoclose) { + $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert').' '.$langs->trans("ClassifyShipped"); + } if ($permissiontocancel) { $arrayofmassactions['cancelorders'] = img_picto('', 'close_title').' '.$langs->trans("Cancel"); } if ($user->rights->facture->creer) { $arrayofmassactions['createbills'] = img_picto('', 'bill').' '.$langs->trans("CreateInvoiceForThisCustomer"); } - if ($conf->global->MAIN_FEATURES_LEVEL == '2'){ //BB2A - if ($permissiontoclose) { - $arrayofmassactions['setbilled'] = img_picto('', 'bill').' '.$langs->trans("ClassifyBilled"); - } + if ($permissiontoclose) { + $arrayofmassactions['setbilled'] = img_picto('', 'bill').' '.$langs->trans("ClassifyBilled"); } if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete').' '.$langs->trans("Delete"); @@ -838,6 +872,9 @@ if ($resql) { if ($massaction == 'prevalidate') { print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); } + if ($massaction == 'preshipped') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("CloseOrder"), $langs->trans("ConfirmCloseOrder"), "shipped", null, '', 0, 200, 500, 1); + } if ($massaction == 'createbills') { //var_dump($_REQUEST); From 632487921506e589004ebb769b25bad36a7a6db2 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 14 Apr 2021 00:25:05 +0000 Subject: [PATCH 04/64] Fixing style errors. --- htdocs/commande/list.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 78adb797b88..954c0e95a6d 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -277,12 +277,12 @@ if (empty($reshook)) { $permissiontoread = $user->rights->commande->lire; $permissiontoadd = $user->rights->commande->creer; $permissiontodelete = $user->rights->commande->supprimer; - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)){ + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $permissiontovalidate = $user->rights->commande->order_advance->validate; $permissiontoclose = $user->rights->commande->order_advance->close; $permissiontocancel = $user->rights->commande->order_advance->annuler; $permissiontosendbymail = $user->rights->commande->order_advance->send; - }else{ + } else { $permissiontovalidate = $user->rights->commande->creer; $permissiontoclose = $user->rights->commande->creer; $permissiontocancel = $user->rights->commande->creer; @@ -300,9 +300,9 @@ if ($action == 'validate' && $permissiontoadd) { foreach ($toselect as $checked) { if ($objecttmp->fetch($checked)) { if ($objecttmp->statut == 0) { - if (!empty($objecttmp->fk_warehouse)){ + if (!empty($objecttmp->fk_warehouse)) { $idwarehouse = $objecttmp->fk_warehouse; - }else{ + } else { $idwarehouse = 0; } if ($objecttmp->valid($user, $idwarehouse)) { @@ -315,7 +315,7 @@ if ($action == 'validate' && $permissiontoadd) { setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors'); $error++; } - }else{ + } else { dol_print_error($db); $error++; } @@ -345,7 +345,7 @@ if ($action == 'shipped' && $permissiontoadd) { setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors'); $error++; } - }else{ + } else { dol_print_error($db); $error++; } From 2f31720896b94ac235e9a4ad7082959a0cdf6c79 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 14 Apr 2021 04:45:17 +0200 Subject: [PATCH 05/64] Maxi debug of societe/product per entity --- htdocs/accountancy/admin/productaccount.php | 12 +-- htdocs/accountancy/customer/card.php | 4 +- htdocs/accountancy/customer/index.php | 12 +-- htdocs/accountancy/customer/lines.php | 6 +- htdocs/accountancy/customer/list.php | 16 ++-- .../accountancy/journal/purchasesjournal.php | 10 ++- htdocs/accountancy/journal/sellsjournal.php | 4 +- htdocs/accountancy/supplier/card.php | 12 ++- htdocs/accountancy/supplier/index.php | 29 ++++++-- htdocs/accountancy/supplier/lines.php | 17 ++++- htdocs/accountancy/supplier/list.php | 14 ++-- htdocs/compta/journal/sellsjournal.php | 4 +- htdocs/core/modules/modFacture.class.php | 4 +- htdocs/core/modules/modProduct.class.php | 6 +- htdocs/core/modules/modService.class.php | 4 +- htdocs/product/class/product.class.php | 8 +- htdocs/product/list.php | 8 +- htdocs/societe/class/societe.class.php | 73 ++++++++++++++++--- 18 files changed, 170 insertions(+), 73 deletions(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 2013b0c7295..dd60c33a2e6 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -270,8 +270,8 @@ if (empty($pcgvercode)) { $sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.tva_tx,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,"; - $sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,"; + $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; + $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; } else { $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; @@ -280,14 +280,14 @@ $sql .= " p.tms, p.fk_product_type as product_type,"; $sql .= " aa.rowid as aaid"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = pa." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ppe." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; } else { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = p." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; } $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; if (strlen(trim($search_current_account))) { - $sql .= natural_search((empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "pa.") . $accountancy_field_name, $search_current_account); + $sql .= natural_search((empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, $search_current_account); } if ($search_current_account_valid == 'withoutvalidaccount') { $sql .= " AND aa.account_number IS NULL"; @@ -466,7 +466,7 @@ if ($result) { } else { print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center '); } - print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "pa.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AssignDedicatedAccountingAccount"); $clickpitco = $form->showCheckAddButtons('checkforselect', 1); print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center '); diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index f0bcd9f7a49..b3ce892b235 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -102,7 +102,7 @@ if (!empty($id)) { $sql = "SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,"; $sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell as code_sell,"; + $sql .= " ppe.accountancy_code_sell as code_sell,"; } else { $sql .= " p.accountancy_code_sell as code_sell,"; } @@ -110,7 +110,7 @@ if (!empty($id)) { $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = l.fk_facture"; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 0b32e2802c4..755d03bbb3a 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -126,15 +126,15 @@ if ($action == 'validatehistory') { $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,"; + $sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,"; } else { $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; } $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,"; $sql .= " co.code as country_code, co.label as country_label,"; $sql .= " s.tva_intra,"; - if (!empty($conf->global->ACCOUNTANCY_COMPANY_SHARED)) { - $sql .= " sa.accountancy_code_sell as company_code_sell"; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " spe.accountancy_code_sell as company_code_sell"; } else { $sql .= " s.accountancy_code_sell as company_code_sell"; } @@ -145,10 +145,10 @@ if ($action == 'validatehistory') { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } - $alias_societe_perentity = empty($conf->global->ACCOUNTANCY_COMPANY_SHARED) ? "s" : "sa"; - $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; + $alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 6f522750398..b8cc34c3cae 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -184,9 +184,9 @@ $sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, f $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell,"; + $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; } else { - $sql .= " p.accountancy_code_sell,"; + $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; } $sql .= " aa.rowid as fk_compte, aa.account_number, aa.label as label_account, aa.labelshort as labelshort_account,"; $sql .= " fd.situation_percent,"; @@ -198,7 +198,7 @@ $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index de160fe2b93..4052ed51fdd 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -219,8 +219,8 @@ $sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype,"; $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,"; - $sql .= " pa.accountancy_code_buy as code_buy, pa.accountancy_code_buy_intra as code_buy_intra, pa.accountancy_code_buy_export as code_buy_export,"; + $sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,"; + $sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,"; } else { $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,"; @@ -229,8 +229,8 @@ $sql .= " p.tosell as status, p.tobuy as status_buy,"; $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,"; $sql .= " co.code as country_code, co.label as country_label,"; $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,"; -if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " sa.accountancy_code_sell as company_code_sell"; +if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " spe.accountancy_code_sell as company_code_sell"; } else { $sql .= " s.accountancy_code_sell as company_code_sell"; } @@ -240,16 +240,16 @@ $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as sa ON sa.fk_soc = s.rowid AND sa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } -$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "sa"; -$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; +$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe"; +$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index bf950182798..018cba4ca89 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -106,9 +106,17 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)) $sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; -$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; +if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " ppe.accountancy_code_buy,"; +} else { + $sql .= " p.accountancy_code_buy,"; +} +$sql .= " aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; +if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); +} $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 1904631775d..a9b6f17a9bd 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -110,14 +110,14 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tot $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell"; + $sql .= " ppe.accountancy_code_sell"; } else { $sql .= " p.accountancy_code_sell"; } $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index cd17df33776..1e7887c1bdc 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -101,10 +101,18 @@ $formaccounting = new FormAccounting($db); if (!empty($id)) { $sql = "SELECT f.ref as ref, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, "; - $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label"; - $sql .= ", aa.account_number, aa.label"; + $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label,"; + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " ppe.accountancy_code_buy as code_buy,"; + } else { + $sql .= " p.accountancy_code_buy as code_buy,"; + } + $sql .= " aa.account_number, aa.label"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); + } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn "; $sql .= " WHERE f.fk_statut > 0 AND l.rowid = ".((int) $id); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 392551708de..ff09479ad03 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -132,20 +132,35 @@ if ($action == 'validatehistory') { // Supplier Invoice Lines (must be same request than into page list.php for manual binding) $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,"; $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; - $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,"; - $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,"; + $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,"; + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,"; + } else { + $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,"; + } $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,"; $sql .= " co.code as country_code, co.label as country_label,"; - $sql .= " s.tva_intra, s.accountancy_code_buy as company_code_buy"; + $sql .= " s.tva_intra,"; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " spe.accountancy_code_buy as company_code_buy"; + } else { + $sql .= " s.accountancy_code_buy as company_code_buy"; + } + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); + } + $alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 1f81a5d7e2c..deed1299fd5 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2013-2021 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -94,6 +94,9 @@ if (empty($user->rights->accounting->mouvements->lire)) { } +$formaccounting = new FormAccounting($db); + + /* * Actions */ @@ -116,7 +119,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_tvaintra = ''; } -if (is_array($changeaccount) && count($changeaccount) > 0) { +if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) { $error = 0; if (!(GETPOST('account_parent', 'int') >= 0)) { @@ -124,7 +127,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); } - if (!$error) { $db->begin(); @@ -184,7 +186,11 @@ $sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invo $sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,"; $sql .= " aa.label, aa.labelshort, aa.account_number,"; $sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,"; -$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; +if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; +} else { + $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; +} $sql .= " co.code as country_code, co.label as country,"; $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $parameters = array(); @@ -192,6 +198,9 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; +if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); +} $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = l.fk_code_ventilation"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 1dcd17ea074..f70ae669204 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -224,8 +224,8 @@ $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_lab $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,"; - $sql .= " pa.accountancy_code_buy as code_buy, pa.accountancy_code_buy_intra as code_buy_intra, pa.accountancy_code_buy_export as code_buy_export,"; + $sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,"; + $sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,"; } else { $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,"; @@ -235,7 +235,7 @@ $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_ $sql .= " co.code as country_code, co.label as country_label,"; $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= " sa.accountancy_code_buy as company_code_buy"; + $sql .= " spe.accountancy_code_buy as company_code_buy"; } else { $sql .= " s.accountancy_code_buy as company_code_buy"; } @@ -245,16 +245,16 @@ $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as sa ON sa.fk_soc = s.rowid AND sa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } -$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "sa"; -$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; +$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe"; +$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 9fa4168ea0a..367ffffbdea 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -113,7 +113,7 @@ $sql .= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, f $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; $sql .= " p.rowid as pid, p.ref as pref,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell,"; + $sql .= " ppe.accountancy_code_sell,"; } else { $sql .= " p.accountancy_code_sell,"; } @@ -121,7 +121,7 @@ $sql .= " ct.accountancy_code_sell as account_tva, ct.recuperableonly"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index d1ad993af68..9cc05e5d6f2 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -207,7 +207,7 @@ class modFacture extends DolibarrModules //-------- $r = 1; - $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r] = 'invoice'; @@ -296,7 +296,7 @@ class modFacture extends DolibarrModules $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet_extrafields as extra2 on fd.rowid = extra2.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; $this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index fd1c7cceca0..344af868b69 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -176,7 +176,7 @@ class modProduct extends DolibarrModules //-------- $r = 0; - $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; @@ -296,7 +296,7 @@ class modProduct extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; @@ -447,7 +447,7 @@ class modProduct extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2'; diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 3b21cf046c8..40bb2667741 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -143,7 +143,7 @@ class modService extends DolibarrModules //-------- $r = 0; - $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; @@ -259,7 +259,7 @@ class modService extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 16bbc508ac9..224f03fdda1 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -725,6 +725,8 @@ class Product extends CommonObject // update accountancy for this entity if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $this->db->query("DELETE FROM " . MAIN_DB_PREFIX . "product_perentity WHERE fk_product = " . $this->id . " AND entity = " . $conf->entity); + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity ("; $sql .= " fk_product"; $sql .= ", entity"; @@ -2168,13 +2170,13 @@ class Product extends CommonObject if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; } else { - $sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export, pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,"; + $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export, ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; } $sql .= " p.stock,p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.fk_unit,"; $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } if ($id) { $sql .= " WHERE p.rowid = ".((int) $id); @@ -2256,7 +2258,7 @@ class Product extends CommonObject $this->barcode_type = $obj->fk_barcode_type; $this->accountancy_code_buy = $obj->accountancy_code_buy; - $this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra; + $this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra; $this->accountancy_code_buy_export = $obj->accountancy_code_buy_export; $this->accountancy_code_sell = $obj->accountancy_code_sell; $this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index dc035187f30..e649179bb5e 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -191,7 +191,7 @@ if (empty($conf->global->PRODUIT_MULTIPRICES)) { $isInEEC = isInEEC($mysoc); -$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; +$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; // Definition of fields for lists $arrayfields = array( @@ -364,7 +364,7 @@ $sql .= ' p.tobatch,'; if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; } else { - $sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export, pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,"; + $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; } $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock, p.cost_price,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, fk_country, fk_state,'; @@ -387,7 +387,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)"; @@ -523,7 +523,7 @@ $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.pmp, p.cost_price, p.stock,'; if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; } else { - $sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export, pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,"; + $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; } $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.fk_country, p.fk_state'; if (!empty($conf->global->PRODUCT_USE_UNITS)) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9d449922dd2..29e125de321 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -879,8 +879,10 @@ class Societe extends CommonObject $sql .= ", import_key"; $sql .= ", fk_multicurrency"; $sql .= ", multicurrency_code"; - $sql .= ", accountancy_code_buy"; - $sql .= ", accountancy_code_sell"; + if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ", accountancy_code_buy"; + $sql .= ", accountancy_code_sell"; + } $sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".$this->db->escape($this->entity).", '".$this->db->idate($now)."'"; $sql .= ", ".(!empty($user->id) ? ((int) $user->id) : "null"); $sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null"); @@ -893,8 +895,10 @@ class Societe extends CommonObject $sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= ", ".(int) $this->fk_multicurrency; $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; - $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; - $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; + if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; + $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; + } $sql .= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -904,6 +908,28 @@ class Societe extends CommonObject $ret = $this->update($this->id, $user, 0, 1, 1, 'add'); + // update accountancy for this entity + if (!$error && !empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $this->db->query("DELETE FROM " . MAIN_DB_PREFIX . "societe_perentity WHERE fk_soc = " . $this->id . " AND entity = " . $conf->entity); + + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_perentity ("; + $sql .= " fk_soc"; + $sql .= ", entity"; + $sql .= ", accountancy_code_buy"; + $sql .= ", accountancy_code_sell"; + $sql .= ") VALUES ("; + $sql .= $this->id; + $sql .= ", " . $conf->entity; + $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; + $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; + $sql .= ")"; + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->error = 'ErrorFailedToUpdateAccountancyForEntity'; + } + } + // Ajout du commercial affecte if ($this->commercial_id != '' && $this->commercial_id != -1) { $this->add_commercial($user, $this->commercial_id); @@ -1414,10 +1440,10 @@ class Societe extends CommonObject $sql .= ",order_min_amount= ".($this->order_min_amount != '' ? $this->order_min_amount : 'null'); $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null'); $sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'"; - - $sql.= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy)."'"; - $sql.= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell)."'"; - + if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; + $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; + } $sql .= ",webservices_url = ".(!empty($this->webservices_url) ? "'".$this->db->escape($this->webservices_url)."'" : "null"); $sql .= ",webservices_key = ".(!empty($this->webservices_key) ? "'".$this->db->escape($this->webservices_key)."'" : "null"); @@ -1499,6 +1525,28 @@ class Societe extends CommonObject $action = 'update'; + // update accountancy for this entity + if (!$error && !empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $this->db->query("DELETE FROM " . MAIN_DB_PREFIX . "societe_perentity WHERE fk_soc = " . $this->id . " AND entity = " . $conf->entity); + + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_perentity ("; + $sql .= " fk_soc"; + $sql .= ", entity"; + $sql .= ", accountancy_code_buy"; + $sql .= ", accountancy_code_sell"; + $sql .= ") VALUES ("; + $sql .= $this->id; + $sql .= ", " . $conf->entity; + $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; + $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; + $sql .= ")"; + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->error = 'ErrorFailedToUpdateAccountancyForEntity'; + } + } + // Actions on extra fields if (!$error) { $result = $this->insertExtraFields(); @@ -1589,7 +1637,11 @@ class Societe extends CommonObject $sql .= ', s.fk_effectif as effectif_id'; $sql .= ', s.fk_forme_juridique as forme_juridique_code'; $sql .= ', s.webservices_url, s.webservices_key'; - $sql .= ', s.accountancy_code_buy, s.accountancy_code_sell'; + if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ', s.accountancy_code_buy, s.accountancy_code_sell'; + } else { + $sql .= ', spe.accountancy_code_buy, spe.accountancy_code_sell'; + } $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.transport_mode'; $sql .= ', s.fk_account, s.tva_assuj'; @@ -1609,6 +1661,9 @@ class Societe extends CommonObject $sql .= ', i.libelle as label_incoterms'; $sql .= ', sr.remise_client, model_pdf'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); + } $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as e ON s.fk_effectif = e.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id'; From 69fd2cf24ca3bb6a52de1924686d0af25636d14e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 14 Apr 2021 02:50:23 +0000 Subject: [PATCH 06/64] Fixing style errors. --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index e649179bb5e..735c0f6481f 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -523,7 +523,7 @@ $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.pmp, p.cost_price, p.stock,'; if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; } else { - $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; + $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; } $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.fk_country, p.fk_state'; if (!empty($conf->global->PRODUCT_USE_UNITS)) { From 78dbf4f7ffdedb0eaf3b104618cc80536146f4c2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 17 Apr 2021 07:49:19 +0200 Subject: [PATCH 07/64] Split mod fournisseur --- htdocs/comm/action/class/cactioncomm.class.php | 4 ++-- htdocs/comm/index.php | 4 ++-- htdocs/compta/accounting-files.php | 2 +- htdocs/compta/index.php | 2 +- htdocs/contact/consumption.php | 4 ++-- htdocs/core/ajax/selectsearchbox.php | 2 +- htdocs/core/lib/product.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 8483839b944..66586cff4a3 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -201,10 +201,10 @@ class CActionComm if ($obj->module == 'propal' && empty($conf->propal->enabled) && empty($user->propale->lire)) { $qualified = 0; } - if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_invoice->enabled)) && empty($user->fournisseur->facture->lire)) { + if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (empty($conf->supplier_invoice->enabled) && empty($user->rights->supplier_invoice->lire)))) { $qualified = 0; } - if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled)) && empty($user->fournisseur->commande->lire)) { + if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (empty($conf->supplier_order->enabled) && empty($user->rights->supplier_order->lire)))) { $qualified = 0; } if ($obj->module == 'shipping' && empty($conf->expedition->enabled) && empty($user->expedition->lire)) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index a3826fa7dcd..8b763243bf1 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -588,7 +588,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) { /* * Last suppliers */ -if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) { +if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) { $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; @@ -647,7 +647,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU { $s .= ''.dol_substr($langs->trans("Customer"), 0, 1).''; }*/ - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) { + if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) { $s .= ''.dol_substr($langs->trans("Supplier"), 0, 1).''; } print $s; diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 68c73c84090..9ce9dfb6f8b 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -128,7 +128,7 @@ $error = 0; $listofchoices = array( 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => !empty($conf->facture->enabled), 'perms' => !empty($user->rights->facture->lire)), - 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled), 'perms' => !empty($user->rights->fournisseur->facture->lire)), + 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled), 'perms' => (!empty($user->rights->fournisseur->facture->lire) || !empty($user->rights->supplier_invoice->lire)), 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !empty($conf->expensereport->enabled), 'perms' => !empty($user->rights->expensereport->lire)), 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled), 'perms' => !empty($user->rights->don->lire)), 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => !empty($conf->tax->enabled), 'perms' => !empty($user->rights->tax->charges->lire)), diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 4d46f04a136..e208fce3539 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -258,7 +258,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) { // Last modified supplier invoices -if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { +if (((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire))) { $langs->load("boxes"); $facstatic = new FactureFournisseur($db); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index b87a73e8cc2..f421d287299 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -167,10 +167,10 @@ if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) { if ($object->thirdparty->fournisseur) { $thirdTypeArray['supplier'] = $langs->trans("supplier"); - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { + if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) { $elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices'); } - if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { + if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) { $elementTypeArray['supplier_order'] = $langs->transnoentitiesnoconv('SuppliersOrders'); } diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index d10324ef620..5d81f4b250d 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -115,7 +115,7 @@ if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARC if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { +if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire)) { $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); } diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index e8ce515317f..d054c8d5569 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -58,7 +58,7 @@ function product_prepare_head($object) } if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase - if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->lire) + if ((((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire))) || (!empty($conf->margin->enabled) && $user->rights->margin->liretous) ) { $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 7e815523283..5e63dc4d081 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -281,7 +281,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ) ? 1 : 0, 'perms'=>(!empty($user->rights->facture->lire) || !empty($user->rights->don->contact->lire) || !empty($user->rights->tax->charges->lire) || !empty($user->rights->salaries->read) - || !empty($user->rights->fournisseur->facture->lire) || !empty($user->rights->loan->read) || !empty($user->rights->margins->liretous)), + || !empty($user->rights->fournisseur->facture->lire) || !empty($user->rights->supplier_invoice->lire) || !empty($user->rights->loan->read) || !empty($user->rights->margins->liretous)), 'module'=>'facture|supplier_invoice|don|tax|salaries|loan' ); $menu_arr[] = array( From d294bd544d58a4aa6d80671c5a1be7b524576fef Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 19 Apr 2021 22:42:38 +0200 Subject: [PATCH 08/64] Update list.php --- htdocs/commande/list.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 954c0e95a6d..09c8cc3c0b7 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -812,29 +812,29 @@ if ($resql) { // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>img_picto('', 'pdf').' '.$langs->trans("ReGeneratePDF"), - 'builddoc'=>img_picto('', 'pdf').' '.$langs->trans("PDFMerge"), + 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); if ($permissiontovalidate) { - $arrayofmassactions['prevalidate'] = img_picto('', 'check').' '.$langs->trans("Validate"); + $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); } if ($permissiontosendbymail) { - $arrayofmassactions['presend'] = img_picto('', 'email').' '.$langs->trans("SendByMail"); + $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); } if ($permissiontoclose) { - $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert').' '.$langs->trans("ClassifyShipped"); + $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped"); } if ($permissiontocancel) { - $arrayofmassactions['cancelorders'] = img_picto('', 'close_title').' '.$langs->trans("Cancel"); + $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); } if ($user->rights->facture->creer) { - $arrayofmassactions['createbills'] = img_picto('', 'bill').' '.$langs->trans("CreateInvoiceForThisCustomer"); + $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); } if ($permissiontoclose) { - $arrayofmassactions['setbilled'] = img_picto('', 'bill').' '.$langs->trans("ClassifyBilled"); + $arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); } if ($permissiontodelete) { - $arrayofmassactions['predelete'] = img_picto('', 'delete').' '.$langs->trans("Delete"); + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { $arrayofmassactions = array(); From d66540bf001775184275bd2fd966bac8003fa27d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 20 Apr 2021 04:42:51 +0200 Subject: [PATCH 09/64] Revert "Split mod fournisseur" This reverts commit 78dbf4f7ffdedb0eaf3b104618cc80536146f4c2. --- htdocs/comm/action/class/cactioncomm.class.php | 4 ++-- htdocs/comm/index.php | 4 ++-- htdocs/compta/accounting-files.php | 2 +- htdocs/compta/index.php | 2 +- htdocs/contact/consumption.php | 4 ++-- htdocs/core/ajax/selectsearchbox.php | 2 +- htdocs/core/lib/product.lib.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 66586cff4a3..8483839b944 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -201,10 +201,10 @@ class CActionComm if ($obj->module == 'propal' && empty($conf->propal->enabled) && empty($user->propale->lire)) { $qualified = 0; } - if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($user->rights->fournisseur->facture->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (empty($conf->supplier_invoice->enabled) && empty($user->rights->supplier_invoice->lire)))) { + if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_invoice->enabled)) && empty($user->fournisseur->facture->lire)) { $qualified = 0; } - if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($user->rights->fournisseur->commande->lire) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (empty($conf->supplier_order->enabled) && empty($user->rights->supplier_order->lire)))) { + if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled)) && empty($user->fournisseur->commande->lire)) { $qualified = 0; } if ($obj->module == 'shipping' && empty($conf->expedition->enabled) && empty($user->expedition->lire)) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 8b763243bf1..a3826fa7dcd 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -588,7 +588,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) { /* * Last suppliers */ -if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) { +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->societe->lire) { $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; @@ -647,7 +647,7 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S { $s .= ''.dol_substr($langs->trans("Customer"), 0, 1).''; }*/ - if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) { + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $obj->fournisseur) { $s .= ''.dol_substr($langs->trans("Supplier"), 0, 1).''; } print $s; diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 9ce9dfb6f8b..68c73c84090 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -128,7 +128,7 @@ $error = 0; $listofchoices = array( 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => !empty($conf->facture->enabled), 'perms' => !empty($user->rights->facture->lire)), - 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled), 'perms' => (!empty($user->rights->fournisseur->facture->lire) || !empty($user->rights->supplier_invoice->lire)), + 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled), 'perms' => !empty($user->rights->fournisseur->facture->lire)), 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !empty($conf->expensereport->enabled), 'perms' => !empty($user->rights->expensereport->lire)), 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled), 'perms' => !empty($user->rights->don->lire)), 'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => !empty($conf->tax->enabled), 'perms' => !empty($user->rights->tax->charges->lire)), diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index e208fce3539..4d46f04a136 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -258,7 +258,7 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) { // Last modified supplier invoices -if (((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire))) { +if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $langs->load("boxes"); $facstatic = new FactureFournisseur($db); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index f421d287299..b87a73e8cc2 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -167,10 +167,10 @@ if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) { if ($object->thirdparty->fournisseur) { $thirdTypeArray['supplier'] = $langs->trans("supplier"); - if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) { + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices'); } - if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) { + if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { $elementTypeArray['supplier_order'] = $langs->transnoentitiesnoconv('SuppliersOrders'); } diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 5d81f4b250d..d10324ef620 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -115,7 +115,7 @@ if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARC if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED) || !empty($conf->supplier_order->enabled)) && $user->rights->fournisseur->commande->lire) { $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : '')); } -if ((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) || (!empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire)) { +if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->facture->lire) { $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : '')); } diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index d054c8d5569..e8ce515317f 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -58,7 +58,7 @@ function product_prepare_head($object) } if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase - if ((((!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire))) + if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->lire) || (!empty($conf->margin->enabled) && $user->rights->margin->liretous) ) { $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5e63dc4d081..7e815523283 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -281,7 +281,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ) ? 1 : 0, 'perms'=>(!empty($user->rights->facture->lire) || !empty($user->rights->don->contact->lire) || !empty($user->rights->tax->charges->lire) || !empty($user->rights->salaries->read) - || !empty($user->rights->fournisseur->facture->lire) || !empty($user->rights->supplier_invoice->lire) || !empty($user->rights->loan->read) || !empty($user->rights->margins->liretous)), + || !empty($user->rights->fournisseur->facture->lire) || !empty($user->rights->loan->read) || !empty($user->rights->margins->liretous)), 'module'=>'facture|supplier_invoice|don|tax|salaries|loan' ); $menu_arr[] = array( From 3c49a2b49a8bbdbe46877fe20796572cb3568931 Mon Sep 17 00:00:00 2001 From: Givriz Date: Wed, 21 Apr 2021 18:59:25 +0200 Subject: [PATCH 10/64] Compatibility phpv8 --- htdocs/admin/delais.php | 10 +++++----- htdocs/admin/security.php | 16 ++++++++-------- htdocs/admin/system/dolibarr.php | 4 ++-- htdocs/admin/system/modules.php | 14 +++++++------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 00f05152a86..0aeeb912c49 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -354,21 +354,21 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE print ''; - print '
global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>'; + print '
'; print '
'; print '
'; print img_weather($text, 0, $options); - print ' <=  %'; + print ' <=  %'; print '
'; print img_weather($text, 1, $options); - print ' <=  %'; + print ' <=  %'; print '
'; print img_weather($text, 2, $options); - print ' <=  %'; + print ' <=  %'; print '
'; print img_weather($text, 3, $options); - print ' <=  %'; + print ' <=  %'; print '
'; print '
'; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 9ce22b7c08e..de6f0b3ff4b 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -394,18 +394,18 @@ print ''; print ''; print ''.$langs->trans("DoNotStoreClearPassword").''; print ''; -if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { +if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) { print img_picto($langs->trans("Active"), 'tick'); } print ''; -if (!$conf->global->DATABASE_PWD_ENCRYPTED) { +if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) { print ''; print ''.$langs->trans("Activate").''; print ""; } // Database conf file encryption -if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { +if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) { print ''; if ($allow_disable_encryption) { //On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes @@ -453,16 +453,16 @@ print ''; print ''; print ''.$langs->trans("DisableForgetPasswordLinkOnLogonPage").''; print ''; -if (!empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { +if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) { print img_picto($langs->trans("Active"), 'tick'); } print ''; -if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { +if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) { print ''; print ''.$langs->trans("Activate").''; print ""; } -if (!empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { +if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) { print ''; print ''.$langs->trans("Disable").''; print ""; @@ -481,8 +481,8 @@ if (GETPOST('info', 'int') > 0) { } else { print $langs->trans("Note: The function password_hash does not exists on your PHP")."
\n"; } - print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."
\n"; - print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT."
\n"; + print 'MAIN_SECURITY_HASH_ALGO = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO')."
\n"; + print 'MAIN_SECURITY_SALT = '.getDolGlobalString('MAIN_SECURITY_SALT')."
\n"; } print '
'; diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index b4131a4bdde..9af09164469 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -139,8 +139,8 @@ if (preg_match('/[a-z]+/i', $version)) { } print ''."\n"; -print ''.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')'.$conf->global->MAIN_VERSION_LAST_UPGRADE.''."\n"; -print ''.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.''."\n"; +print ''.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')'.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').''."\n"; +print ''.$langs->trans("VersionLastInstall").''.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').''."\n"; print ''; print '
'; print '
'; diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 51f3b4577cf..f1ec6bf7d69 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -25,7 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!$user->admin) { +if (empty($user->admin)) { accessforbidden(); } @@ -164,17 +164,17 @@ foreach ($modules as $key => $module) { $newModule->permission = $permission; // pre-filter list - if ($search_name && !stristr($newModule->name, $search_name)) { + if (!empty($search_name) && !stristr($newModule->name, $search_name)) { continue; } - if ($search_version && !stristr($newModule->version, $search_version)) { + if (!empty($search_version) && !stristr($newModule->version, $search_version)) { continue; } - if ($search_id && !stristr($newModule->id, $search_id)) { + if (!empty($search_id) && !stristr($newModule->id, $search_id)) { continue; } - if ($search_permission) { + if (!empty($search_permission)) { $found = false; foreach ($newModule->permission as $permission) { @@ -184,7 +184,7 @@ foreach ($modules as $key => $module) { } } - if (!$found) { + if (empty($found)) { continue; } } @@ -211,7 +211,7 @@ print ''; print ''; print ''; -print_barre_liste($langs->trans("AvailableModules"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $massactionbutton, -1, '', 'title_setup', 0, '', '', 0, 1, 1); +print_barre_liste($langs->trans("AvailableModules"), empty($page) ? 0 : $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', -1, '', 'title_setup', 0, '', '', 0, 1, 1); print ''.$langs->trans("ToActivateModule").''; print '
'; From 474bfdd6bc66a7042766d732ce02817aa597a403 Mon Sep 17 00:00:00 2001 From: kastoras Date: Sun, 25 Apr 2021 16:20:17 +0300 Subject: [PATCH 11/64] Close/CLOSE #17390 Products API, GET /products without variants When accessing get /products, using $without_variants parameter to true (the deault value is false), the api retur only products and no variants. --- htdocs/product/class/api_products.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 9b06b30765d..c3f5c4f5551 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -166,9 +166,10 @@ class Products extends DolibarrApi * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" * @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long) + * @param bool $without_variants Return only products, not variants * @return array Array of product objects */ - public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false) + public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $without_variants = false) { global $db, $conf; @@ -186,6 +187,11 @@ class Products extends DolibarrApi $sql .= ", ".MAIN_DB_PREFIX."categorie_product as c"; } $sql .= ' WHERE t.entity IN ('.getEntity('product').')'; + + if($without_variants){ + $sql .= ' AND t.rowid in (select distinct fk_product_parent from '.MAIN_DB_PREFIX.'product_attribute_combination)'; + } + // Select products of given category if ($category > 0) { $sql .= " AND c.fk_categorie = ".$this->db->escape($category); From a8563de1c434df445ffa7cf05276887570e9a6d7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 25 Apr 2021 13:34:26 +0000 Subject: [PATCH 12/64] Fixing style errors. --- htdocs/product/class/api_products.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index c3f5c4f5551..0ceb082bd93 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -188,7 +188,7 @@ class Products extends DolibarrApi } $sql .= ' WHERE t.entity IN ('.getEntity('product').')'; - if($without_variants){ + if ($without_variants) { $sql .= ' AND t.rowid in (select distinct fk_product_parent from '.MAIN_DB_PREFIX.'product_attribute_combination)'; } From 080bd90c930fe9280918c4b17836190cbbf0a7cb Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 26 Apr 2021 16:15:09 +0200 Subject: [PATCH 13/64] Fix #17219 : complement of PR 17161 --- htdocs/core/tpl/filemanager.tpl.php | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index adb38aa9279..cf00f60d31d 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -87,10 +87,25 @@ if ($module == 'ecm') { print ''; } if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage medias of a web site - print 'ref.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; + print 'ref.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); print ''; } +if ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm + print ''; + print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); + print ''; +} +print ""; // Start "Add new file" area $nameforformuserfile = 'formuserfileecm'; @@ -139,22 +154,26 @@ if ($action == 'delete_section') { // End confirm if ($action == 'confirmconvertimgwebp') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$website->ref, $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); + if ($module == 'medias') { + print $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$website->ref.'&dir='.$_GET['dir'], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); + } else { + print $form->formconfirm($_SERVER["PHP_SELF"].'?dir='.$_GET['dir'], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); + } $action = 'file_manager'; } if ($action == 'convertimgwebp' && $permtoadd) { if ($module == 'medias') { - $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/image/'.$websitekey.'/'; + $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.$_GET['dir']; } else { - $imagefolder = $conf->ecm->dir_output; + $imagefolder = $conf->ecm->dir_output.'/'.$_GET['dir']; } include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; $regeximgext = getListOfPossibleImageExt(); - $filelist = dol_dir_list($imagefolder, "all", 1, $regeximgext); + $filelist = dol_dir_list($imagefolder, "all", 0, $regeximgext); foreach ($filelist as $filename) { $filepath = $filename['fullname']; From 8e67af8d58a2fe869f3a444692655a9976e98af6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 26 Apr 2021 21:09:56 +0200 Subject: [PATCH 14/64] Update api_products.class.php --- htdocs/product/class/api_products.class.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 0ceb082bd93..24bb22f41c4 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -158,16 +158,16 @@ class Products extends DolibarrApi * * Get a list of products * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) - * @param int $category Use this param to filter list by category - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" - * @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long) - * @param bool $without_variants Return only products, not variants - * @return array Array of product objects + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) + * @param int $category Use this param to filter list by category + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" + * @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long) + * @param bool $without_variants Return only parent products, not variants + * @return array Array of product objects */ public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $without_variants = false) { From 758ba67adc08e0e6d93aca9ef0a28644458cc5ae Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 27 Apr 2021 10:50:45 +0200 Subject: [PATCH 15/64] Fix #17219 : new complement of PR 17161 --- htdocs/core/tpl/filemanager.tpl.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index cf00f60d31d..7c620aa404c 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -99,11 +99,13 @@ if ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm print ""; @@ -154,19 +156,23 @@ if ($action == 'delete_section') { // End confirm if ($action == 'confirmconvertimgwebp') { + $section_dir=GETPOST('section_dir', 'alpha'); + $section=GETPOST('section', 'alpha'); + $form = new Form($db); + $formquestion['section_dir']=array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); + $formquestion['section']=array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); if ($module == 'medias') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$website->ref.'&dir='.$_GET['dir'], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); - } else { - print $form->formconfirm($_SERVER["PHP_SELF"].'?dir='.$_GET['dir'], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); + $formquestion['website']=array('type'=>'hidden', 'value'=>$website->ref, 'name'=>'website'); } + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', $formquestion, "yes", 1); $action = 'file_manager'; } if ($action == 'convertimgwebp' && $permtoadd) { if ($module == 'medias') { - $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.$_GET['dir']; + $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.GETPOST('section_dir', 'alpha'); } else { - $imagefolder = $conf->ecm->dir_output.'/'.$_GET['dir']; + $imagefolder = $conf->ecm->dir_output.'/'.GETPOST('section_dir', 'alpha'); } include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; From 6fd172609302c44ba0171949938b0553c7a2d9ee Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Tue, 27 Apr 2021 12:14:36 +0200 Subject: [PATCH 16/64] Fix Bug replenish + Auto Filter # Fix Replenish Calculation Bug + Auto Filter ## Environment * Version: 13 * URL(s): product/stock/replenish.php ## Configuration MultiCompany needed with Stock Sharing ON, 2 entities and 1 warehouse per entity **Entity A** * Options: don't share stocks with other entities * Warehouse : only 1 (WAR_A) * Stock : 1 product (PROD) Qty : 4 **Entity B :** * Options: don't share stocks with other entities * Warehouse : only 1 (WAR_B) * Stock : 1 product --the same-- (PROD) Qty : 17 **Product :** * Desired Stock : 20 * Alert : 10 **WAR_A :** * For the product * Desired Stock : 16 * Alert : 6 ## Fixed behavior : * Entity A -> Replenish * If WAR_A selected should show the product and fill with 12 the qty to order. Physical Stock (All) and Physical Stock (this warehouse) should be 4. * If no Warehouse selected show the product and fill with 12 (because only one warehouse seen by this entity) the qty to order. Physical Stock (All) should be 4. ## Actual behavior : * Entity A -> Replenish * The product isn't showed. * If I intentionally incrementes the Desired Stock value. The product will be shown with the good filter (Warehouse if desired stock has been incremented on the combination ProductDesired <-> Warehouse). The qty for the order are correct and the physical stock shown is correct. ## Conclusion : * 1 bug and 1 improvment **BUG** : The value of the stock taken to whether or not show the product line is wrong. It is considering the stock in warehouses not shared with the entity. **IMPROVMENT** : If only one Warehouse, take automatically the desired and alert values for this warehouse and not the general ones. --- htdocs/product/stock/replenish.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index c9109b348d6..ab95c29eadd 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -6,6 +6,7 @@ * Copyright (C) 2016 ATM Consulting * Copyright (C) 2019 Frédéric France * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2021 Antonin MARCHAL * * 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 @@ -64,6 +65,20 @@ $draftorder = GETPOST('draftorder', 'alpha'); $fourn_id = GETPOST('fourn_id', 'int'); $fk_supplier = GETPOST('fk_supplier', 'int'); $fk_entrepot = GETPOST('fk_entrepot', 'int'); + +//MultiCompany : If only 1 Warehouse is visible, filter will automatically be set to it. +if ($fk_entrepot == "-1" && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { + global $mc; + $visibleWarehousesEntities = $conf->entity; + if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { + $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); + } + $resWar = $db->query ("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); + if($db->num_rows($resWar) == 1){ + $fk_entrepot = $db->fetch_object($resWar)->rowid; + } +}; + $texte = ''; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -324,8 +339,8 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON ent.entity IN('.getEntity('stock').')'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot = ent.rowid'; if ($fk_supplier > 0) { $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')'; } From 109124fdac2d1a2ab9fc7a6e7ab7e09b0e72f1b4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 27 Apr 2021 10:16:59 +0000 Subject: [PATCH 17/64] Fixing style errors. --- htdocs/product/stock/replenish.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index ab95c29eadd..9a35816735d 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -73,8 +73,8 @@ if ($fk_entrepot == "-1" && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_E if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); } - $resWar = $db->query ("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); - if($db->num_rows($resWar) == 1){ + $resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); + if ($db->num_rows($resWar) == 1) { $fk_entrepot = $db->fetch_object($resWar)->rowid; } }; From 328e70c3098aaaef71fa063a372753cc180ac63a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 17:52:57 +0200 Subject: [PATCH 18/64] Update replenish.php --- htdocs/product/stock/replenish.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 9a35816735d..813e9556e8a 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -75,7 +75,8 @@ if ($fk_entrepot == "-1" && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_E } $resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); if ($db->num_rows($resWar) == 1) { - $fk_entrepot = $db->fetch_object($resWar)->rowid; + $tmpobj = $db->fetch_object($resWar); + $fk_entrepot = $tmpobj->rowid; } }; From f5d18a00230a5f0efc7ce655045e5f91a81cd664 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 18:00:45 +0200 Subject: [PATCH 19/64] Update replenish.php --- htdocs/product/stock/replenish.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 813e9556e8a..7421e71f05c 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -340,8 +340,8 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON ent.entity IN('.getEntity('stock').')'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot = ent.rowid'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; if ($fk_supplier > 0) { $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')'; } From d3c7ab402d95a3ad9047cf424a412820ec9f4e55 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 20:45:04 +0200 Subject: [PATCH 20/64] Fix wrong set of constant --- htdocs/adherents/class/adherent.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1d4f2029039..aaf194adf38 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -206,7 +206,7 @@ class Adherent extends CommonObject public $public; - // -2:exclu, -1:brouillon, 0:resilie, >=1:valide,paye + // -2:excluded, -1:draft, 0:resiliated, >=1:valided,payed // def in common object //public $status; @@ -334,7 +334,7 @@ class Adherent extends CommonObject /** * Draft status */ - const STATUS_DRAFT = 0; + const STATUS_DRAFT = -1; /** * Validated status */ @@ -342,7 +342,7 @@ class Adherent extends CommonObject /** * Resiliated */ - const STATUS_RESILIATED = -1; + const STATUS_RESILIATED = 0; /** * Excluded */ From d8ec9de58be6185e7c8f2205bf840a8816d5aa9a Mon Sep 17 00:00:00 2001 From: Damien BENOIT <48482664+Givriz@users.noreply.github.com> Date: Tue, 27 Apr 2021 20:53:05 +0200 Subject: [PATCH 21/64] Update delais.php --- htdocs/admin/delais.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 0aeeb912c49..4b1e34335e8 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -354,7 +354,7 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE print ''; - print '
'; + print '
global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'style="display:none;"' : '').'>'; print '
'; print '
'; From 7f3810e703604b4fee348789e627fe1094cc252d Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 20:53:14 +0200 Subject: [PATCH 22/64] update $field also --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index aaf194adf38..c0645cb14d4 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -326,7 +326,7 @@ class Adherent extends CommonObject 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 190), 'canvas' => array('type' => 'varchar(32)', 'label' => 'Canvas', 'enabled' => 1, 'visible' => -1, 'position' => 195), 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 500, - 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', -1 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')), + 'arrayofkeyval' => array(-1 => 'Draft', 1 => 'Validated', 0 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 800), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805) ); From 082423efa03007dce72b299156ed643b8c250480 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 21:09:37 +0200 Subject: [PATCH 23/64] libstatut --- htdocs/adherents/class/adherent.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index c0645cb14d4..75787276543 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1862,7 +1862,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = 1"; + $sql .= " statut = ".STATUS_VALIDATED; $sql .= ", datevalid = '".$this->db->idate($now)."'"; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1914,7 +1914,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = 0"; + $sql .= " statut = ".STATUS_RESILIATED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1964,7 +1964,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = -2"; + $sql .= " statut = ".STATUS_EXCLUDED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -2275,11 +2275,11 @@ class Adherent extends CommonObject $labelStatus = ''; $labelStatusShort = ''; - if ($status == -1) { + if ($status == STATUS_DRAFT) { $statusType = 'status0'; $labelStatus = $langs->trans("MemberStatusDraft"); $labelStatusShort = $langs->trans("MemberStatusDraftShort"); - } elseif ($status >= 1) { + } elseif ($status >= STATUS_VALIDATED) { if ($need_subscription == 0) { $statusType = 'status4'; $labelStatus = $langs->trans("MemberStatusNoSubscription"); @@ -2297,11 +2297,11 @@ class Adherent extends CommonObject $labelStatus = $langs->trans("MemberStatusPaid"); $labelStatusShort = $langs->trans("MemberStatusPaidShort"); } - } elseif ($status == 0) { + } elseif ($status == STATUS_RESILIATED) { $statusType = 'status6'; $labelStatus = $langs->trans("MemberStatusResiliated"); $labelStatusShort = $langs->trans("MemberStatusResiliatedShort"); - } elseif ($status == -2) { + } elseif ($status == STATUS_EXCLUDED) { $statusType = 'status10'; $labelStatus = $langs->trans("MemberStatusExcluded"); $labelStatusShort = $langs->trans("MemberStatusExcludedShort"); From d0d034672d839c41f876b48faedef1796e4226e8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 27 Apr 2021 19:10:01 +0000 Subject: [PATCH 24/64] Fixing style errors. --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 75787276543..b3b78939e06 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2301,7 +2301,7 @@ class Adherent extends CommonObject $statusType = 'status6'; $labelStatus = $langs->trans("MemberStatusResiliated"); $labelStatusShort = $langs->trans("MemberStatusResiliatedShort"); - } elseif ($status == STATUS_EXCLUDED) { + } elseif ($status == STATUS_EXCLUDED) { $statusType = 'status10'; $labelStatus = $langs->trans("MemberStatusExcluded"); $labelStatusShort = $langs->trans("MemberStatusExcludedShort"); From 3d3e8786afc622df02ae883a3c4749613d2761a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 27 Apr 2021 21:24:59 +0200 Subject: [PATCH 25/64] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b3b78939e06..28f7c6e933e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1862,7 +1862,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = ".STATUS_VALIDATED; + $sql .= " statut = ".self::STATUS_VALIDATED; $sql .= ", datevalid = '".$this->db->idate($now)."'"; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1914,7 +1914,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = ".STATUS_RESILIATED; + $sql .= " statut = ".self::STATUS_RESILIATED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1964,7 +1964,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = ".STATUS_EXCLUDED; + $sql .= " statut = ".self::STATUS_EXCLUDED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -2275,11 +2275,11 @@ class Adherent extends CommonObject $labelStatus = ''; $labelStatusShort = ''; - if ($status == STATUS_DRAFT) { + if ($status == self::STATUS_DRAFT) { $statusType = 'status0'; $labelStatus = $langs->trans("MemberStatusDraft"); $labelStatusShort = $langs->trans("MemberStatusDraftShort"); - } elseif ($status >= STATUS_VALIDATED) { + } elseif ($status >= self::STATUS_VALIDATED) { if ($need_subscription == 0) { $statusType = 'status4'; $labelStatus = $langs->trans("MemberStatusNoSubscription"); @@ -2297,11 +2297,11 @@ class Adherent extends CommonObject $labelStatus = $langs->trans("MemberStatusPaid"); $labelStatusShort = $langs->trans("MemberStatusPaidShort"); } - } elseif ($status == STATUS_RESILIATED) { + } elseif ($status == self::STATUS_RESILIATED) { $statusType = 'status6'; $labelStatus = $langs->trans("MemberStatusResiliated"); $labelStatusShort = $langs->trans("MemberStatusResiliatedShort"); - } elseif ($status == STATUS_EXCLUDED) { + } elseif ($status == self::STATUS_EXCLUDED) { $statusType = 'status10'; $labelStatus = $langs->trans("MemberStatusExcluded"); $labelStatusShort = $langs->trans("MemberStatusExcludedShort"); From e3653374406d7661aa8e889108811774004b6f57 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 21:43:13 +0200 Subject: [PATCH 26/64] Use status constant instead of integer --- htdocs/adherents/class/adherent.class.php | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 28f7c6e933e..59ea7dbb2dc 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -357,7 +357,7 @@ class Adherent extends CommonObject public function __construct($db) { $this->db = $db; - $this->statut = -1; + $this->statut = self::STATUS_DRAFT; // shouldn't this be $status ? // l'adherent n'est pas public par defaut $this->public = 0; // les champs optionnels sont vides @@ -1854,7 +1854,7 @@ class Adherent extends CommonObject $now = dol_now(); // Check parameters - if ($this->statut == 1) { + if ($this->statut == self::STATUS_VALIDATED) { dol_syslog(get_class($this)."::validate statut of member does not allow this", LOG_WARNING); return 0; } @@ -1870,7 +1870,7 @@ class Adherent extends CommonObject dol_syslog(get_class($this)."::validate", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - $this->statut = 1; + $this->statut = self::STATUS_VALIDATED; // Call trigger $result = $this->call_trigger('MEMBER_VALIDATE', $user); @@ -1906,7 +1906,7 @@ class Adherent extends CommonObject $error = 0; // Check parameters - if ($this->statut == 0) { + if ($this->statut == self::STATUS_RESILIATED) { dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING); return 0; } @@ -1920,7 +1920,7 @@ class Adherent extends CommonObject $result = $this->db->query($sql); if ($result) { - $this->statut = 0; + $this->statut = self::STATUS_RESILIATED; // Call trigger $result = $this->call_trigger('MEMBER_RESILIATE', $user); @@ -1956,7 +1956,7 @@ class Adherent extends CommonObject $error = 0; // Check parameters - if ($this->statut == 0) { + if ($this->statut == self::STATUS_EXCLUDED) { dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING); return 0; } @@ -1970,7 +1970,7 @@ class Adherent extends CommonObject $result = $this->db->query($sql); if ($result) { - $this->statut = 0; + $this->statut = self::STATUS_EXCLUDED; // Call trigger $result = $this->call_trigger('MEMBER_EXCLUDE', $user); @@ -2367,11 +2367,11 @@ class Adherent extends CommonObject $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE a.fk_adherent_type = t.rowid"; if ($mode == 'expired') { - $sql .= " AND a.statut = 1"; + $sql .= " AND a.statut = ".self::STATUS_VALIDATED; $sql .= " AND a.entity IN (".getEntity('adherent').")"; $sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = '1')"; } elseif ($mode == 'shift') { - $sql .= " AND a.statut = -1"; + $sql .= " AND a.statut = ".self::STATUS_DRAFT; $sql .= " AND a.entity IN (".getEntity('adherent').")"; } @@ -2388,10 +2388,10 @@ class Adherent extends CommonObject $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; $label = $langs->trans("MembersWithSubscriptionToReceive"); $labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort"); - $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; + $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_VALIDATED.'&filter=outofdate'; } elseif ($mode == 'shift') { $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; - $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=-1'; + $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_DRAFT; $label = $langs->trans("MembersListToValid"); $labelShort = $langs->trans("ToValidate"); } @@ -2504,7 +2504,7 @@ class Adherent extends CommonObject $this->birth = $now; $this->photo = ''; $this->public = 1; - $this->statut = 0; + $this->statut = self::STATUS_DARFT; $this->datefin = $now; $this->datevalid = $now; @@ -2823,7 +2823,7 @@ class Adherent extends CommonObject global $conf; //Only valid members - if ($this->statut <= 0) { + if ($this->statut != self::STATUS_VALIDATED) { return false; } if (!$this->datefin) { From c1d07a457b429ed05306d248d21bc2be882b0d6f Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 22:00:21 +0200 Subject: [PATCH 27/64] Mispelling --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 59ea7dbb2dc..54589a049ff 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2504,7 +2504,7 @@ class Adherent extends CommonObject $this->birth = $now; $this->photo = ''; $this->public = 1; - $this->statut = self::STATUS_DARFT; + $this->statut = self::STATUS_DRAFT; $this->datefin = $now; $this->datevalid = $now; From f3504e8c543bacbd615e98807d0a2da23f0fc4e0 Mon Sep 17 00:00:00 2001 From: kastoras Date: Tue, 27 Apr 2021 23:47:00 +0300 Subject: [PATCH 28/64] Close/CLOSE #17390 Products API, GET /products variants filter Added new parameter for variants filter. Using this filter you can get products without variants only, parrent products only, child products only. --- htdocs/product/class/api_products.class.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 24bb22f41c4..9a04cbc2fea 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -166,10 +166,10 @@ class Products extends DolibarrApi * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" * @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long) - * @param bool $without_variants Return only parent products, not variants + * @param int $variant_filter Use this param to filter list (0 = all, 1=products without variants, 2=parent of variants, 3=variants only) * @return array Array of product objects */ - public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $without_variants = false) + public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $variant_filter = 0) { global $db, $conf; @@ -188,9 +188,16 @@ class Products extends DolibarrApi } $sql .= ' WHERE t.entity IN ('.getEntity('product').')'; - if ($without_variants) { + if ($variant_filter == 1) { + $sql .= ' AND t.rowid not in (select distinct fk_product_parent from '.MAIN_DB_PREFIX.'product_attribute_combination)'; + $sql .= ' AND t.rowid not in (select distinct fk_product_child from '.MAIN_DB_PREFIX.'product_attribute_combination)'; + } + if ($variant_filter == 2) { $sql .= ' AND t.rowid in (select distinct fk_product_parent from '.MAIN_DB_PREFIX.'product_attribute_combination)'; } + if ($variant_filter == 3) { + $sql .= ' AND t.rowid in (select distinct fk_product_child from '.MAIN_DB_PREFIX.'product_attribute_combination)'; + } // Select products of given category if ($category > 0) { From e7f117073676df7762f43365c156ebee72339f37 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 23:22:29 +0200 Subject: [PATCH 29/64] Use adherent status const --- htdocs/core/boxes/box_members_by_type.php | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index c961ffe3f4a..5b95b58d29d 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -129,16 +129,16 @@ class box_members_by_type extends ModeleBoxes $adhtype->label = $objp->label; $AdherentType[$objp->rowid] = $adhtype; - if ($objp->statut == -1) { + if ($objp->statut == Adherent::STATUS_DRAFT) { $MembersToValidate[$objp->rowid] = $objp->somme; } - if ($objp->statut == 1) { + if ($objp->statut == Adherent::STATUS_VALIDATED) { $MembersValidated[$objp->rowid] = $objp->somme; } - if ($objp->statut == -2) { + if ($objp->statut == Adherent::STATUS_EXCLUDED) { $MembersExcluded[$objp->rowid] = $objp->somme; } - if ($objp->statut == 0) { + if ($objp->statut == Adherent::STATUS_RESILIATED) { $MembersResiliated[$objp->rowid] = $objp->somme; } @@ -210,27 +210,27 @@ class box_members_by_type extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '') . ' ' . $staticmember->LibStatut(-1, 1, 0, 3), + 'text' => (isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : '') . ' ' . $staticmember->LibStatut(1, 1, 0, 3), + 'text' => (isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(1, 1, $now, 3), + 'text' => (isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersExcluded[$key]) && $MembersExcluded[$key] > 0 ? $MembersExcluded[$key] : '') . ' ' . $staticmember->LibStatut(-2, 1, $now, 3), + 'text' => (isset($MembersExcluded[$key]) && $MembersExcluded[$key] > 0 ? $MembersExcluded[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, $now, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '') . ' ' . $staticmember->LibStatut(0, 1, 0, 3), + 'text' => (isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3), 'asis' => 1, ); @@ -249,27 +249,27 @@ class box_members_by_type extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumToValidate.' '.$staticmember->LibStatut(-1, 1, 0, 3), + 'text' => $SumToValidate.' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumValidated.' '.$staticmember->LibStatut(1, 1, 0, 3), + 'text' => $SumValidated.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumUpToDate.' '.$staticmember->LibStatut(1, 1, $now, 3), + 'text' => $SumUpToDate.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumExcluded.' '.$staticmember->LibStatut(-2, 1, 0, 3), + 'text' => $SumExcluded.' '.$staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumResiliated.' '.$staticmember->LibStatut(0, 1, 0, 3), + 'text' => $SumResiliated.' '.$staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3), 'asis' => 1 ); } From 50a5dd7ff3484648e3da66c64340e1fcc2119219 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 27 Apr 2021 23:28:49 +0200 Subject: [PATCH 30/64] Use adh const --- htdocs/core/boxes/box_birthdays_members.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 5445ad312fa..4d367a223e2 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -88,7 +88,7 @@ class box_birthdays_members extends ModeleBoxes $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as u"; $sql .= " WHERE u.entity IN (".getEntity('adherent').")"; - $sql .= " AND u.statut = 1"; + $sql .= " AND u.statut = ".Adherent::STATUS_VALIDATED; $sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); $sql .= " ORDER BY DAY(u.birth) ASC"; $sql .= $this->db->plimit($max, 0); From 2e108e1e2f64d24f41e5611c54bc4f12e129e3da Mon Sep 17 00:00:00 2001 From: kastoras Date: Wed, 28 Apr 2021 00:32:37 +0300 Subject: [PATCH 31/64] Close/CLOSE #13739 Product API route added to get product stock Using GET /products/{id}/stock user can get product stock from all warehouses. Using warehouse id will get stock of warehouse given. --- htdocs/product/class/api_products.class.php | 44 +++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 9b06b30765d..7805d7c7f52 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1793,6 +1793,50 @@ class Products extends DolibarrApi return $result; } + /** + * Get stock data for the product id given. + * Optionaly with $selected_warehouse_id parameter user can get stock of specific warehouse + * + * @param int $id ID of Product + * @param int $selected_warehouse_id ID of warehouse + * @return int + * + * @throws RestException 500 + * @throws RestException 401 + * @throws RestException 404 + * + * @url GET {id}/stock + */ + public function getStock($id,$selected_warehouse_id=null){ + + if (!DolibarrApiAccess::$user->rights->produit->lire) { + throw new RestException(401); + } + + if (!DolibarrApi::_checkAccessToResource('product', $id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $product_model = new Product($this->db); + $product_model->fetch($id); + $product_model->load_stock(); + + $stockData = $this->_cleanObjectDatas($product_model)->stock_warehouse; + if($selected_warehouse_id){ + foreach($stockData as $warehouse_id => $warehouse){ + if($warehouse_id != $selected_warehouse_id){ + unset($stockData[$warehouse_id]); + } + } + } + + if(empty($stockData)){ + throw new RestException(404, 'No stock found'); + } + + return ['stock_warehouses'=>$stockData]; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas From 925c32487267387d47de20882bf969466b80c7c0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 27 Apr 2021 21:38:03 +0000 Subject: [PATCH 32/64] Fixing style errors. --- htdocs/product/class/api_products.class.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 7805d7c7f52..8d4b2f29522 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -1794,7 +1794,7 @@ class Products extends DolibarrApi } /** - * Get stock data for the product id given. + * Get stock data for the product id given. * Optionaly with $selected_warehouse_id parameter user can get stock of specific warehouse * * @param int $id ID of Product @@ -1807,7 +1807,8 @@ class Products extends DolibarrApi * * @url GET {id}/stock */ - public function getStock($id,$selected_warehouse_id=null){ + public function getStock($id, $selected_warehouse_id = null) + { if (!DolibarrApiAccess::$user->rights->produit->lire) { throw new RestException(401); @@ -1815,22 +1816,22 @@ class Products extends DolibarrApi if (!DolibarrApi::_checkAccessToResource('product', $id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } + } $product_model = new Product($this->db); $product_model->fetch($id); $product_model->load_stock(); $stockData = $this->_cleanObjectDatas($product_model)->stock_warehouse; - if($selected_warehouse_id){ - foreach($stockData as $warehouse_id => $warehouse){ - if($warehouse_id != $selected_warehouse_id){ + if ($selected_warehouse_id) { + foreach ($stockData as $warehouse_id => $warehouse) { + if ($warehouse_id != $selected_warehouse_id) { unset($stockData[$warehouse_id]); } } } - if(empty($stockData)){ + if (empty($stockData)) { throw new RestException(404, 'No stock found'); } From 65a83036edddec5e9114c86347f1741707b3654f Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 28 Apr 2021 07:45:36 +0200 Subject: [PATCH 33/64] Clean code use const adh statut instead of integer --- htdocs/adherents/card.php | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 9b28cc6473e..3f92efe0e72 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1747,12 +1747,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $langs->trans("SubscriptionNotNeeded"); } elseif (!$adht->subscription) { print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) { + if (Adherent::STATUS_VALIDATED == $object->statut) { print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } else { print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) { + if (Adherent::STATUS_VALIDATED == $object->statut) { print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } @@ -1862,7 +1862,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($action != 'editlogin' && $action != 'editthirdparty') { // Send if (empty($user->socid)) { - if ($object->statut == 1) { + if (Adherent::STATUS_VALIDATED == $object->statut) { print ''."\n"; } } @@ -1870,20 +1870,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Send card by email // TODO Remove this to replace with a template /* - if ($user->rights->adherent->creer) - { - if ($object->statut >= 1) - { + if ($user->rights->adherent->creer) { + if (Adherent::STATUS_VALIDATED == $object->statut) { if ($object->email) print '\n"; else print '\n"; - } - else - { + } else { print '
'.$langs->trans("SendCardByMail")."
"; } - } - else - { + } else { print '
'.$langs->trans("SendCardByMail")."
"; }*/ @@ -1895,7 +1889,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Validate - if ($object->statut == -1) { + if (Adherent::STATUS_DRAFT == object->statut) { if ($user->rights->adherent->creer) { print ''."\n"; } else { @@ -1904,7 +1898,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Reactivate - if ($object->statut == 0 || $object->statut == -2) { + if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $Object->statut) { if ($user->rights->adherent->creer) { print '\n"; } else { @@ -1913,7 +1907,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Resiliate - if ($object->statut >= 1) { + if (Adherent::STATUS_VALIDATED == $object->statut) { if ($user->rights->adherent->supprimer) { print '\n"; } else { @@ -1922,7 +1916,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Exclude - if ($object->statut >= 1) { + if (Adherent::STATUS_VALIDATED == $object->statut) { if ($user->rights->adherent->supprimer) { print '\n"; } else { @@ -1933,7 +1927,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Create third party if (!empty($conf->societe->enabled) && !$object->socid) { if ($user->rights->societe->creer) { - if ($object->statut != -1) { + if (Adherent::STATUS_DRAFT != $object->statut) { print ''."\n";; } else { print ''."\n"; @@ -1946,7 +1940,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Create user if (!$user->socid && !$object->user_id) { if ($user->rights->user->user->creer) { - if ($object->statut != -1) { + if (Adherent::STATUS_DRAFT != $object->statut) { print ''."\n"; } else { print ''."\n"; From 972b325a51649b5f0e6bfa2b13806e225ba05a94 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 28 Apr 2021 08:14:18 +0200 Subject: [PATCH 34/64] Clean code --- htdocs/adherents/card.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 3f92efe0e72..222d34d38d9 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -937,17 +937,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { document.formsoc.action.value="create"; document.formsoc.submit(); }); - function initfieldrequired() - { + function initfieldrequired() { jQuery("#tdcompany").removeClass("fieldrequired"); jQuery("#tdlastname").removeClass("fieldrequired"); jQuery("#tdfirstname").removeClass("fieldrequired"); - if (jQuery("#morphy").val() == \'mor\') - { + if (jQuery("#morphy").val() == \'mor\') { jQuery("#tdcompany").addClass("fieldrequired"); } - if (jQuery("#morphy").val() == \'phy\') - { + if (jQuery("#morphy").val() == \'phy\') { jQuery("#tdlastname").addClass("fieldrequired"); jQuery("#tdfirstname").addClass("fieldrequired"); } @@ -1167,17 +1164,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { document.formsoc.action.value="edit"; document.formsoc.submit(); }); - function initfieldrequired() - { + function initfieldrequired() { jQuery("#tdcompany").removeClass("fieldrequired"); jQuery("#tdlastname").removeClass("fieldrequired"); jQuery("#tdfirstname").removeClass("fieldrequired"); - if (jQuery("#morphy").val() == \'mor\') - { + if (jQuery("#morphy").val() == \'mor\') { jQuery("#tdcompany").addClass("fieldrequired"); } - if (jQuery("#morphy").val() == \'phy\') - { + if (jQuery("#morphy").val() == \'phy\') { jQuery("#tdlastname").addClass("fieldrequired"); jQuery("#tdfirstname").addClass("fieldrequired"); } @@ -2004,7 +1998,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Show links to link elements /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); - if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + if ($linktoelem) { + print ($somethingshown?'':'
').$linktoelem; + } */ // Show online payment link From 7782e849e2ecc26e22c9a79366f35fd5c485946e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 28 Apr 2021 09:22:10 +0200 Subject: [PATCH 35/64] changes to implement eldy's advices --- htdocs/core/tpl/filemanager.tpl.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 7c620aa404c..592c3283a1b 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -99,12 +99,14 @@ if ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm print ""; @@ -170,9 +172,9 @@ if ($action == 'confirmconvertimgwebp') { if ($action == 'convertimgwebp' && $permtoadd) { if ($module == 'medias') { - $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.GETPOST('section_dir', 'alpha'); + $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.dol_sanitizeFileName(GETPOST('section_dir', 'alpha')); } else { - $imagefolder = $conf->ecm->dir_output.'/'.GETPOST('section_dir', 'alpha'); + $imagefolder = $conf->ecm->dir_output.'/'.dol_sanitizePathName(GETPOST('section_dir', 'alpha')); } include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; From 29cb154028e2870a9119b42edb215d83ac5e7251 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 28 Apr 2021 09:38:19 +0200 Subject: [PATCH 36/64] Update llx_10_c_regions.sql China Taiwan sorting completed --- .../install/mysql/data/llx_10_c_regions.sql | 136 +++++++++--------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 97fca0f230b..65b3af4950e 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -61,6 +61,7 @@ -- Brazil -> for Departmements -- Canada -> for Departmements -- Chile +-- China -- Colombie -> for Departmements -- Denmark -- France @@ -84,6 +85,7 @@ -- Slovenia -- Spain -- Switzerland/Suisse -> for Departmements/Cantons +-- Taiwan -> for Departmements -- Tunesia -- United Arab Emirates -> for Departmements -- United Kingdom @@ -93,7 +95,7 @@ -- TEMPLATE ------------------------------------------------------------------------------------------ -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 0, 0, '0', 0, '-'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 0, 0, '0', 0, '-'); -- Algeria Regions (id country=13) @@ -172,6 +174,43 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 6 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 67, 6715, NULL, NULL, 'Arica y Parinacota'); +-- China Regions (rowid country=9) +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 901, '京',0,'北京市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 902, '津',0,'天津市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 903, '沪',0,'上海市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 904, '渝',0,'重庆市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 905, '冀',0,'河北省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 906, '晋',0,'山西省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 907, '辽',0,'辽宁省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 908, '吉',0,'吉林省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 909, '黑',0,'黑龙江省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 910, '苏',0,'江苏省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 911, '浙',0,'浙江省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 912, '皖',0,'安徽省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 913, '闽',0,'福建省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 914, '赣',0,'江西省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 915, '鲁',0,'山东省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 916, '豫',0,'河南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 917, '鄂',0,'湖北省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 918, '湘',0,'湖南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 919, '粤',0,'广东省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 920, '琼',0,'海南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 921, '川',0,'四川省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 922, '贵',0,'贵州省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 923, '云',0,'云南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 924, '陕',0,'陕西省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 925, '甘',0,'甘肃省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 926, '青',0,'青海省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 927, '台',0,'台湾省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 928, '蒙',0,'内蒙古自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 929, '桂',0,'广西壮族自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 930, '藏',0,'西藏自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 931, '宁',0,'宁夏回族自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 932, '新',0,'新疆维吾尔自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 933, '港',0,'香港特别行政区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 934, '澳',0,'澳门特别行政区'); + + -- Colombie Regions (id country=70) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 70, 7001, '', 0, 'Colombie'); @@ -399,31 +438,35 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 4 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 6, 601, '', 1, 'Cantons'); +-- Taiwan Regions (rowid country=213) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 213, 21301, 'TW', NULL, 'Taiwan'); + + -- Tunisia Regions (id country=10) -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1001, '', 0, 'Ariana'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1002, '', 0, 'Béja'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1003, '', 0, 'Ben Arous'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1004, '', 0, 'Bizerte'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1005, '', 0, 'Gabès'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1006, '', 0, 'Gafsa'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1007, '', 0, 'Jendouba'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1008, '', 0, 'Kairouan'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1009, '', 0, 'Kasserine'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1010, '', 0, 'Kébili'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1011, '', 0, 'La Manouba'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1012, '', 0, 'Le Kef'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1013, '', 0, 'Mahdia'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1014, '', 0, 'Médenine'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1015, '', 0, 'Monastir'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1016, '', 0, 'Nabeul'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1017, '', 0, 'Sfax'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1018, '', 0, 'Sidi Bouzid'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1019, '', 0, 'Siliana'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1020, '', 0, 'Sousse'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1021, '', 0, 'Tataouine'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1022, '', 0, 'Tozeur'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1023, '', 0, 'Tunis'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1024, '', 0, 'Zaghouan'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1001, '', 0, 'Ariana'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1002, '', 0, 'Béja'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1003, '', 0, 'Ben Arous'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1004, '', 0, 'Bizerte'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1005, '', 0, 'Gabès'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1006, '', 0, 'Gafsa'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1007, '', 0, 'Jendouba'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1008, '', 0, 'Kairouan'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1009, '', 0, 'Kasserine'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1010, '', 0, 'Kébili'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1011, '', 0, 'La Manouba'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1012, '', 0, 'Le Kef'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1013, '', 0, 'Mahdia'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1014, '', 0, 'Médenine'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1015, '', 0, 'Monastir'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1016, '', 0, 'Nabeul'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1017, '', 0, 'Sfax'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1018, '', 0, 'Sidi Bouzid'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1019, '', 0, 'Siliana'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1020, '', 0, 'Sousse'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1021, '', 0, 'Tataouine'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1022, '', 0, 'Tozeur'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1023, '', 0, 'Tunis'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1024, '', 0, 'Zaghouan'); -- United Arab Emirates (UAE) Regions (rowid country=227) @@ -452,46 +495,3 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 2 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23208, '', 0, 'Nor-Oriental'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23209, '', 0, 'Zuliana'); - - - --- Regions China (rowid country=9) -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 901, '京',0,'北京市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 902, '津',0,'天津市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 903, '沪',0,'上海市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 904, '渝',0,'重庆市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 905, '冀',0,'河北省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 906, '晋',0,'山西省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 907, '辽',0,'辽宁省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 908, '吉',0,'吉林省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 909, '黑',0,'黑龙江省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 910, '苏',0,'江苏省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 911, '浙',0,'浙江省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 912, '皖',0,'安徽省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 913, '闽',0,'福建省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 914, '赣',0,'江西省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 915, '鲁',0,'山东省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 916, '豫',0,'河南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 917, '鄂',0,'湖北省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 918, '湘',0,'湖南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 919, '粤',0,'广东省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 920, '琼',0,'海南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 921, '川',0,'四川省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 922, '贵',0,'贵州省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 923, '云',0,'云南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 924, '陕',0,'陕西省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 925, '甘',0,'甘肃省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 926, '青',0,'青海省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 927, '台',0,'台湾省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 928, '蒙',0,'内蒙古自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 929, '桂',0,'广西壮族自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 930, '藏',0,'西藏自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 931, '宁',0,'宁夏回族自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 932, '新',0,'新疆维吾尔自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 933, '港',0,'香港特别行政区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 934, '澳',0,'澳门特别行政区'); - - --- Regions Taiwan (rowid country=213) -INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES (213, 21301, 'TW', NULL, 'Taiwan'); - From 26a7c2613ac73c41c733d18e2180eb67684c5659 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Wed, 28 Apr 2021 10:03:02 +0200 Subject: [PATCH 37/64] Update llx_20_c_departements.sql Taiwan Slovenia (need to check SI-Id) Panama --- .../mysql/data/llx_20_c_departements.sql | 125 +++++++++--------- 1 file changed, 65 insertions(+), 60 deletions(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index e1e363e9c62..96431caf5b1 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -55,7 +55,10 @@ -- Luxembourg -- Netherlands -- (Moroco) +-- Panama -- Romania +-- Slovenia (need to check code SI-Id) +-- Taiwan -- Tunisia @@ -759,6 +762,19 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA19B', 1214, '', 0, '', 'Province de Tan-Tan', 1); +-- Panama - 10 Provinces (id country=178) +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-1', '', 0, '', 'Bocas del Toro'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-2', '', 0, '', 'Coclé'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-3', '', 0, '', 'Colón'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-4', '', 0, '', 'Chiriquí'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-5', '', 0, '', 'Darién'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-6', '', 0, '', 'Herrera'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-7', '', 0, '', 'Los Santos'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-8', '', 0, '', 'Panamá'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-9', '', 0, '', 'Veraguas'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-13', '', 0, '', 'Panamá Oeste'); + + -- Romania Provinces (id country=188) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'AB', '', 0, '', 'Alba'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'AR', '', 0, '', 'Arad'); @@ -804,6 +820,55 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'VN', '', 0, '', 'Vrancea'); +-- Slovenia Provinces (rowid country=202) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI031', NULL, NULL, 'MURA', 'Mura'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI032', NULL, NULL, 'DRAVA', 'Drava'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI033', NULL, NULL, 'CARINTHIA', 'Carinthia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI034', NULL, NULL, 'SAVINJA', 'Savinja'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI035', NULL, NULL, 'CENTRAL SAVA', 'Central Sava'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI036', NULL, NULL, 'LOWER SAVA', 'Lower Sava'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI037', NULL, NULL, 'SOUTHEAST SLOVENIA', 'Southeast Slovenia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI038', NULL, NULL, 'LITTORAL–INNER CARNIOLA', 'Littoral–Inner Carniola'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI041', NULL, NULL, 'CENTRAL SLOVENIA', 'Central Slovenia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI038', NULL, NULL, 'UPPER CARNIOLA', 'Upper Carniola'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI043', NULL, NULL, 'GORIZIA', 'Gorizia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI044', NULL, NULL, 'COASTAL–KARST', 'Coastal–Karst'); + + +-- Taiwan Divisions / Provinces / Counties (rowid country=886) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KLU', 'KLU', NULL, '基隆市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPE', 'TPE', NULL, '臺北市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPH', 'TPH', NULL, '新北市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TYC', 'TYC', NULL, '桃園市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSH', 'HSH', NULL, '新竹縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSC', 'HSC', NULL, '新竹市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAL', 'MAL', NULL, '苗栗縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAC', 'MAC', NULL, '苗栗市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TXG', 'TXG', NULL, '臺中市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWH', 'CWH', NULL, '彰化縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWS', 'CWS', NULL, '彰化市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTC', 'NTC', NULL, '南投市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTO', 'NTO', NULL, '南投縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-YLH', 'YLH', NULL, '雲林縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CHY', 'CHY', NULL, '嘉義縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CYI', 'CYI', NULL, '嘉義市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TNN', 'TNN', NULL, '臺南市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KHH', 'KHH', NULL, '高雄市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-IUH', 'IUH', NULL, '屏東縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PTS', 'PTS', NULL, '屏東市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILN', 'ILN', NULL, '宜蘭縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILC', 'ILC', NULL, '宜蘭市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWA', 'HWA', NULL, '花蓮縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWC', 'HWC', NULL, '花蓮市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTC', 'TTC', NULL, '臺東市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTT', 'TTT', NULL, '臺東縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PEH', 'PEH', NULL, '澎湖縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-GNI', 'GNI', NULL, '綠島'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KYD', 'KYD', NULL, '蘭嶼'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KMN', 'KMN', NULL, '金門縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-LNN', 'LNN', NULL, '連江縣'); + + -- Tunisia Governorates / Provinces / Wilaya (id country=10) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN01', '', 0, '', 'Ariana'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN02', '', 0, '', 'Béja'); @@ -1628,17 +1693,6 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2503', 18126, '', 0, '', 'Padre Abad', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2504', 18126, '', 0, '', 'Purús', 1); --- Provinces Panama (id country=178) -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-1', 17801, '', 0, '', 'Bocas del Toro', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-2', 17801, '', 0, '', 'Coclé', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-3', 17801, '', 0, '', 'Colón', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-4', 17801, '', 0, '', 'Chiriquí', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-5', 17801, '', 0, '', 'Darién', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-6', 17801, '', 0, '', 'Herrera', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-7', 17801, '', 0, '', 'Los Santos', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-8', 17801, '', 0, '', 'Panamá', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-9', 17801, '', 0, '', 'Veraguas', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-13', 17801, '', 0, '', 'Panamá Oeste', 1); -- Provinces United Arab Emirates (id country=227) INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-1', 22701, '', 0, '', 'Abu Dhabi', 1); @@ -1673,52 +1727,3 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('15001', 'PT-VR', NULL, NULL, 'VILA REAL', 'Vila Real'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('15001', 'PT-VI', NULL, NULL, 'VISEU', 'Viseu'); --- Provinces Slovenia (rowid country=202) -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI031', NULL, NULL, 'MURA', 'Mura'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI032', NULL, NULL, 'DRAVA', 'Drava'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI033', NULL, NULL, 'CARINTHIA', 'Carinthia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI034', NULL, NULL, 'SAVINJA', 'Savinja'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI035', NULL, NULL, 'CENTRAL SAVA', 'Central Sava'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI036', NULL, NULL, 'LOWER SAVA', 'Lower Sava'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI037', NULL, NULL, 'SOUTHEAST SLOVENIA', 'Southeast Slovenia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI038', NULL, NULL, 'LITTORAL–INNER CARNIOLA', 'Littoral–Inner Carniola'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI041', NULL, NULL, 'CENTRAL SLOVENIA', 'Central Slovenia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI038', NULL, NULL, 'UPPER CARNIOLA', 'Upper Carniola'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI043', NULL, NULL, 'GORIZIA', 'Gorizia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI044', NULL, NULL, 'COASTAL–KARST', 'Coastal–Karst'); - - --- Provinces Taiwan (rowid country=886) -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KLU', 'KLU', NULL, '基隆市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPE', 'TPE', NULL, '臺北市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPH', 'TPH', NULL, '新北市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TYC', 'TYC', NULL, '桃園市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSH', 'HSH', NULL, '新竹縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSC', 'HSC', NULL, '新竹市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAL', 'MAL', NULL, '苗栗縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAC', 'MAC', NULL, '苗栗市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TXG', 'TXG', NULL, '臺中市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWH', 'CWH', NULL, '彰化縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWS', 'CWS', NULL, '彰化市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTC', 'NTC', NULL, '南投市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTO', 'NTO', NULL, '南投縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-YLH', 'YLH', NULL, '雲林縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CHY', 'CHY', NULL, '嘉義縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CYI', 'CYI', NULL, '嘉義市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TNN', 'TNN', NULL, '臺南市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KHH', 'KHH', NULL, '高雄市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-IUH', 'IUH', NULL, '屏東縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PTS', 'PTS', NULL, '屏東市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILN', 'ILN', NULL, '宜蘭縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILC', 'ILC', NULL, '宜蘭市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWA', 'HWA', NULL, '花蓮縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWC', 'HWC', NULL, '花蓮市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTC', 'TTC', NULL, '臺東市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTT', 'TTT', NULL, '臺東縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PEH', 'PEH', NULL, '澎湖縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-GNI', 'GNI', NULL, '綠島'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KYD', 'KYD', NULL, '蘭嶼'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KMN', 'KMN', NULL, '金門縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-LNN', 'LNN', NULL, '連江縣'); - - From e50494152d3f305cb8551cfa1f221336b5ddbdde Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 11:22:45 +0200 Subject: [PATCH 38/64] Fix label --- htdocs/core/modules/modFacture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 333ef747cf2..e51a77ba085 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -121,7 +121,7 @@ class modFacture extends DolibarrModules $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>1, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), - 1=>array('label'=>'SendEmailsRemindersOnInvoiceDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsRemindersOnInvoiceDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority)', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), + 1=>array('label'=>'SendEmailsRemindersOnInvoiceDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsRemindersOnInvoiceDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days. First param is the offset n of days, second parameter is "all" or a payment mode code, last paramater is the code of email template to use (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority).', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), ); // Permissions From c25b044da586f67d89420dc23497a78f03576868 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 28 Apr 2021 11:56:07 +0200 Subject: [PATCH 39/64] FIX : several fixes on salary and vat --- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/salaries/class/salary.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index ff35ece947b..465e6f27fd6 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -144,7 +144,7 @@ class Tva extends CommonObject $sql .= " '".$this->db->escape($this->note)."',"; $sql .= " '".$this->db->escape($this->fk_account)."',"; $sql .= " '".$this->db->escape($this->type_payment)."',"; - $sql .= " '".$this->db->escape($this->fk_user_creat)."',"; + $sql .= " '".($this->fk_user_creat > 0 ? (int)$this->fk_user_creat : (int)$user->id)."',"; $sql .= " '".$this->db->escape($this->fk_user_modif)."'"; $sql .= ")"; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index e3dbb9b735d..9e009543fe0 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -146,7 +146,7 @@ class Salary extends CommonObject $sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; $sql .= " fk_user_author=".((int) $this->fk_user_author).","; - $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null'); + $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int)$this->fk_user_modif : (int)$user->id); $sql .= " WHERE rowid=".((int) $this->id); From 4af2f8871a26448fddc2d038cb355aa0ace34d54 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 28 Apr 2021 12:27:07 +0200 Subject: [PATCH 40/64] FIX : on update current_timestamp --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_salary.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 10822a8ec2a..48095160c69 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 @@ -259,7 +259,7 @@ create table llx_salary rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) label varchar(255), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, datep date, -- payment date diff --git a/htdocs/install/mysql/tables/llx_salary.sql b/htdocs/install/mysql/tables/llx_salary.sql index af4b869d9bf..b68ac1e7a1e 100644 --- a/htdocs/install/mysql/tables/llx_salary.sql +++ b/htdocs/install/mysql/tables/llx_salary.sql @@ -21,7 +21,7 @@ create table llx_salary ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, datep date, -- payment date From 01ddc13b2ef8fb9665ea0b8805cb3e50df4612ed Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Wed, 28 Apr 2021 13:06:19 +0200 Subject: [PATCH 41/64] FIX : on update current_timestamp for postgres --- htdocs/install/pgsql/functions/functions.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 17339c1f605..d73678bcbab 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -169,6 +169,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitm CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_address FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); From 762378c04468f37613f2844680d824c0bde197da Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 28 Apr 2021 11:12:01 +0000 Subject: [PATCH 42/64] Fixing style errors. --- htdocs/compta/tva/class/tva.class.php | 2 +- htdocs/salaries/class/salary.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 465e6f27fd6..daed5b19f5e 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -144,7 +144,7 @@ class Tva extends CommonObject $sql .= " '".$this->db->escape($this->note)."',"; $sql .= " '".$this->db->escape($this->fk_account)."',"; $sql .= " '".$this->db->escape($this->type_payment)."',"; - $sql .= " '".($this->fk_user_creat > 0 ? (int)$this->fk_user_creat : (int)$user->id)."',"; + $sql .= " '".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id)."',"; $sql .= " '".$this->db->escape($this->fk_user_modif)."'"; $sql .= ")"; diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 9e009543fe0..e7f1af66e0c 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -146,7 +146,7 @@ class Salary extends CommonObject $sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; $sql .= " fk_user_author=".((int) $this->fk_user_author).","; - $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int)$this->fk_user_modif : (int)$user->id); + $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id); $sql .= " WHERE rowid=".((int) $this->id); From dfb4a1c30a9bb9c53a9c80e08bcf686d0f38ce05 Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Wed, 28 Apr 2021 13:37:05 +0200 Subject: [PATCH 43/64] lint (code) Apply remarks and upgrade codee - Sets List of all Visible Warehouses at the beginning with getEntity method (removed the call to global $mc) - Better check for warehouse auto select (`$count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) && ...`) - Better SQL applying eldy's remarks --- htdocs/product/stock/replenish.php | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 7421e71f05c..73124fd7bad 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -66,18 +66,22 @@ $fourn_id = GETPOST('fourn_id', 'int'); $fk_supplier = GETPOST('fk_supplier', 'int'); $fk_entrepot = GETPOST('fk_entrepot', 'int'); +//List all visible warehouses +$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) .")"); +$listofqualifiedwarehousesid = ""; +$count = 0; +while ($tmpobj = $db->fetch_object($resWar)) { + if (!empty($listofqualifiedwarehousesid)) { + $listofqualifiedwarehousesid .= ","; + } + $listofqualifiedwarehousesid .= $tmpobj->rowid; + $lastWarehouseID = $tmpobj->rowid; + $count++; +}; + //MultiCompany : If only 1 Warehouse is visible, filter will automatically be set to it. -if ($fk_entrepot == "-1" && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { - global $mc; - $visibleWarehousesEntities = $conf->entity; - if (isset($mc->sharings['stock']) && !empty($mc->sharings['stock'])) { - $visibleWarehousesEntities .= "," . implode(",", $mc->sharings['stock']); - } - $resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize($visibleWarehousesEntities) .")"); - if ($db->num_rows($resWar) == 1) { - $tmpobj = $db->fetch_object($resWar); - $fk_entrepot = $tmpobj->rowid; - } +if ($count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { + $fk_entrepot = $lastWarehouseID; }; $texte = ''; @@ -340,8 +344,8 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot IN ('.$db->sanitize($listofqualifiedwarehousesid).')'; +//$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; if ($fk_supplier > 0) { $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')'; } From 143417d7270b43f8ed9ce7877dcbfa2354e05a31 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 14:17:00 +0200 Subject: [PATCH 44/64] Fix duplicate line --- dev/setup/codesniffer/ruleset.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index e99b8673981..f4f64f40141 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -16,7 +16,6 @@ htdocs/conf.php */nltechno* */htdocs/includes - */htdocs/includes .git From 8bb8d846adbae3031da5f08bae8edaeb31f8af7d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 14:18:15 +0200 Subject: [PATCH 45/64] More complete setup file --- dev/setup/codesniffer/ruleset.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index f4f64f40141..e78438d8791 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -16,6 +16,7 @@ htdocs/conf.php */nltechno* */htdocs/includes + source .git From bc61fdd4878522488ff13c5357c32dbab1a80cde Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 28 Apr 2021 14:58:13 +0200 Subject: [PATCH 46/64] Missing $ --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 222d34d38d9..6235ea1fa5b 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1883,7 +1883,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Validate - if (Adherent::STATUS_DRAFT == object->statut) { + if (Adherent::STATUS_DRAFT == $object->statut) { if ($user->rights->adherent->creer) { print ''."\n"; } else { From 4926ac1e24f8f04e5ed7d7a7bf10284390c500dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 15:25:06 +0200 Subject: [PATCH 47/64] Fix make protected method not visible --- htdocs/api/class/api.class.php | 4 +++- htdocs/comm/action/class/api_agendaevents.class.php | 4 ++-- htdocs/compta/bank/class/api_bankaccounts.class.php | 4 ++-- htdocs/modulebuilder/template/class/api_mymodule.class.php | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 6cb40825ee7..c760903aca4 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -72,6 +72,7 @@ class DolibarrApi //$this->r->setSupportedFormats('jsonFormat'); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Check and convert a string depending on its type/name. * @@ -82,8 +83,9 @@ class DolibarrApi * @param stdClass $object Object * @return string Value cleaned */ - protected function checkValForAPI($field, $value, $object) + protected function _checkValForAPI($field, $value, $object) { + // phpcs:enable // TODO Use type detected in $object->fields if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) { return checkVal($value, 'restricthtml'); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 68da91d6ce2..c2961db7bbb 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -217,7 +217,7 @@ class AgendaEvents extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); + $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm); } /*if (isset($request_data["lines"])) { $lines = array(); @@ -270,7 +270,7 @@ class AgendaEvents extends DolibarrApi continue; } - $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); + $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm); } if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0) { diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 4afeac70124..762bcc506da 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -157,7 +157,7 @@ class BankAccounts extends DolibarrApi $account = new Account($this->db); foreach ($request_data as $field => $value) { - $account->$field = $this->checkValForAPI($field, $value, $account); + $account->$field = $this->_checkValForAPI($field, $value, $account); } // Date of the initial balance (required to create an account). $account->date_solde = time(); @@ -332,7 +332,7 @@ class BankAccounts extends DolibarrApi if ($field == 'id') { continue; } - $account->$field = $this->checkValForAPI($field, $value, $account); + $account->$field = $this->_checkValForAPI($field, $value, $account); } if ($account->update(DolibarrApiAccess::$user) > 0) { diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index e4b5fcca219..769c1529aff 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -213,7 +213,7 @@ class MyModuleApi extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); + $this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject); } // Clean data @@ -255,7 +255,7 @@ class MyModuleApi extends DolibarrApi if ($field == 'id') { continue; } - $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); + $this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject); } // Clean data From b4d0549017a696c4bf4d58450af2ceec26eb9b39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 16:00:59 +0200 Subject: [PATCH 48/64] Clean deprecated var --- htdocs/conf/conf.php.example | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 2d14e0e56fb..fba3e1004f4 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -341,7 +341,6 @@ $dolibarr_cron_allow_cli='0'; //$dolibarr_js_CKEDITOR='/javascript/ckeditor'; //$dolibarr_js_JQUERY='/javascript/jquery'; //$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; -//$dolibarr_js_JQUERY_FLOT='/javascript/flot'; // Value to overwrite some path to use font instead of embedded one //$dolibarr_font_DOL_DEFAULT_TTF="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"; //$dolibarr_font_DOL_DEFAULT_TTF_BOLD="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf"; From a12b6394be2fb0b7e4d8a4d8cf6549154efe41fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 16:41:37 +0200 Subject: [PATCH 49/64] Better error message --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9e234559aad..ce1cd69496e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3897,7 +3897,7 @@ class Societe extends CommonObject $state_code = $tmp[1]; $state_label = $tmp[2]; } else { // For backward compatibility - dol_syslog("Your state setup use an old syntax (entity=".$conf->entity."). Reedit it using setup area.", LOG_ERR); + dol_syslog("Your setup of State an old syntax (entity=".$conf->entity."). Go in Home - Setup - Organization then Save should remove this error.", LOG_ERR); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; $state_code = getState($state_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore $state_label = getState($state_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore From 367a6b15a6a15bc83417f6b7446a449da6964770 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 17:00:29 +0200 Subject: [PATCH 50/64] Update modules.php --- htdocs/admin/system/modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index f1ec6bf7d69..c11436a66d9 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -184,7 +184,7 @@ foreach ($modules as $key => $module) { } } - if (empty($found)) { + if (!$found) { continue; } } From d9d7019de465c267c690d8ab2d35b774b1c7b3df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 17:12:34 +0200 Subject: [PATCH 51/64] Clean page --- htdocs/takepos/admin/other.php | 39 +--------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php index f933472a443..e5114a446bd 100644 --- a/htdocs/takepos/admin/other.php +++ b/htdocs/takepos/admin/other.php @@ -61,44 +61,7 @@ if ($resql) { * Actions */ -if (GETPOST('action', 'alpha') == 'set') { - $db->begin(); - - $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); - //$res = dolibarr_set_const($db, "TAKEPOS_HEAD_BAR", GETPOST('TAKEPOS_HEAD_BAR', 'int'), 'int', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); - if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { - $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity); - } - - dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); - - if (!($res > 0)) { - $error++; - } - - if (!$error) { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} +// Nothing /* From 6ff9a3c922b074ff7423ab1fd4f26b81b0a87954 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 17:13:43 +0200 Subject: [PATCH 52/64] Fix trans --- htdocs/langs/en_US/cashdesk.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 4bcf8439271..e96592622a3 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -58,7 +58,7 @@ BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr TakeposNeedsCategories=TakePOS needs at least one product categorie to work TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category %s to work -OrderNotes=Printing the receipt will set all items to 'Order confirmed' +OrderNotes=Can add some notes to each ordered items CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration TicketVatGrouped=Group VAT by rate in tickets|receipts From 6b3024b153ce88ea8f5c5e2ff27405a46b71b3d9 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 28 Apr 2021 17:29:52 +0200 Subject: [PATCH 53/64] statut is not status in adherent class --- htdocs/adherents/class/adherent.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 54589a049ff..d43a139c6c7 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -208,7 +208,7 @@ class Adherent extends CommonObject // -2:excluded, -1:draft, 0:resiliated, >=1:valided,payed // def in common object - //public $status; + public $statut = $this->status; // TODO modify to set statut as deprecated /** * @var string photo of member @@ -357,7 +357,8 @@ class Adherent extends CommonObject public function __construct($db) { $this->db = $db; - $this->statut = self::STATUS_DRAFT; // shouldn't this be $status ? + $this->statut = self::STATUS_DRAFT; + $this->status = $this->statut; // l'adherent n'est pas public par defaut $this->public = 0; // les champs optionnels sont vides From 95389b4f57a067aa999f34db3cdbbbff38c7c5de Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 28 Apr 2021 15:33:37 +0000 Subject: [PATCH 54/64] Fixing style errors. --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index d43a139c6c7..4f0d2caa430 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -357,7 +357,7 @@ class Adherent extends CommonObject public function __construct($db) { $this->db = $db; - $this->statut = self::STATUS_DRAFT; + $this->statut = self::STATUS_DRAFT; $this->status = $this->statut; // l'adherent n'est pas public par defaut $this->public = 0; From 27389856891fb29e0dc8bbf3f41b24e6517a8d35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 17:53:05 +0200 Subject: [PATCH 55/64] Fix translation --- htdocs/langs/en_US/cashdesk.lang | 5 +++-- htdocs/takepos/admin/bar.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index e96592622a3..2aa9a1ba0b2 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -41,7 +41,8 @@ Floor=Floor AddTable=Add table Place=Place TakeposConnectorNecesary='TakePOS Connector' required -OrderPrinters=Order printers +OrderPrinters=Add a button to send the order to some given printers, without payment (for example to send an order to a kitchen) +NotAvailableWithBrowserPrinter=Not available when printer for receipt is set to browser: SearchProduct=Search product Receipt=Receipt Header=Header @@ -83,7 +84,7 @@ InvoiceIsAlreadyValidated=Invoice is already validated NoLinesToBill=No lines to bill CustomReceipt=Custom Receipt ReceiptName=Receipt Name -ProductSupplements=Product Supplements +ProductSupplements=Manage supplements of products SupplementCategory=Supplement category ColorTheme=Color theme Colorful=Colorful diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 863b6eda42c..2fe8f984f2e 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -137,6 +137,20 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); print ''; + } else { + print ''; + print $langs->trans("OrderPrinters"); + print ''; + print ''; + print ''.$langs->trans("NotAvailableWithBrowserPrinter").''; + print ''; + + print ''; + print $langs->trans("OrderNotes"); + print ''; + print ''; + print ''.$langs->trans("NotAvailableWithBrowserPrinter").''; + print ''; } print ''; From ea5493be87aec733722b07d3481826d05d382c33 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Wed, 28 Apr 2021 17:54:47 +0200 Subject: [PATCH 56/64] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 4f0d2caa430..7fdc548efa7 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -208,7 +208,7 @@ class Adherent extends CommonObject // -2:excluded, -1:draft, 0:resiliated, >=1:valided,payed // def in common object - public $statut = $this->status; // TODO modify to set statut as deprecated + public $statut; // TODO modify to set statut as deprecated /** * @var string photo of member From 8dd331d461b59de6828f4087b47f194b06b14a25 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 28 Apr 2021 17:55:03 +0200 Subject: [PATCH 57/64] Add ORDER CREATE trigger for notificiation --- .../triggers/interface_50_modNotification_Notification.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 18c27a8e36e..7d315f142a7 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -34,6 +34,7 @@ class InterfaceNotification extends DolibarrTriggers public $listofmanagedevents = array( 'BILL_VALIDATE', 'BILL_PAYED', + 'ORDER_CREATE', 'ORDER_VALIDATE', 'PROPAL_VALIDATE', 'PROPAL_CLOSE_SIGNED', From 2dc597f5d06d10986ed3a34cee4c49c53836e0b6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 18:04:00 +0200 Subject: [PATCH 58/64] Make setup easier to understand --- htdocs/admin/receiptprinter.php | 15 +++++++-------- htdocs/core/lib/takepos.lib.php | 4 ++-- htdocs/langs/en_US/cashdesk.lang | 2 +- htdocs/takepos/admin/receipt.php | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 704473ac597..f1b74146c5e 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -431,7 +431,9 @@ if ($mode == 'template' && $user->admin) { print ''; print ''; print ''; - print ''; + print ''; + print '
'; + print ''; } else { print ''.$printer->listprinterstemplates[$line]['name'].''; print ''.dol_htmlentitiesbr($printer->listprinterstemplates[$line]['template']).''; @@ -459,18 +461,15 @@ if ($mode == 'template' && $user->admin) { print ''; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; } print ''; - if ($action != 'edittemplate') { - print ''; - print '
'; - } else { - print '
'; - } print ''; print dol_get_fiche_end(); diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index db1623387c1..d983f0298ce 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -44,7 +44,7 @@ function takepos_admin_prepare_head() $h++; $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php'; - $head[$h][1] = $langs->trans("Receipt"); + $head[$h][1] = $langs->trans("Printers").' / '.$langs->trans("Receipt"); $head[$h][2] = 'receipt'; $h++; @@ -62,7 +62,7 @@ function takepos_admin_prepare_head() } $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/other.php'; - $head[$h][1] = $langs->trans("Other"); + $head[$h][1] = $langs->trans("About"); $head[$h][2] = 'other'; $h++; diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 2aa9a1ba0b2..836baf01135 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -94,7 +94,7 @@ Browser=Browser BrowserMethodDescription=Simple and easy receipt printing. Only a few parameters to configure the receipt. Print via browser. TakeposConnectorMethodDescription=External module with extra features. Posibility to print from the cloud. PrintMethod=Print method -ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud. +ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print if the server of application is hosted in the Cloud. ByTerminal=By terminal TakeposNumpadUsePaymentIcon=Use icon instead of text on payment buttons of numpad CashDeskRefNumberingModules=Numbering module for POS sales diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 8c201949034..ced9787899c 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -150,7 +150,7 @@ print ''; print '
'; -print load_fiche_titre($langs->trans("Setup"), '', ''); +print load_fiche_titre($langs->trans("Receipt"), '', ''); print '
'; print ''; From d4651c4721daccb65701da59d9a7bf85f865bd7f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 18:32:49 +0200 Subject: [PATCH 59/64] Fix trad --- htdocs/langs/en_US/cashdesk.lang | 2 +- htdocs/takepos/admin/bar.php | 2 ++ htdocs/takepos/admin/receipt.php | 23 +++++++++++++---------- htdocs/takepos/admin/terminal.php | 6 ++++++ 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 836baf01135..47bf937a90e 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -94,7 +94,7 @@ Browser=Browser BrowserMethodDescription=Simple and easy receipt printing. Only a few parameters to configure the receipt. Print via browser. TakeposConnectorMethodDescription=External module with extra features. Posibility to print from the cloud. PrintMethod=Print method -ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print if the server of application is hosted in the Cloud. +ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. The server hosting the application can't be in the Cloud (must be able to reach the printers in your network). ByTerminal=By terminal TakeposNumpadUsePaymentIcon=Use icon instead of text on payment buttons of numpad CashDeskRefNumberingModules=Numbering module for POS sales diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 2fe8f984f2e..d330e792f53 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -105,8 +105,10 @@ function Floors() { '; print $langs->trans("EnableBarOrRestaurantFeatures"); print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, 1, 0); +print ''; print '
'; diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index ced9787899c..9b236fc837a 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -118,8 +118,12 @@ print '
\n"; -if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { - print ''; -} - if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 52f451ae163..922a5c5032c 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -152,6 +152,7 @@ $atleastonefound = 0; if (!empty($conf->banque->enabled)) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; } @@ -217,6 +222,7 @@ if (!empty($conf->stock->enabled)) { print ''; // Force warehouse (this is not a default value) print ''; + print ''; } //print ''; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 4c3ef11294f..1f9e6c32b2b 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1029,7 +1029,7 @@ if ($conf->global->TAKEPOS_DIRECT_PAYMENT) { // BAR RESTAURANT specific menu if ($conf->global->TAKEPOS_BAR_RESTAURANT) { if ($conf->global->TAKEPOS_ORDER_PRINTERS) { - $menus[$r++] = array('title'=>$langs->trans("Order"), 'action'=>'TakeposPrintingOrder();'); + $menus[$r++] = array('title'=>'
'.$langs->trans("Order").'', 'action'=>'TakeposPrintingOrder();'); } //Button to print receipt before payment if ($conf->global->TAKEPOS_BAR_RESTAURANT) { diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 78f5b36da49..7ff09de495e 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -390,6 +390,17 @@ class DateLibTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals('Jeu Jan. Janvier', $result); + + $result=dol_print_date(1619388000, '%Y-%m-%d %a', 'gmt', $outputlangs); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('2021-04-25 Dim', $result); + + /* This test is disabled because result depends on TZ of server + $result=dol_print_date(1619388000, '%Y-%m-%d %a', 'tzserver', $outputlangs); // If TZ is +2, then result will be Lun for 1619388000 + print __METHOD__." result=".$result."\n"; + $this->assertEquals('2021-04-26 Lun', $result); + */ + // Check day format for en_US $outputlangs=new Translate('', $conf); $outputlangs->setDefaultLang('en_US'); From 887bce8235e4736d92fd60f81b8be1925248aca6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 20:59:21 +0200 Subject: [PATCH 61/64] Avoid duplicate declaration --- htdocs/adherents/class/adherent.class.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7fdc548efa7..80d14ee9ceb 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -204,12 +204,11 @@ class Adherent extends CommonObject */ public $morphy; + /** + * @var int Info can be public + */ public $public; - // -2:excluded, -1:draft, 0:resiliated, >=1:valided,payed - // def in common object - public $statut; // TODO modify to set statut as deprecated - /** * @var string photo of member */ From b1d858eb26bab28849ac0cd09294702eb13c0bab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 22:44:57 +0200 Subject: [PATCH 62/64] Fix translation of new modules --- .tx/config | 12 ++++++++++++ htdocs/core/modules/modPartnership.class.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.tx/config b/.tx/config index b98bf7828f2..6d3518fabd4 100644 --- a/.tx/config +++ b/.tx/config @@ -128,6 +128,12 @@ source_file = htdocs/langs/en_US/errors.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.eventorganization] +file_filter = htdocs/langs//eventorganization.lang +source_file = htdocs/langs/en_US/eventorganization.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.exports] file_filter = htdocs/langs//exports.lang source_file = htdocs/langs/en_US/exports.lang @@ -278,6 +284,12 @@ source_file = htdocs/langs/en_US/other.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.partnership] +file_filter = htdocs/langs//partnership.lang +source_file = htdocs/langs/en_US/partnership.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.paybox] file_filter = htdocs/langs//paybox.lang source_file = htdocs/langs/en_US/paybox.lang diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index 17c137a7e3c..be31ad3278a 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -144,7 +144,7 @@ class modPartnership extends DolibarrModules $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) // The language file dedicated to your module - $this->langfiles = array("partnership@partnership"); + $this->langfiles = array("partnership"); // Prerequisites $this->phpmin = array(5, 6); // Minimum version of PHP required by module From 64374f46daf52934997f885fe68768a5c09a7c8b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 23:01:20 +0200 Subject: [PATCH 63/64] Debug v14 --- htdocs/core/lib/functions.lib.php | 6 +- htdocs/core/modules/modPartnership.class.php | 2 +- htdocs/langs/en_US/partnership.lang | 4 +- htdocs/partnership/README.md | 86 --------------- htdocs/partnership/admin/about.php | 103 ------------------ .../admin/partnership_extrafields.php | 7 +- htdocs/partnership/admin/setup.php | 11 +- .../partnership/class/partnership.class.php | 8 +- .../partnership/modules_partnership.php | 4 +- htdocs/partnership/lib/partnership.lib.php | 11 +- htdocs/partnership/partnership_agenda.php | 2 +- htdocs/partnership/partnership_card.php | 2 +- htdocs/partnership/partnership_contact.php | 2 +- htdocs/partnership/partnership_document.php | 2 +- htdocs/partnership/partnership_list.php | 2 +- htdocs/partnership/partnership_note.php | 2 +- htdocs/partnership/partnershipindex.php | 2 +- 17 files changed, 36 insertions(+), 220 deletions(-) delete mode 100644 htdocs/partnership/README.md delete mode 100644 htdocs/partnership/admin/about.php diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 79f36b1dbcd..9308ea07d53 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3526,7 +3526,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_inventory', 'object_intracommreport', 'object_label', 'object_margin', 'object_members', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', 'object_lot', 'object_mrp', 'object_other', - 'object_payment', 'object_pdf', 'object_product', 'object_propal', + 'object_partnership', 'object_payment', 'object_pdf', 'object_product', 'object_propal', 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', 'object_reception', 'object_recruitmentjobposition', 'object_recruitmentcandidature', 'object_salary', 'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', @@ -3538,7 +3538,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'github', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', - 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'refresh', 'salary', 'shipment', 'supplier_invoice', 'technic', 'ticket', + 'partnership', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'refresh', 'salary', 'shipment', 'supplier_invoice', 'technic', 'ticket', 'error', 'warning', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice', @@ -3582,7 +3582,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature', - 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', + 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'refresh'=>'redo', 'resource'=>'laptop-house', diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index be31ad3278a..1165461368b 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -86,7 +86,7 @@ class modPartnership extends DolibarrModules // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' // To use a supported fa-xxx css style of font awesome, use this->picto='xxx' - $this->picto = 'generic'; + $this->picto = 'partnership'; // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array( diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 63b3bec0bb6..7681449755e 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -51,4 +51,6 @@ DatePartnershipEnd=End date PartnershipDraft = Draft PartnershipAccepted = Accepted PartnershipRefused = Refused -PartnershipCanceled = Canceled \ No newline at end of file +PartnershipCanceled = Canceled + +PartnershipManagedFor=Partners are \ No newline at end of file diff --git a/htdocs/partnership/README.md b/htdocs/partnership/README.md deleted file mode 100644 index ca8d9f7b551..00000000000 --- a/htdocs/partnership/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# PARTNERSHIP FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) - -## Features - -Description of the module... - - - -Other external modules are available on [Dolistore.com](https://www.dolistore.com). - -## Translations - -Translations can be completed manually by editing files into directories *langs*. - - - - - -## Licenses - -### Main code - -GPLv3 or (at your option) any later version. See file COPYING for more information. - -### Documentation - -All texts and readmes are licensed under GFDL. diff --git a/htdocs/partnership/admin/about.php b/htdocs/partnership/admin/about.php deleted file mode 100644 index 2d5f17b1877..00000000000 --- a/htdocs/partnership/admin/about.php +++ /dev/null @@ -1,103 +0,0 @@ - - * Copyright (C) 2021 Dorian Laurent - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file partnership/admin/about.php - * \ingroup partnership - * \brief About page of module Partnership. - */ - -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} - -// Libraries -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once '../lib/partnership.lib.php'; - -// Translations -$langs->loadLangs(array("errors", "admin", "partnership@partnership")); - -// Access control -if (!$user->admin) { - accessforbidden(); -} - -// Parameters -$action = GETPOST('action', 'aZ09'); -$backtopage = GETPOST('backtopage', 'alpha'); - - -/* - * Actions - */ - -// None - - -/* - * View - */ - -$form = new Form($db); - -$page_name = "PartnershipAbout"; -llxHeader('', $langs->trans($page_name)); - -// Subheader -$linkback = ''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans($page_name), $linkback, 'object_partnership@partnership'); - -// Configuration header -$head = partnershipAdminPrepareHead(); -print dol_get_fiche_head($head, 'about', '', 0, 'partnership@partnership'); - -dol_include_once('/partnership/core/modules/modPartnership.class.php'); -$tmpmodule = new modPartnership($db); -print $tmpmodule->getDescLong(); - -// Page end -print dol_get_fiche_end(); -llxFooter(); -$db->close(); diff --git a/htdocs/partnership/admin/partnership_extrafields.php b/htdocs/partnership/admin/partnership_extrafields.php index a69ec9d1372..3ecf00f2689 100644 --- a/htdocs/partnership/admin/partnership_extrafields.php +++ b/htdocs/partnership/admin/partnership_extrafields.php @@ -58,7 +58,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once '../lib/partnership.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('partnership@partnership', 'admin')); +$langs->loadLangs(array('partnership', 'admin')); $extrafields = new ExtraFields($db); $form = new Form($db); @@ -91,17 +91,18 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ +$help_url = ''; llxHeader('', $langs->trans("PartnershipSetup"), $help_url); $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("PartnershipSetup"), $linkback, 'title_setup'); +print load_fiche_titre($langs->trans("PartnershipSetup"), $linkback, 'object_partnership'); $head = partnershipAdminPrepareHead(); -print dol_get_fiche_head($head, 'partnership_extrafields', $langs->trans("PartnershipExtraFields"), -1, 'account'); +print dol_get_fiche_head($head, 'partnership_extrafields', $langs->trans("PartnershipExtraFields"), -1, 'partnership'); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index d55daab2347..46c6e8291db 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -58,7 +58,7 @@ require_once '../lib/partnership.lib.php'; //require_once "../class/myclass.class.php"; // Translations -$langs->loadLangs(array("admin", "partnership@partnership")); +$langs->loadLangs(array("admin", "partnership")); // Security check if (!$user->admin) { @@ -71,6 +71,7 @@ $value = GETPOST('value', 'alpha'); $error = 0; + /* * Actions */ @@ -91,10 +92,10 @@ if ($action == 'setting') { $partnership->tabs = array(); if ($modulemenu == 'member') { - $partnership->tabs[] = array('data'=>'member:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__'); + $partnership->tabs[] = array('data'=>'member:+partnership:Partnership:partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__'); $fk_mainmenu = "members"; } else { - $partnership->tabs[] = array('data'=>'thirdparty:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__'); + $partnership->tabs[] = array('data'=>'thirdparty:+partnership:Partnership:partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__'); $fk_mainmenu = "companies"; } @@ -131,10 +132,10 @@ $tab = $langs->trans("PartnershipSetup"); llxHeader('', $title); $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($title, $linkback, 'title_setup'); +print load_fiche_titre($title, $linkback, 'object_partnership'); $head = partnershipAdminPrepareHead(); -print dol_get_fiche_head($head, 'settings', $tab, -1, 'partnership'); +print dol_get_fiche_head($head, 'settings', $tab, -1, 'object_partnership'); $form = new Form($db); diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 019d72a6012..d842644800a 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -61,7 +61,7 @@ class Partnership extends CommonObject /** * @var string String with name of icon for partnership. Must be the part after the 'object_' into object_partnership.png */ - public $picto = 'partnership@partnership'; + public $picto = 'partnership'; const STATUS_DRAFT = 0; @@ -969,7 +969,7 @@ class Partnership extends CommonObject // phpcs:enable if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; - //$langs->load("partnership@partnership"); + //$langs->load("partnership"); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); $this->labelStatus[self::STATUS_ACCEPTED] = $langs->trans('Accepted'); $this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused'); @@ -1076,7 +1076,7 @@ class Partnership extends CommonObject public function getNextNumRef() { global $langs, $conf; - $langs->load("partnership@partnership"); + $langs->load("partnership"); if (empty($conf->global->PARTNERSHIP_ADDON)) { $conf->global->PARTNERSHIP_ADDON = 'mod_partnership_standard'; @@ -1141,7 +1141,7 @@ class Partnership extends CommonObject $result = 0; $includedocgeneration = 0; - $langs->load("partnership@partnership"); + $langs->load("partnership"); if (!dol_strlen($modele)) { $modele = 'standard_partnership'; diff --git a/htdocs/partnership/core/modules/partnership/modules_partnership.php b/htdocs/partnership/core/modules/partnership/modules_partnership.php index aea00b41415..005d77835b6 100644 --- a/htdocs/partnership/core/modules/partnership/modules_partnership.php +++ b/htdocs/partnership/core/modules/partnership/modules_partnership.php @@ -91,7 +91,7 @@ abstract class ModeleNumRefPartnership public function info() { global $langs; - $langs->load("partnership@partnership"); + $langs->load("partnership"); return $langs->trans("NoDescription"); } @@ -103,7 +103,7 @@ abstract class ModeleNumRefPartnership public function getExample() { global $langs; - $langs->load("partnership@partnership"); + $langs->load("partnership"); return $langs->trans("NoExample"); } diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php index 0cb4f1d0ea1..5305f86132e 100644 --- a/htdocs/partnership/lib/partnership.lib.php +++ b/htdocs/partnership/lib/partnership.lib.php @@ -30,7 +30,7 @@ function partnershipAdminPrepareHead() { global $langs, $conf; - $langs->load("partnership@partnership"); + $langs->load("partnership"); $h = 0; $head = array(); @@ -46,11 +46,12 @@ function partnershipAdminPrepareHead() $head[$h][2] = 'partnership_extrafields'; $h++; - + /* $head[$h][0] = dol_buildpath("/partnership/admin/about.php", 1); $head[$h][1] = $langs->trans("About"); $head[$h][2] = 'about'; $h++; + */ // Show more tabs from modules // Entries must be declared in modules descriptor with line @@ -75,7 +76,7 @@ function partnershipPrepareHead($object) { global $db, $langs, $conf; - $langs->load("partnership@partnership"); + $langs->load("partnership"); $h = 0; $head = array(); @@ -128,9 +129,9 @@ function partnershipPrepareHead($object) //$this->tabs = array( // 'entity:-tabname:Title:@partnership:/partnership/mypage.php?id=__ID__' //); // to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'partnership@partnership'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'partnership'); - complete_head_from_modules($conf, $langs, $object, $head, $h, 'partnership@partnership', 'remove'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'partnership', 'remove'); return $head; } diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index 712455840b8..51f417399df 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_agenda.php @@ -82,7 +82,7 @@ dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "other")); +$langs->loadLangs(array("partnership", "other")); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index dbf889137d8..d2647a43a8b 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -81,7 +81,7 @@ dol_include_once('/partnership/class/partnership.class.php'); dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "other")); +$langs->loadLangs(array("partnership", "other")); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/partnership/partnership_contact.php b/htdocs/partnership/partnership_contact.php index 02aa67f7365..632047acf25 100644 --- a/htdocs/partnership/partnership_contact.php +++ b/htdocs/partnership/partnership_contact.php @@ -59,7 +59,7 @@ dol_include_once('/partnership/class/partnership.class.php'); dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "companies", "other", "mails")); +$langs->loadLangs(array("partnership", "companies", "other", "mails")); $id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); diff --git a/htdocs/partnership/partnership_document.php b/htdocs/partnership/partnership_document.php index d455f342516..d6f89c07d00 100644 --- a/htdocs/partnership/partnership_document.php +++ b/htdocs/partnership/partnership_document.php @@ -82,7 +82,7 @@ dol_include_once('/partnership/class/partnership.class.php'); dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "companies", "other", "mails")); +$langs->loadLangs(array("partnership", "companies", "other", "mails")); $action = GETPOST('action', 'aZ09'); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 0e0ee3da9c3..441ef1a2de8 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -85,7 +85,7 @@ require_once __DIR__.'/class/partnership.class.php'; //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "other")); +$langs->loadLangs(array("partnership", "other")); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) diff --git a/htdocs/partnership/partnership_note.php b/htdocs/partnership/partnership_note.php index 5e752666b39..29a59f67ef4 100644 --- a/htdocs/partnership/partnership_note.php +++ b/htdocs/partnership/partnership_note.php @@ -78,7 +78,7 @@ dol_include_once('/partnership/class/partnership.class.php'); dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "companies")); +$langs->loadLangs(array("partnership", "companies")); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/partnership/partnershipindex.php b/htdocs/partnership/partnershipindex.php index 8db6be052bb..8076f105dbb 100644 --- a/htdocs/partnership/partnershipindex.php +++ b/htdocs/partnership/partnershipindex.php @@ -58,7 +58,7 @@ if (!$res) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership")); +$langs->loadLangs(array("partnership")); $action = GETPOST('action', 'aZ09'); From 6f1f26096ee2c99973e17c774a20f033c7659d11 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 23:25:26 +0200 Subject: [PATCH 64/64] Debug partnership module --- htdocs/core/lib/functions.lib.php | 6 +++--- htdocs/modulebuilder/template/myobject_card.php | 8 ++++---- htdocs/partnership/admin/partnership_extrafields.php | 2 +- htdocs/partnership/admin/setup.php | 2 +- htdocs/partnership/class/partnership.class.php | 2 +- htdocs/partnership/partnership_card.php | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9308ea07d53..c996640bc2c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3628,7 +3628,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (in_array($pictowithouttext, array('conferenceorbooth', 'collab', 'eventorganization', 'holiday', 'project', 'workstation'))) { $morecss = 'em088'; } - if (in_array($pictowithouttext, array('intervention', 'info', 'payment', 'loan', 'stock', 'technic'))) { + if (in_array($pictowithouttext, array('intervention', 'info', 'payment', 'loan', 'partnership', 'stock', 'technic'))) { $morecss = 'em080'; } @@ -3680,7 +3680,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944', 'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'inventory'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944', 'other'=>'#ddd', - 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba', + 'partnership'=>'#6c6aa8', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba', 'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uncheck'=>'#800', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa', 'website'=>'#304', 'workstation'=>'#a69944' @@ -9717,7 +9717,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = $tag = !empty($attr['href']) ? 'a' : 'span'; - return '
<'.$tag.' '.$compiledAttributes.'>'.$html.'
'; + return '<'.$tag.' '.$compiledAttributes.'>'.$html.''; } /** diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index fe4cd496df0..7de7d8d9c5c 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -492,10 +492,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Back to draft if ($object->status == $object::STATUS_VALIDATED) { - print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); } - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); // Validate if ($object->status == $object::STATUS_DRAFT) { @@ -509,7 +509,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Clone - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', $permissiontoadd); /* if ($permissiontoadd) { @@ -529,7 +529,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea */ // Delete (need delete permission, or if draft, just need create/modify permission) - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); } print '
'."\n"; } diff --git a/htdocs/partnership/admin/partnership_extrafields.php b/htdocs/partnership/admin/partnership_extrafields.php index 3ecf00f2689..a7f8bd9409e 100644 --- a/htdocs/partnership/admin/partnership_extrafields.php +++ b/htdocs/partnership/admin/partnership_extrafields.php @@ -102,7 +102,7 @@ print load_fiche_titre($langs->trans("PartnershipSetup"), $linkback, 'object_par $head = partnershipAdminPrepareHead(); -print dol_get_fiche_head($head, 'partnership_extrafields', $langs->trans("PartnershipExtraFields"), -1, 'partnership'); +print dol_get_fiche_head($head, 'partnership_extrafields', $langs->trans("PartnershipExtraFields"), -1, ''); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index 46c6e8291db..7894b24b5bb 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -135,7 +135,7 @@ $linkback = 'trans('Accept'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes', '', 0); - print ''.$langs->trans("Accept").''; + print ''.$langs->trans("Validate").''; } } @@ -628,7 +628,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Delete (need delete permission, or if draft, just need create/modify permission) - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); } print ''."\n"; }
'; print $langs->trans('DolibarrReceiptPrinter'); print ''; print $langs->trans('ReceiptPrinterMethodDescription'); -print '
'; -print ''.$langs->trans("Setup").''; +if ($conf->receiptprinter->enabled) { + if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { + print '
'; + print img_picto('', 'printer', 'class="paddingright"').''.$langs->trans("Setup").''; + } +} print '
'; if ($conf->receiptprinter->enabled) { if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { @@ -139,6 +143,13 @@ print '
'; print "TakePOS Connector"; print ''; print $langs->trans('TakeposConnectorMethodDescription'); + +if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { + print '
'; + print $langs->trans("URL")." / ".$langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; + print ' '; +} + print '
'; if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -166,14 +177,6 @@ print ajax_constantonoff("TAKEPOS_TICKET_VAT_GROUPPED", array(), $conf->entity, //print $form->selectyesno("TAKEPOS_TICKET_VAT_GROUPPED", $conf->global->TAKEPOS_TICKET_VAT_GROUPPED, 1); print "
'; - print $langs->trans("URL")." / ".$langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; - print ''; - print ''; - print '
'.$langs->trans("CashDeskBankAccountForSell").''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1); if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse})) { $atleastonefound++; @@ -159,6 +160,7 @@ if (!empty($conf->banque->enabled)) { print '
'.$langs->trans("CashDeskBankAccountForCheque").''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1); if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse})) { $atleastonefound++; @@ -166,6 +168,7 @@ if (!empty($conf->banque->enabled)) { print '
'.$langs->trans("CashDeskBankAccountForCB").''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1); if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse})) { $atleastonefound++; @@ -174,6 +177,7 @@ if (!empty($conf->banque->enabled)) { if ($conf->global->TAKEPOS_ENABLE_SUMUP) { print '
'.$langs->trans("CashDeskBankAccountForSumup").''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1); if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse})) { $atleastonefound++; @@ -192,6 +196,7 @@ if (!empty($conf->banque->enabled)) { $atleastonefound++; } $cour = preg_match('/^LIQ.*/', $modep->code) ? 2 : 1; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->$name, $name, 0, "courant=".$cour, 1); print '
'.$langs->trans("CashDeskIdWareHouse").''; if (!$disabled) { + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); print $formproduct->selectWarehouses($conf->global->{'CASHDESK_ID_WAREHOUSE'.$terminal}, 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled, 0, '', 0, 0, array(), 'maxwidth250'); print ' '; } else { From 18e911a6364db16c1cd0a7f8c32e38a9a5f9fed2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 28 Apr 2021 20:44:22 +0200 Subject: [PATCH 60/64] FIX dol_print_date for %a and %b with some Timezone --- htdocs/core/lib/functions.lib.php | 11 ++++++----- htdocs/projet/activity/perday.php | 21 ++++++++++++--------- htdocs/projet/activity/perweek.php | 11 +++++++++-- htdocs/takepos/index.php | 2 +- test/phpunit/DateLibTest.php | 11 +++++++++++ 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d4b94deba51..79f36b1dbcd 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2197,8 +2197,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = if ($tzoutput == 'tzserver') { $to_gmt = false; $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' - $offsettz = 0; - $offsetdst = 0; + $offsettz = 0; // Timezone offset with server timezone, so 0 + $offsetdst = 0; // Dst offset with server timezone, so 0 } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') { $to_gmt = true; $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' @@ -2308,7 +2308,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = if ($time < 100000000000) { // Protection against bad date values $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. - $ret = adodb_strftime($format, $timetouse, $to_gmt); + $ret = adodb_strftime($format, $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server } else { $ret = 'Bad value '.$time.' for date'; } @@ -2318,7 +2318,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. // Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs. - $month = adodb_strftime('%m', $timetouse, true); + $month = adodb_strftime('%m', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'. if ($encodetooutput) { $monthtext = $outputlangs->transnoentities('Month'.$month); @@ -2334,9 +2334,10 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = //return $ret; } if (preg_match('/__a__/i', $format)) { + //print "time=$time offsettz=$offsettz offsetdst=$offsetdst offsettzstring=$offsettzstring"; $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. - $w = adodb_strftime('%w', $timetouse, true); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. + $w = adodb_strftime('%w', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server $dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w); $ret = str_replace('__A__', $dayweek, $ret); $ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret); diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 3c67673ad49..b0195200dd5 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -81,13 +81,16 @@ $monthofday = GETPOST('addtimemonth'); $dayofday = GETPOST('addtimeday'); $yearofday = GETPOST('addtimeyear'); -$daytoparse = $now; -if ($yearofday && $monthofday && $dayofday) { - $daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime' -} elseif ($year && $month && $day) { - $daytoparse = dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect' -} +/*var_dump(GETPOST('remonth')); +var_dump(GETPOST('button_search_x')); +var_dump(GETPOST('button_addtime'));*/ +$daytoparse = $now; +if ($year && $month && $day) { + $daytoparse = dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect' +} elseif ($yearofday && $monthofday && $dayofday) { + $daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime' +} if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) { $usertoprocess = $user; @@ -416,10 +419,10 @@ $search_options_pattern = 'search_task_options_'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Show navigation bar -$nav = ''.img_previous($langs->trans("Previous"))."\n"; +$nav = ''.img_previous($langs->trans("Previous"))."\n"; $nav .= dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "%A").' '; $nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "day")." \n"; -$nav .= ''.img_next($langs->trans("Next"))."\n"; +$nav .= ''.img_next($langs->trans("Next"))."\n"; $nav .= ' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 1).' '; $nav .= ' '; @@ -773,7 +776,7 @@ print ''; print ''."\n"; print '
'; -print ''; +print ''; print '
'; print ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 3d380ab7f4e..0a275cb46e3 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -665,7 +665,12 @@ if (!empty($arrayfields['timeconsumed']['checked'])) { for ($idw = 0; $idw < 7; $idw++) { $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 $dayinloop = dol_time_plus_duree($startday, $idw, 'd'); - + /*print $dayinloopfromfirstdaytoshow; + print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour', 'gmt'); + print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour'); + print dol_print_date($dayinloopfromfirstdaytoshow, '%a', 'gmt'); + print dol_print_date($dayinloopfromfirstdaytoshow, '%a'); + print '
';*/ $cssweekend = ''; if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css. $cssweekend = 'weekend'; @@ -682,7 +687,9 @@ for ($idw = 0; $idw < 7; $idw++) { $cssonholiday .= 'onholidayafternoon '; } - print '
'.dol_print_date($dayinloopfromfirstdaytoshow, '%a').'
'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').'
'; + print dol_print_date($dayinloopfromfirstdaytoshow, '%a'); + print '
'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').'