From c3f3d41a26134c57e65bda0423583c95eea1c31f Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 3 Aug 2021 09:38:48 +0200 Subject: [PATCH 001/453] NEW constant PROPAL_CLOSE_AS_SIGNED --- htdocs/comm/propal/card.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3c0d8dd9a28..0394df8f797 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1913,10 +1913,11 @@ if ($action == 'create') { if ($action == 'closeas') { //Form to close proposal (signed or not) - $formquestion = array( - array('type' => 'select', 'name' => 'statut', 'label' => ''.$langs->trans("CloseAs").'', 'values' => array($object::STATUS_SIGNED => $object->LibStatut($object::STATUS_SIGNED), $object::STATUS_NOTSIGNED => $object->LibStatut($object::STATUS_NOTSIGNED))), - array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => '') // Field to complete private note (not replace) - ); + $formquestion = array(); + if (empty($conf->global->PROPAL_CLOSE_AS_SIGNED)) { + $formquestion[] = array('type' => 'select', 'name' => 'statut', 'label' => ''.$langs->trans("CloseAs").'', 'values' => array($object::STATUS_SIGNED => $object->LibStatut($object::STATUS_SIGNED), $object::STATUS_NOTSIGNED => $object->LibStatut($object::STATUS_NOTSIGNED))); + } + $formquestion[] = array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => ''); // Field to complete private note (not replace) if (!empty($conf->notification->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; @@ -1926,7 +1927,11 @@ if ($action == 'create') { )); } - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); + if (empty($conf->global->PROPAL_CLOSE_AS_SIGNED)) { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); + } else { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 250); + } } elseif ($action == 'delete') { // Confirm delete $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1); From 57729dfc839d8bdff87391e7d38a8251ee2797ab Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 3 Aug 2021 09:44:42 +0200 Subject: [PATCH 002/453] NEW constant PROPAL_CLOSE_AS_SIGNED --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 0394df8f797..f232a5bd9c5 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1929,7 +1929,7 @@ if ($action == 'create') { if (empty($conf->global->PROPAL_CLOSE_AS_SIGNED)) { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); - } else { + } else { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 250); } } elseif ($action == 'delete') { From 14567fb1152a6e47d8d86140761ad1f70459378d Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 3 Aug 2021 10:31:37 +0200 Subject: [PATCH 003/453] rename constant PROPAL_CLOSE_AS_SIGNED to PROPAL_SKIP_ACCEPT_REFUSE --- htdocs/comm/propal/card.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f232a5bd9c5..251580b4c5d 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1914,7 +1914,7 @@ if ($action == 'create') { if ($action == 'closeas') { //Form to close proposal (signed or not) $formquestion = array(); - if (empty($conf->global->PROPAL_CLOSE_AS_SIGNED)) { + if (empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)) { $formquestion[] = array('type' => 'select', 'name' => 'statut', 'label' => ''.$langs->trans("CloseAs").'', 'values' => array($object::STATUS_SIGNED => $object->LibStatut($object::STATUS_SIGNED), $object::STATUS_NOTSIGNED => $object->LibStatut($object::STATUS_NOTSIGNED))); } $formquestion[] = array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => ''); // Field to complete private note (not replace) @@ -1927,7 +1927,7 @@ if ($action == 'create') { )); } - if (empty($conf->global->PROPAL_CLOSE_AS_SIGNED)) { + if (empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)) { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); } else { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 250); @@ -2599,14 +2599,22 @@ if ($action == 'create') { } } - // Close as accepted/refused - if ($object->statut == Propal::STATUS_VALIDATED) { - if ($usercanclose) { - print 'global->MAIN_JUMP_TAG) ? '' : '#close').'"'; - print '>'.$langs->trans('SetAcceptedRefused').''; - } else { - print ''.$langs->trans('SetAcceptedRefused').''; + if (empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)) { + // Close as accepted/refused + if ($object->statut == Propal::STATUS_VALIDATED) { + if ($usercanclose) { + print 'global->MAIN_JUMP_TAG) ? '' : '#close').'"'; + print '>'.$langs->trans('SetAcceptedRefused').''; + } else { + print ''.$langs->trans('SetAcceptedRefused').''; + } + } + } else { + // Set not signed (close) + if ($object->statut == Propal::STATUS_DRAFT && $usercanclose) { + print 'global->MAIN_JUMP_TAG) ? '' : '#close') . '"'; + print '>' . $langs->trans('Close') . ''; } } From 8e9d02efb7ff1d1a901b04036ab6718a6346ee44 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 3 Aug 2021 10:37:37 +0200 Subject: [PATCH 004/453] draft close --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 251580b4c5d..76e4dbe1c4f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -658,7 +658,7 @@ if (empty($reshook)) { $action = 'closeas'; } elseif (GETPOST('statut', 'int') == $object::STATUS_SIGNED || GETPOST('statut', 'int') == $object::STATUS_NOTSIGNED) { // prevent browser refresh from closing proposal several times - if ($object->statut == $object::STATUS_VALIDATED) { + if ($object->statut == $object::STATUS_VALIDATED || ( ! empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) && $object->statut == $object::STATUS_DRAFT)) { $db->begin(); $result = $object->closeProposal($user, GETPOST('statut', 'int'), GETPOST('note_private', 'restricthtml')); From dfbefed0f6ef56964cc1779582f2fc513ed8e353 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 3 Aug 2021 10:58:40 +0200 Subject: [PATCH 005/453] remove PROPAL_REOPEN_TO_DRAFT --- htdocs/comm/propal/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 76e4dbe1c4f..0557b54f5b3 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -256,6 +256,9 @@ if (empty($reshook)) { // Validation $idwarehouse = GETPOST('idwarehouse', 'int'); $result = $object->valid($user); + if ( $result > 0 && ! empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) ) { + $result = $object->closeProposal($user, $object::STATUS_SIGNED); + } if ($result >= 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; @@ -680,7 +683,7 @@ if (empty($reshook)) { if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) { $db->begin(); - $result = $object->reopen($user, 1); + $result = $object->reopen($user, empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; From b0d86d12fb8097df071c8c5f05a6e5710208c294 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Thu, 18 Nov 2021 10:43:52 +0100 Subject: [PATCH 006/453] fix url on formextra --- htdocs/core/tpl/extrafields_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index b5656c89339..15d529e01b6 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -243,7 +243,7 @@ if (empty($reshook) && isset($extrafields->attributes[$object->table_element]['l if ($object->table_element == 'societe') { $fieldid = 'socid'; } - print '
'; + print ''; print ''; print ''; print ''; From ac740e0a93d82f1f0921515705778cdb3a0bff3a Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 4 Mar 2022 11:28:03 +0100 Subject: [PATCH 007/453] Add pages to products list in inventory --- htdocs/product/inventory/inventory.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 95c9e2972cb..fc8b7c5cc35 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -40,6 +40,16 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$listoffset = GETPOST('listoffset', 'alpha'); +$limit = GETPOST('limit', 'int') > 0 ?GETPOST('limit', 'int') : $conf->liste_limit; +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page == -1) { + $page = 0; +} +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +$savlimit = $limit; $fk_warehouse = GETPOST('fk_warehouse', 'int'); $fk_product = GETPOST('fk_product', 'int'); @@ -228,6 +238,7 @@ if (empty($reshook)) { $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); + $i = 0; $totalarray = array(); $inventoryline = new InventoryLine($db); @@ -284,7 +295,6 @@ if (empty($reshook)) { } } - $backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php'; $backtopage = DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id; @@ -396,6 +406,14 @@ jQuery(document).ready(function() { // Part to show record if ($object->id > 0) { + + $param = '&id='.$object->id; + $param .= '&action=updateinventorylines'; + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); + } + $paramwithsearch = $param; + $res = $object->fetch_optionals(); $head = inventoryPrepareHead($object); @@ -905,6 +923,7 @@ if ($object->id > 0) { $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); + $sql .= $db->plimit($limit + 1, $offset); $cacheOfProducts = array(); $cacheOfWarehouses = array(); @@ -914,6 +933,10 @@ if ($object->id > 0) { if ($resql) { $num = $db->num_rows($resql); + if (!empty($savlimit != 0) || $num > $limit || $page) { + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $limit), '', '',$limit, $num); + } + $i = 0; $hasinput = false; $totalarray = array(); From f3fb0ffd8a37966ee2d27c3b9c9854a69d75d97e Mon Sep 17 00:00:00 2001 From: atm-lena Date: Fri, 4 Mar 2022 16:44:15 +0100 Subject: [PATCH 008/453] Keep qty value between pages --- htdocs/core/actions_addupdatedelete.inc.php | 4 +- htdocs/product/inventory/inventory.php | 64 ++++++++++++++++----- 2 files changed, 52 insertions(+), 16 deletions(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 4857902b8cc..0a6151a5f60 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -28,6 +28,7 @@ // $permissiontodelete must be defined // $backurlforlist must be defined // $backtopage may be defined +// $gotopage // $triggermodname may be defined if (!empty($permissionedit) && empty($permissiontoadd)) { @@ -348,8 +349,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto } setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs'); - - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); + header('Location: '.((empty($gotopage)) ? $_SERVER["PHP_SELF"].'?id='.$object->id : $gotopage)); exit; } else { $error++; diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index fc8b7c5cc35..480dbbaa27d 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -49,7 +49,6 @@ if (empty($page) || $page == -1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$savlimit = $limit; $fk_warehouse = GETPOST('fk_warehouse', 'int'); $fk_product = GETPOST('fk_product', 'int'); @@ -104,6 +103,13 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $now = dol_now(); +//Parameters Page +$param = '&id='.$object->id; +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} +$paramwithsearch = $param; + /* * Actions @@ -232,6 +238,7 @@ if (empty($reshook)) { $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); + $sql .= $db->plimit($limit, $offset); $db->begin(); @@ -295,6 +302,10 @@ if (empty($reshook)) { } } + if($action == 'confirm_deleteline'){ + $gotopage = $_SERVER["PHP_SELF"].'?id='.$object->id.'&page='.$page.$paramwithsearch; + } + $backurlforlist = DOL_URL_ROOT.'/product/inventory/list.php'; $backtopage = DOL_URL_ROOT.'/product/inventory/inventory.php?id='.$object->id; @@ -407,13 +418,6 @@ jQuery(document).ready(function() { // Part to show record if ($object->id > 0) { - $param = '&id='.$object->id; - $param .= '&action=updateinventorylines'; - if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); - } - $paramwithsearch = $param; - $res = $object->fetch_optionals(); $head = inventoryPrepareHead($object); @@ -427,7 +431,7 @@ if ($object->id > 0) { } // Confirmation to delete line if ($action == 'deleteline') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid.'&page='.$page.$paramwithsearch, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); } // Clone confirmation @@ -923,7 +927,7 @@ if ($object->id > 0) { $sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement'; $sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id'; $sql .= ' WHERE id.fk_inventory = '.((int) $object->id); - $sql .= $db->plimit($limit + 1, $offset); + $sql .= $db->plimit($limit, $offset); $cacheOfProducts = array(); $cacheOfWarehouses = array(); @@ -933,8 +937,8 @@ if ($object->id > 0) { if ($resql) { $num = $db->num_rows($resql); - if (!empty($savlimit != 0) || $num > $limit || $page) { - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $limit), '', '',$limit, $num); + if (!empty($limit != 0) || $num > $limit || $page) { + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '',$limit); } $i = 0; @@ -1014,7 +1018,7 @@ if ($object->id > 0) { // Picto delete line print ''; - print ''.img_delete().''; + print ''.img_delete().''; $qty_tmp = price2num(GETPOST("id_".$obj->rowid."_input_tmp", 'MS')) >= 0 ? GETPOST("id_".$obj->rowid."_input_tmp") : $qty_view; print ''; print ''; @@ -1048,7 +1052,6 @@ if ($object->id > 0) { print ''; - // Call method to disable the button if no qty entered yet for inventory if ($object->status != $object::STATUS_VALIDATED || !$hasinput) { @@ -1060,6 +1063,39 @@ if ($object->id > 0) { '; } print ''; + + + print ''; + } // End of page From 4e8dd1b6a582f39374b9017000643ffbb0704c7e Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 8 Mar 2022 10:02:30 +0100 Subject: [PATCH 009/453] Delete function disable button disablebuttonmakemovementandclose() --- htdocs/langs/en_US/stocks.lang | 4 +-- htdocs/product/inventory/inventory.php | 34 -------------------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 98faab0c423..af06ce7e94c 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -251,7 +251,7 @@ SelectAStockMovementFileToImport=select a stock movement file to import InfoTemplateImport=Uploaded file needs to have this format (* are mandatory fields):
Source Warehouse* | Target Warehouse* | Product* | Quantity* | Lot/serial number
CSV character separator must be "%s" LabelOfInventoryMovemement=Inventory %s ReOpen=Reopen -ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock to the real qty you entered into the inventory. +ConfirmFinish=Do you confirm the closing of the inventory ? This will generate all stock movements to update your stock to the real qty you entered into the inventory.

No stock movement will be made on products that do not have an actual quantity entered. ObjectNotFound=%s not found MakeMovementsAndClose=Generate movements and close AutofillWithExpected=Fill real quantity with expected quantity @@ -271,4 +271,4 @@ ErrorCantFindCodeInInventory=Can't find the following code in inventory QtyWasAddedToTheScannedBarcode=Success !! The quantity was added to all the requested barcode. You can close the Scanner tool. StockChangeDisabled=Change on stock disabled NoWarehouseDefinedForTerminal=No warehouse defined for terminal -ClearQtys=Clear all quantities \ No newline at end of file +ClearQtys=Clear all quantities diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 480dbbaa27d..385aae39248 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -393,28 +393,6 @@ $help_url = ''; llxHeader('', $langs->trans('Inventory'), $help_url); -// Disable button Generate movement if data were modified and not saved -print ''; - - // Part to show record if ($object->id > 0) { @@ -607,7 +585,6 @@ if ($object->id > 0) { objecttofill.value = object.innerText; }) console.log("Values filled (after click on fillwithexpected)"); - disablebuttonmakemovementandclose(); return false; });'; print '});'; @@ -858,7 +835,6 @@ if ($object->id > 0) { id = id.split("_")[1]; tmpvalue = $("#id_"+id+"_input_tmp").val() $("#id_"+id+"_input")[0].value = tmpvalue; - disablebuttonmakemovementandclose(); return false; /* disable submit */ }); });'; @@ -1052,16 +1028,6 @@ if ($object->id > 0) { print ''; - // Call method to disable the button if no qty entered yet for inventory - - if ($object->status != $object::STATUS_VALIDATED || !$hasinput) { - print ''; - } print ''; From 85628bad219028699b53c1e4b708142b4a3a63a6 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Tue, 8 Mar 2022 10:20:58 +0100 Subject: [PATCH 010/453] Fix save button --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 385aae39248..ea51080803e 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -516,7 +516,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); - print '
'; + print ''; print ''; print ''; print ''; From 38e0a8817d4f9688398523ce77bcfc4be993a836 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 8 Mar 2022 09:49:31 +0000 Subject: [PATCH 011/453] Fixing style errors. --- htdocs/product/inventory/inventory.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index ea51080803e..34aca5ef35f 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -302,7 +302,7 @@ if (empty($reshook)) { } } - if($action == 'confirm_deleteline'){ + if ($action == 'confirm_deleteline') { $gotopage = $_SERVER["PHP_SELF"].'?id='.$object->id.'&page='.$page.$paramwithsearch; } @@ -395,7 +395,6 @@ llxHeader('', $langs->trans('Inventory'), $help_url); // Part to show record if ($object->id > 0) { - $res = $object->fetch_optionals(); $head = inventoryPrepareHead($object); @@ -914,7 +913,7 @@ if ($object->id > 0) { $num = $db->num_rows($resql); if (!empty($limit != 0) || $num > $limit || $page) { - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '',$limit); + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num >= $limit), '', '', $limit); } $i = 0; @@ -1061,7 +1060,6 @@ if ($object->id > 0) { }); }); '; - } // End of page From 7a6a980b69fac8d00e548c24f58d3f9c5b29c62d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 Apr 2022 07:36:56 +0000 Subject: [PATCH 012/453] Fixing style errors. --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 05e8e50d514..0ee1806335c 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -1190,7 +1190,7 @@ if ($object->id > 0) { } print ''; -print ''; - - // Part to show record if ($object->id > 0) { $res = $object->fetch_optionals(); @@ -1207,7 +1183,6 @@ print ''; From 7cf581148c74c5e7050558c09ce272a325253689 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Mon, 16 May 2022 12:20:58 +0200 Subject: [PATCH 014/453] change buttons labels --- htdocs/comm/propal/card.php | 535 +++++++++++++++++++++++++----------- 1 file changed, 378 insertions(+), 157 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 0557b54f5b3..8453f13658c 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1,12 +1,12 @@ +/* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2010-2018 Philippe Grand + * Copyright (C) 2010-2021 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013-2014 Florian Henry @@ -14,6 +14,7 @@ * Copyright (C) 2016 Marcos García * Copyright (C) 2018-2021 Frédéric France * Copyright (C) 2020 Nicolas ZABOURI + * Copyright (C) 2022 Gauthier VERDOL * * 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 @@ -80,6 +81,7 @@ $confirm = GETPOST('confirm', 'alpha'); $lineid = GETPOST('lineid', 'int'); $contactid = GETPOST('contactid', 'int'); $projectid = GETPOST('projectid', 'int'); +$rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1; // PDF $hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); @@ -116,12 +118,12 @@ $usercandelete = $user->rights->propal->supprimer; $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate))); -$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send); +$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send))); $usercancreateorder = $user->rights->commande->creer; $usercancreateinvoice = $user->rights->facture->creer; $usercancreatecontract = $user->rights->contrat->creer; -$usercancreateintervention = $user->rights->ficheinter->creer; +$usercancreateintervention = $user->hasRight('ficheinter', 'creer'); $usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php @@ -147,8 +149,23 @@ if ($reshook < 0) { } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/comm/propal/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/comm/propal/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + if ($cancel) { - if (!empty($backtopage)) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { header("Location: ".$backtopage); exit; } @@ -205,7 +222,7 @@ if (empty($reshook)) { } } - $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null)); + $result = $object->createFromClone($user, $socid, (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : null), (GETPOST('update_prices', 'aZ') ? true : false)); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); @@ -231,8 +248,11 @@ if (empty($reshook)) { // Remove line $result = $object->deleteline($lineid); // reorder lines - if ($result) { + if ($result > 0) { $object->line_order(true); + } else { + $langs->load("errors"); + setEventMessages($object->error, $object->errors, 'errors'); } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { @@ -263,10 +283,10 @@ if (empty($reshook)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { @@ -290,7 +310,7 @@ if (empty($reshook)) { } } } elseif ($action == 'setdate' && $usercancreate) { - $datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datep = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($datep)) { $error++; @@ -304,7 +324,7 @@ if (empty($reshook)) { } } } elseif ($action == 'setecheance' && $usercancreate) { - $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); + $result = $object->set_echeance($user, dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'))); if ($result >= 0) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; @@ -327,7 +347,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'setdate_livraison' && $usercancreate) { - $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); + $result = $object->setDeliveryDate($user, dol_mktime(12, 0, 0, GETPOST('date_livraisonmonth', 'int'), GETPOST('date_livraisonday', 'int'), GETPOST('date_livraisonyear', 'int'))); if ($result < 0) { dol_print_error($db, $object->error); } @@ -385,10 +405,11 @@ if (empty($reshook)) { $object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->duree_validite = $duration; $object->cond_reglement_id = GETPOST('cond_reglement_id'); + $object->deposit_percent = GETPOST('cond_reglement_id_deposit_percent', 'alpha'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); - $object->remise_percent = price2num(GETPOST('remise_percent'), 2); - $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU'); + $object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU', 2); // deprecated + $object->remise_percent = price2num(GETPOST('remise_percent'), '', 2); $object->socid = GETPOST('socid', 'int'); $object->contact_id = GETPOST('contactid', 'int'); $object->fk_project = GETPOST('projectid', 'int'); @@ -417,6 +438,7 @@ if (empty($reshook)) { $object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->duree_validite = price2num(GETPOST('duree_validite', 'alpha')); $object->cond_reglement_id = GETPOST('cond_reglement_id', 'int'); + $object->deposit_percent = GETPOST('cond_reglement_id_deposit_percent', 'alpha'); $object->mode_reglement_id = GETPOST('mode_reglement_id', 'int'); $object->fk_account = GETPOST('fk_account', 'int'); $object->contact_id = GETPOST('contactid', 'int'); @@ -670,10 +692,62 @@ if (empty($reshook)) { $error++; } + $deposit = null; + $locationTarget = ''; + + $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); + + if ( + !$error && GETPOST('statut', 'int') == $object::STATUS_SIGNED && GETPOST('generate_deposit', 'alpha') == 'on' + && ! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer) + ) { + require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + + $date = dol_mktime(0, 0, 0, GETPOST('datefmonth', 'int'), GETPOST('datefday', 'int'), GETPOST('datefyear', 'int')); + $forceFields = array(); + + if (GETPOSTISSET('date_pointoftax')) { + $forceFields['date_pointoftax'] = dol_mktime(0, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int')); + } + + $deposit = Facture::createDepositFromOrigin($object, $date, GETPOST('cond_reglement_id', 'int'), $user, 0, GETPOST('validate_generated_deposit', 'alpha') == 'on', $forceFields); + + if ($deposit) { + setEventMessage('DepositGenerated'); + $locationTarget = DOL_URL_ROOT . '/compta/facture/card.php?id=' . $deposit->id; + } else { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + } + } + if (!$error) { $db->commit(); + + if ($deposit && empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $ret = $deposit->fetch($deposit->id); // Reload to get new records + $outputlangs = $langs; + + if ($conf->global->MAIN_MULTILANGS) { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($deposit->thirdparty->default_lang); + $outputlangs->load('products'); + } + + $result = $deposit->generateDocument($deposit->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref); + + if ($result < 0) { + setEventMessages($deposit->error, $deposit->errors, 'errors'); + } + } + + if ($locationTarget) { + header('Location: ' . $locationTarget); + exit; + } } else { $db->rollback(); + $action = ''; } } } @@ -805,7 +879,7 @@ if (empty($reshook)) { } } } - } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') { + } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '' && $usercancreate) { // Define vat_rate $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); $vat_rate = str_replace('*', '', $vat_rate); @@ -814,6 +888,13 @@ if (empty($reshook)) { foreach ($object->lines as $line) { $result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); } + } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('remiseforalllines', 'alpha') !== '' && $usercancreate) { + // Define vat_rate + $remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0); + $remise_percent = str_replace('*', '', $remise_percent); + foreach ($object->lines as $line) { + $result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); + } } elseif ($action == 'addline' && $usercancreate) { // Add line // Set if we used free entry or predefined product $predef = ''; @@ -823,14 +904,14 @@ if (empty($reshook)) { $prod_entry_mode = GETPOST('prod_entry_mode'); if ($prod_entry_mode == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); + $tva_tx = (GETPOST('tva_tx') ? price2num(GETPOST('tva_tx')) : 0); } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } - $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS'); - $remise_percent = price2num(GETPOST('remise_percent'.$predef), 2); + $qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2); + $remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2); if (empty($remise_percent)) { $remise_percent = 0; } @@ -1131,7 +1212,7 @@ if (empty($reshook)) { setEventMessages($mesg, null, 'errors'); } else { // Insert line - $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise); + $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, min($rank, count($object->lines) + 1), 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit, '', 0, $pu_ht_devise); if ($result > 0) { $db->commit(); @@ -1217,6 +1298,8 @@ if (empty($reshook)) { $date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear')); $date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear')); + $remise_percent = price2num(GETPOST('remise_percent'), '', 2); + // Extrafields $extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line); $array_options = $extrafields->getOptionalsFromPost($object->table_element_line); @@ -1229,7 +1312,7 @@ if (empty($reshook)) { } // Define special_code for special lines - $special_code = GETPOST('special_code'); + $special_code = GETPOST('special_code', 'int'); if (!GETPOST('qty')) { $special_code = 3; } @@ -1248,7 +1331,7 @@ if (empty($reshook)) { } $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent'), 2) / 100) < price2num($price_min)))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && ($price_min && (price2num($pu_ht) * (1 - $remise_percent / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; } @@ -1278,7 +1361,7 @@ if (empty($reshook)) { $qty = price2num(GETPOST('qty', 'alpha'), 'MS'); - $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, price2num(GETPOST('remise_percent'), 2), $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise); + $result = $object->updateline(GETPOST('lineid', 'int'), $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $description, 'HT', $info_bits, $special_code, GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $type, $date_start, $date_end, $array_options, GETPOST("units"), $pu_ht_devise); if ($result >= 0) { $db->commit(); @@ -1344,11 +1427,11 @@ if (empty($reshook)) { $result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int')); } elseif ($action == 'setconditions' && $usercancreate) { // Terms of payment - $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); + $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha')); } elseif ($action == 'setremisepercent' && $usercancreate) { - $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'))); + $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2)); } elseif ($action == 'setremiseabsolue' && $usercancreate) { - $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'))); + $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2)); } elseif ($action == 'setmode' && $usercancreate) { // Payment choice $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); @@ -1428,7 +1511,7 @@ if (empty($reshook)) { } // Actions to build doc - $upload_dir = $conf->propal->multidir_output[$object->entity]; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -1508,8 +1591,8 @@ if ($action == 'create') { $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); // TODO maybe add default value option $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); + $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); // deprecated $remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0)); - $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0)); $dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice); @@ -1545,8 +1628,6 @@ if ($action == 'create') { } } - $object = new Propal($db); - print '
'; print ''; print ''; @@ -1562,18 +1643,19 @@ if ($action == 'create') { print ''; // Reference - print ''; + print ''; // Ref customer - print ''; print ''; // Third party - print ''; - print ''; + print ''; + print ''; + $shipping_method_id = 0; if ($socid > 0) { - print ''; @@ -1582,7 +1664,7 @@ if ($action == 'create') { } //$warehouse_id = $soc->warehouse_id; } else { - print ''; // Third party discounts info line - print ''; // Validaty duration - print ''; + print ''; // Terms of payment - print ''; // Mode of payment - print ''; // Bank Account if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && !empty($conf->banque->enabled)) { - print ''; } // Source / Channel - What trigger creation - print ''; // Delivery delay - print ''; @@ -1670,7 +1752,7 @@ if ($action == 'create') { if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { $shipping_method_id = $soc->shipping_method_id; } - print ''; @@ -1680,15 +1762,15 @@ if ($action == 'create') { if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROPAL)) { require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); - print ''; } // Delivery date (or manufacturing) - print ''; - print ''; + print ''; - print ''; + print ''; @@ -1712,45 +1794,45 @@ if ($action == 'create') { // Incoterms if (!empty($conf->incoterm->enabled)) { - print ''; - print ''; - print ''; + print ''; + print ''; } // Template to use by default - print ''; - print ''; - print ''; + print ''; + print '"; // Multicurrency if (!empty($conf->multicurrency->enabled)) { - print ''; - print ''; - print ''; + print ''; + print ''; } // Public note - print ''; - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; print ''; // Payment mode - print ''; - print ''; print ''; } if ($totalVolume) { print ''; print ''; } @@ -2351,18 +2574,18 @@ if ($action == 'create') { print '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('Ref').''.$langs->trans("Draft").'
'.$langs->trans('RefCustomer').''; + print '
'.$langs->trans('RefCustomer').''; print '
'.$langs->trans('Customer').'
'.$langs->trans('Customer').''; + print ''; print $soc->getNomUrl(1); print ''; print ''; + print ''; print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); // reload page to retrieve customer informations if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { @@ -1605,13 +1687,13 @@ if ($action == 'create') { if ($socid > 0) { // Contacts (ask contact only if thirdparty already defined). - print "
".$langs->trans("DefaultContact").''; + print '
'.$langs->trans("DefaultContact").''; print img_picto('', 'contact'); print $form->selectcontacts($soc->id, $contactid, 'contactid', 1, '', '', 0, 'minwidth300'); print '
'.$langs->trans('Discounts').''; + print '
'.$langs->trans('Discounts').''; $absolute_discount = $soc->getAvailableDiscounts(); @@ -1623,45 +1705,45 @@ if ($action == 'create') { } // Date - print '
'.$langs->trans('DatePropal').''; + print '
'.$langs->trans('DatePropal').''; print $form->selectDate('', '', '', '', '', "addprop", 1, 1); print '
'.$langs->trans("ValidityDuration").''.img_picto('', 'clock').'  '.$langs->trans("days").'
'.$langs->trans("ValidityDuration").''.img_picto('', 'clock', 'class="paddingright"').' '.$langs->trans("days").'
'.$langs->trans('PaymentConditionsShort').''; + print '
'.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'paiment'); - $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1); + $form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', 1, 1, 0, '', (GETPOSTISSET('cond_reglement_id_deposit_percent') ? GETPOST('cond_reglement_id_deposit_percent', 'alpha') : $soc->deposit_percent)); print '
'.$langs->trans('PaymentMode').''; - print img_picto('', 'bank').' '; + print '
'.$langs->trans('PaymentMode').''; + print img_picto('', 'bank', 'class="pictofixedwidth"'); $form->select_types_paiements((GETPOSTISSET('mode_reglement_id') ? GETPOST('mode_reglement_id', 'int') : $soc->mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx'); print '
'.$langs->trans('BankAccount').''; + print '
'.$langs->trans('Source').''; + print '
'.$langs->trans('Source').''; print img_picto('', 'question', 'class="pictofixedwidth"'); $form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1, 'maxwidth200 widthcentpercentminusx'); print '
'.$langs->trans('AvailabilityPeriod'); + print '
'.$langs->trans('AvailabilityPeriod'); if (!empty($conf->commande->enabled)) { print ' ('.$langs->trans('AfterOrder').')'; } - print ''; - print img_picto('', 'clock').' '; + print ''; + print img_picto('', 'clock', 'class="pictofixedwidth"'); $form->selectAvailabilityDelay('', 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); print '
'.$langs->trans('SendingMethod').''; + print '
'.$langs->trans('SendingMethod').''; print img_picto('', 'object_dollyrevert', 'class="pictofixedwidth"'); print $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print '
'.$langs->trans('Warehouse').''; + print '
'.$langs->trans('Warehouse').''; print img_picto('', 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($warehouse_id, 'warehouse_id', '', 1, 0, 0, '', 0, 0, array(), 'maxwidth500 widthcentpercentminusxx'); print '
'.$langs->trans("DeliveryDate").''; - if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") { + print '
'.$langs->trans("DeliveryDate").''; + if (isset($conf->global->DATE_LIVRAISON_WEEK_DELAY) && is_numeric($conf->global->DATE_LIVRAISON_WEEK_DELAY)) { $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); @@ -1702,8 +1784,8 @@ if ($action == 'create') { // Project if (!empty($conf->projet->enabled)) { $langs->load("projects"); - print '
'.$langs->trans("Project").''; + print '
'.$langs->trans("Project").''; print img_picto('', 'project', 'class="pictofixedwidth"').$formproject->select_projects(($soc->id > 0 ? $soc->id : -1), $projectid, 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500 widthcentpercentminusxx'); print ' id).'">'; print '
'; + print '
'; print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms) ? $soc->location_incoterms : '')); print '
'.$langs->trans("DefaultModel").''; - print img_picto('', 'pdf').' '; + print '
'.$langs->trans("DefaultModel").''; + print img_picto('', 'pdf', 'class="pictofixedwidth"'); $liste = ModelePDFPropales::liste_modeles($db); - $preselected = ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF); + $preselected = (!empty($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT) ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : getDolGlobalString("PROPALE_ADDON_PDF")); print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); print "
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; - print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); + print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; + print img_picto('', 'currency', 'class="pictofixedwidth"').$form->selectMultiCurrency($currency_code, 'multicurrency_code', 0); print '
'.$langs->trans('NotePublic').''; - $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc) ? $objectsrc->note_public : null)); + print '
'.$langs->trans('NotePublic').''; + $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : null)); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); // Private note if (empty($user->socid)) { - print '
'.$langs->trans('NotePrivate').''; + print '
'.$langs->trans('NotePrivate').''; $note_private = $object->getDefaultCreateValueFor('note_private', ((!empty($origin) && !empty($originid) && is_object($objectsrc)) ? $objectsrc->note_private : null)); $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); @@ -1766,7 +1848,7 @@ if ($action == 'create') { // TODO for compatibility if ($origin == 'contrat') { // Calcul contrat->price (HT), contrat->total (TTC), contrat->tva - $objectsrc->remise_absolue = $remise_absolue; + $objectsrc->remise_absolue = $remise_absolue; // deprecated $objectsrc->remise_percent = $remise_percent; $objectsrc->update_price(1, - 1, 1); } @@ -1863,11 +1945,8 @@ if ($action == 'create') { print dol_get_fiche_end(); $langs->load("bills"); - print '
'; - print ''; - print '     '; - print ''; - print '
'; + + print $form->buttonsSaveCancel("CreateDraft"); print ""; @@ -1879,11 +1958,13 @@ if ($action == 'create') { $title = $langs->trans('ProductsAndServices'); print load_fiche_titre($title); + print '
'; print ''; $objectsrc->printOriginLinesList(); print '
'; + print '
'; } } elseif ($object->id > 0) { /* @@ -1904,8 +1985,8 @@ if ($action == 'create') { $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), - // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) + array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300')), + array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)), ); if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); @@ -1922,6 +2003,129 @@ if ($action == 'create') { } $formquestion[] = array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => ''); // Field to complete private note (not replace) + $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); + + if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) { + require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + + $object->fetchObjectLinked(); + + $eligibleForDepositGeneration = true; + + if (array_key_exists('facture', $object->linkedObjects)) { + foreach ($object->linkedObjects['facture'] as $invoice) { + if ($invoice->type == Facture::TYPE_DEPOSIT) { + $eligibleForDepositGeneration = false; + break; + } + } + } + + if ($eligibleForDepositGeneration && array_key_exists('commande', $object->linkedObjects)) { + foreach ($object->linkedObjects['commande'] as $order) { + $order->fetchObjectLinked(); + + if (array_key_exists('facture', $order->linkedObjects)) { + foreach ($order->linkedObjects['facture'] as $invoice) { + if ($invoice->type == Facture::TYPE_DEPOSIT) { + $eligibleForDepositGeneration = false; + break 2; + } + } + } + } + } + + + if ($eligibleForDepositGeneration) { + $formquestion[] = array( + 'type' => 'checkbox', + 'tdclass' => 'showonlyifsigned', + 'name' => 'generate_deposit', + 'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected')) + ); + + $formquestion[] = array( + 'type' => 'date', + 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', + 'name' => 'datef', + 'label' => $langs->trans('DateInvoice'), + 'value' => dol_now(), + 'datenow' => true + ); + + if (! empty($conf->global->INVOICE_POINTOFTAX_DATE)) { + $formquestion[] = array( + 'type' => 'date', + 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', + 'name' => 'date_pointoftax', + 'label' => $langs->trans('DatePointOfTax'), + 'value' => dol_now(), + 'datenow' => true + ); + } + + ob_start(); + $form->select_conditions_paiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200'); + $paymentTermsSelect = ob_get_clean(); + + $formquestion[] = array( + 'type' => 'other', + 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', + 'name' => 'cond_reglement_id', + 'label' => $langs->trans('PaymentTerm'), + 'value' => $paymentTermsSelect + ); + + $formquestion[] = array( + 'type' => 'checkbox', + 'tdclass' => 'showonlyifgeneratedeposit', + 'name' => 'validate_generated_deposit', + 'label' => $langs->trans('ValidateGeneratedDeposit') + ); + + $formquestion[] = array( + 'type' => 'onecolumn', + 'value' => ' + + ' + ); + } + } + if (!empty($conf->notification->enabled)) { require_once DOL_DOCUMENT_ROOT.'/core/class/notify.class.php'; $notify = new Notify($db); @@ -1950,7 +2154,7 @@ if ($action == 'create') { // We verify whether the object is provisionally numbering $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV') { + if ($ref == 'PROV' || $ref == '') { $numref = $object->getNextNumRef($soc); if (empty($numref)) { $error++; @@ -1968,6 +2172,21 @@ if ($action == 'create') { $text .= $notify->confirmMessage('PROPAL_VALIDATE', $object->socid, $object); } + // mandatoryPeriod + $nbMandated = 0; + foreach ($object->lines as $line) { + $res = $line->fetch_product(); + if ($res > 0 ) { + if ($line->product->isService() && $line->product->isMandatoryPeriod() && (empty($line->date_start) || empty($line->date_end) )) { + $nbMandated++; + break; + } + } + } + if ($nbMandated > 0) { + $text .= '
'.$langs->trans("mandatoryPeriodNeedTobeSetMsgValidate").'
'; + } + if (!$error) { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateProp'), $text, 'confirm_validate', '', 0, 1); } @@ -1995,17 +2214,17 @@ if ($action == 'create') { $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); + $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; } // Project if (!empty($conf->projet->enabled)) { $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; + $morehtmlref .= '
'.$langs->trans('Project').''; if ($usercancreate) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); @@ -2022,9 +2241,10 @@ if ($action == 'create') { if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref .= ''; - $morehtmlref .= $proj->ref; - $morehtmlref .= ''; + $morehtmlref .= ': '.$proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.$proj->title; + } } else { $morehtmlref .= ''; } @@ -2058,6 +2278,8 @@ if ($action == 'create') { $absolute_discount = price2num($absolute_discount, 'MT'); $absolute_creditnote = price2num($absolute_creditnote, 'MT'); + $caneditfield = ($object->statut != Propal::STATUS_SIGNED && $object->statut != Propal::STATUS_BILLED); + $thirdparty = $soc; $discount_type = 0; $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); @@ -2071,17 +2293,17 @@ if ($action == 'create') { print ''; - if ($action != 'editdate' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print ''; + if ($action != 'editdate' && $usercancreate && $caneditfield) { + print ''; } print '
'; print $langs->trans('DatePropal'); print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'id.'">'.img_edit($langs->trans('SetDate'), 1).'
'; print '
'; - if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdate' && $usercancreate) { + if ($action == 'editdate' && $usercancreate && $caneditfield) { print '
'; print ''; print ''; print $form->selectDate($object->date, 're', '', '', 0, "editdate"); - print ''; + print ''; print '
'; } else { if ($object->date) { @@ -2098,17 +2320,17 @@ if ($action == 'create') { print ''; - if ($action != 'editecheance' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print ''; + if ($action != 'editecheance' && $usercancreate && $caneditfield) { + print ''; } print '
'; print $langs->trans('DateEndPropal'); print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; print '
'; - if ($object->statut == Propal::STATUS_DRAFT && $action == 'editecheance' && $usercancreate) { + if ($action == 'editecheance' && $usercancreate && $caneditfield) { print '
'; print ''; print ''; print $form->selectDate($object->fin_validite, 'ech', '', '', '', "editecheance"); - print ''; + print ''; print '
'; } else { if (!empty($object->fin_validite)) { @@ -2128,31 +2350,31 @@ if ($action == 'create') { print ''; - if ($action != 'editconditions' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print ''; + if ($action != 'editconditions' && $usercancreate && $caneditfield) { + print ''; } print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'), 1).'
'; print '
'; - if ($object->statut == Propal::STATUS_DRAFT && $action == 'editconditions' && $usercancreate) { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); + if ($action == 'editconditions' && $usercancreate && $caneditfield) { + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 0, '', 1, $object->deposit_percent); } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none', 0, '', 1, $object->deposit_percent); } print '
'; - print ''; + print ''; print ''; // Delivery delay print ''; if ($action != 'editbankaccount' && $usercancreate) { - print ''; + print ''; } print '
'; + print '
'; + print ''; - if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print ''; + if ($action != 'editmode' && $usercancreate && $caneditfield) { + print ''; } print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'
'; print '
'; - if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) { + if ($action == 'editmode' && $usercancreate && $caneditfield) { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); @@ -2162,26 +2384,27 @@ if ($action == 'create') { // Delivery date $langs->load('deliveries'); print '
'; - print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); - print ''; - print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); + print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate && $caneditfield, 'datepicker'); + print ''; + print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate && $caneditfield, 'datepicker'); print '
'; print ''; - if ($action != 'editavailability' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print ''; + if ($action != 'editavailability' && $usercancreate && $caneditfield) { + print ''; } print '
'; - print $langs->trans('AvailabilityPeriod'); if (!empty($conf->commande->enabled)) { - print ' ('.$langs->trans('AfterOrder').')'; + print $form->textwithpicto($langs->trans('AvailabilityPeriod'), $langs->trans('AvailabilityPeriod').' ('.$langs->trans('AfterOrder').')'); + } else { + print $langs->trans('AvailabilityPeriod'); } print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1).'
'; print '
'; - if ($object->statut == Propal::STATUS_DRAFT && $action == 'editavailability' && $usercancreate) { + if ($action == 'editavailability' && $usercancreate && $caneditfield) { $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1); } else { $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'none', 1); @@ -2193,15 +2416,15 @@ if ($action == 'create') { // Shipping Method if (!empty($conf->expedition->enabled)) { print '
'; - print ''; if ($action != 'editmulticurrencyrate' && $object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) { - print ''; + print ''; } print '
'; + print ''; - if ($action != 'editshippingmethod' && $usercancreate) { - print ''; + if ($action != 'editshippingmethod' && $usercancreate && $caneditfield) { + print ''; } print '
'; print $langs->trans('SendingMethod'); print 'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'
'; print '
'; - if ($action == 'editshippingmethod' && $usercancreate) { + if ($action == 'editshippingmethod' && $usercancreate && $caneditfield) { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); } else { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); @@ -2215,7 +2438,7 @@ if ($action == 'create') { $langs->load('stocks'); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); - print '
'; + print '
'; $editenable = $usercancreate; print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $editenable); print ''; @@ -2230,15 +2453,15 @@ if ($action == 'create') { // Origin of demand print '
'; - print ''; if ($action != 'editmulticurrencycode' && $object->statut == $object::STATUS_DRAFT && $usercancreate) { - print ''; + print ''; } print '
'; + print ''; - if ($action != 'editdemandreason' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print ''; + if ($action != 'editdemandreason' && $usercancreate) { + print ''; } print '
'; print $langs->trans('Source'); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1).'
'; print '
'; - if ($object->statut == Propal::STATUS_DRAFT && $action == 'editdemandreason' && $usercancreate) { + if ($action == 'editdemandreason' && $usercancreate) { $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none'); @@ -2255,7 +2478,7 @@ if ($action == 'create') { print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; print '
'; @@ -2275,7 +2498,7 @@ if ($action == 'create') { print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'
'; print '
'; @@ -2316,7 +2539,7 @@ if ($action == 'create') { print $langs->trans('BankAccount'); print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
'; print '
'; @@ -2335,13 +2558,13 @@ if ($action == 'create') { if ($totalWeight) { print '
'.$langs->trans("CalculatedWeight").''; - print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no', 0); print '
'.$langs->trans("CalculatedVolume").''; - print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no', 0); print '
'; print $langs->trans('IncotermLabel'); print ''; - if ($usercancreate) { - print ''.img_edit().''; + if ($action != 'editincoterm' && $usercancreate && $caneditfield) { + print ''.img_edit().''; } else { print ' '; } print '
'; print ''; print ''; - if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } else { + if ($action == 'editincoterm' && $usercancreate && $caneditfield) { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } else { + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } print ''; } @@ -2374,7 +2597,6 @@ if ($action == 'create') { print ''; print '
'; - print '
'; print '
'; print ''; @@ -2433,7 +2655,6 @@ if ($action == 'create') { $formmargin->displayMarginInfos($object); } - print ''; print ''; print ''; @@ -2521,7 +2742,7 @@ if ($action == 'create') { if (($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0) || ($object->statut == Propal::STATUS_DRAFT && !empty($conf->global->PROPAL_ENABLE_NEGATIVE) && count($object->lines) > 0)) { if ($usercanvalidate) { - print ''.$langs->trans('Validate').''; + print ''.(empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) ? $langs->trans('Validate') : $langs->trans('ValidateAndSign')).''; } else { print ''.$langs->trans('Validate').''; } @@ -2533,12 +2754,12 @@ if ($action == 'create') { }*/ // Edit if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } // ReOpen - if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $usercanclose) { - print 'global->MAIN_JUMP_TAG) ? '' : '#reopen').'"'; + if ( (( ! empty($conf->global->PROPAL_REOPEN_UNSIGNED_ONLY) && $object->statut == Propal::STATUS_NOTSIGNED) || (empty($conf->global->PROPAL_REOPEN_UNSIGNED_ONLY) && ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED))) && $usercanclose) { + print 'global->MAIN_JUMP_TAG) ? '' : '#reopen').'"'; print '>'.$langs->trans('ReOpen').''; } @@ -2546,7 +2767,7 @@ if ($action == 'create') { if (empty($user->socid)) { if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED || !empty($conf->global->PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS)) { if ($usercansend) { - print ''.$langs->trans('SendMail').''; + print ''.$langs->trans('SendMail').''; } else { print ''.$langs->trans('SendMail').''; } @@ -2556,7 +2777,7 @@ if ($action == 'create') { // Create a sale order if (!empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateorder) { - print ''.$langs->trans("AddOrder").''; + print ''.$langs->trans("AddOrder").''; } } @@ -2564,7 +2785,7 @@ if ($action == 'create') { if (!empty($conf->global->WORKFLOW_CAN_CREATE_PURCHASE_ORDER_FROM_PROPOSAL)) { if ($object->statut == Propal::STATUS_SIGNED && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled))) { if ($usercancreatepurchaseorder) { - print ''.$langs->trans("AddPurchaseOrder").''; + print ''.$langs->trans("AddPurchaseOrder").''; } } } @@ -2573,7 +2794,7 @@ if ($action == 'create') { if (!empty($conf->service->enabled) && !empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) { if ($usercancreateintervention) { $langs->load("interventions"); - print ''.$langs->trans("AddIntervention").''; + print ''.$langs->trans("AddIntervention").''; } } @@ -2582,20 +2803,20 @@ if ($action == 'create') { $langs->load("contracts"); if ($usercancreatecontract) { - print ''.$langs->trans('AddContract').''; + print ''.$langs->trans('AddContract').''; } } // Create an invoice and classify billed - if ($object->statut == Propal::STATUS_SIGNED) { + if ($object->statut == Propal::STATUS_SIGNED && empty($conf->global->PROPOSAL_ARE_NOT_BILLABLE)) { if (!empty($conf->facture->enabled) && $usercancreateinvoice) { - print ''.$langs->trans("AddBill").''; + print ''.$langs->trans("CreateBill").''; } $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED)) { if ($usercanclose) { - print 'socid.'">'.$langs->trans("ClassifyBilled").''; + print 'socid.'">'.$langs->trans("ClassifyBilled").''; } else { print ''.$langs->trans("ClassifyBilled").''; } @@ -2606,7 +2827,7 @@ if ($action == 'create') { // Close as accepted/refused if ($object->statut == Propal::STATUS_VALIDATED) { if ($usercanclose) { - print 'global->MAIN_JUMP_TAG) ? '' : '#close').'"'; + print 'global->MAIN_JUMP_TAG) ? '' : '#close').'"'; print '>'.$langs->trans('SetAcceptedRefused').''; } else { print 'statut == Propal::STATUS_DRAFT && $usercanclose) { - print 'global->MAIN_JUMP_TAG) ? '' : '#close') . '"'; - print '>' . $langs->trans('Close') . ''; + print 'global->MAIN_JUMP_TAG) ? '' : '#close') . '"'; + print '>' . $langs->trans('SetRefusedAndClose') . ''; } } // Clone if ($usercancreate) { - print ''.$langs->trans("ToClone").''; + print ''.$langs->trans("ToClone").''; } // Delete if ($usercandelete) { - print ''.$langs->trans('Delete').''; } } @@ -2666,7 +2887,7 @@ if ($action == 'create') { $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList); // Show online signature link - $useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok + $useonlinesignature = 1; if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) { print '
'; @@ -2674,14 +2895,14 @@ if ($action == 'create') { print showOnlineSignatureUrl('proposal', $object->ref).'
'; } - print '
'; + print '
'; // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'propal', $socid, 1); - print '
'; + print ''; } // Presend form From 99efd244d6f3f1ab9dfcb9d8fe1a12b6b7bcb2d2 Mon Sep 17 00:00:00 2001 From: atm-lena Date: Thu, 16 Jun 2022 14:57:32 +0200 Subject: [PATCH 015/453] FIX Page limit GET / POST --- htdocs/product/inventory/inventory.php | 17 +++++++++-------- htdocs/ticket/list.php | 1 - 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index ff21b499912..5e0bf2055e5 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -94,6 +94,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); +//Parameters Page +$param = '&id='.$object->id; +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} +$paramwithsearch = $param; + + if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; @@ -104,12 +112,6 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $now = dol_now(); -//Parameters Page -$param = '&id='.$object->id; -if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); -} -$paramwithsearch = $param; /* @@ -547,8 +549,7 @@ if ($object->id > 0) { print dol_get_fiche_end(); - - print '
'; + print ''; print ''; print ''; print ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index a8314c4bf89..edc42dadccb 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -683,7 +683,6 @@ if ($search_dateclose_end) { $param .= '&search_date_endmonth='.urlencode($tmparray['mon']); $param .= '&search_date_endyear='.urlencode($tmparray['year']); } - // List of mass actions available $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), From 8328923e096809480f45792185e85952dd6adfa0 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Mon, 22 Aug 2022 17:18:31 +0200 Subject: [PATCH 016/453] update date --- htdocs/comm/propal/card.php | 23 +++++++++++++++++++++-- htdocs/comm/propal/class/propal.class.php | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index c05554d2242..ad5722eb187 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -315,9 +315,28 @@ if (empty($reshook)) { } if (!$error) { + if (isset($object->duree_validite) && !empty($object->fin_validite)) { + $object->fin_validite = $datep + ($object->duree_validite * 24 * 3600); + } $result = $object->set_date($user, $datep); if ($result < 0) { dol_print_error($db, $object->error); + } elseif (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $outputlangs = $langs; + $newlang = ''; + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (!empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } + $model = $object->model_pdf; + $ret = $object->fetch($id); // Reload to get new records + if ($ret > 0) { + $object->fetch_thirdparty(); + } + + $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } } } elseif ($action == 'setecheance' && $usercancreate) { @@ -326,8 +345,8 @@ if (empty($reshook)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang = $object->thirdparty->default_lang; if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d0524ec895f..5924cfc9d67 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2066,7 +2066,7 @@ class Propal extends CommonObject $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."',fin_validite = '".$this->db->idate($this->fin_validite)."'"; $sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".self::STATUS_DRAFT; dol_syslog(__METHOD__, LOG_DEBUG); From 5a4d5d7f97e8dd328bb00e5d8b0296f43b61f857 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 23 Aug 2022 08:56:00 +0200 Subject: [PATCH 017/453] set_echeance no in set_date --- htdocs/comm/propal/card.php | 24 +++++++++++++---------- htdocs/comm/propal/class/propal.class.php | 4 ++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index ad5722eb187..c5bf5bbf80f 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -315,10 +315,11 @@ if (empty($reshook)) { } if (!$error) { - if (isset($object->duree_validite) && !empty($object->fin_validite)) { - $object->fin_validite = $datep + ($object->duree_validite * 24 * 3600); - } $result = $object->set_date($user, $datep); + if ($result > 0 && !empty($object->duree_validite) && !empty($object->fin_validite)) { + $datev = $datep + ($object->duree_validite * 24 * 3600); + $result = $object->set_echeance($user, $datev, 1); + } if ($result < 0) { dol_print_error($db, $object->error); } elseif (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { @@ -2301,13 +2302,16 @@ if ($action == 'create') { // Date of proposal print '
'; print ''; print ''; + // Unsubscribe + if (!empty($conf->mailing->enabled)) { + if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) { + print "\n".''."\n"; + } + if (!GETPOSTISSET("no_email") && !empty($object->email)) { + $result = $object->getNoEmail(); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + print ''; + print ''; + print ''; + print ''; + } + // Social networks if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -1931,6 +1990,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL); + $object->no_email = GETPOST("no_email", "int"); $object->url = GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL); $object->capital = GETPOST('capital', 'alphanohtml'); $object->idprof1 = GETPOST('idprof1', 'alphanohtml'); @@ -2272,10 +2332,58 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // EMail / Web - print ''; - print ''; print ''; - print ''; + print ''; + + // EMail + print ''; + print ''; + if (!empty($conf->mailing->enabled)) { + $langs->load("mails"); + print ''; + print ''; + } else { + print ''; + } + print ''; + + // Unsubscribe + if (!empty($conf->mailing->enabled)) { + if ($conf->use_javascript_ajax && isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) { + print "\n".''."\n"; + } + if (!GETPOSTISSET("no_email") && !empty($object->email)) { + $result = $object->getNoEmail(); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + print ''; + print ''; + print ''; + print ''; + } // Social network if (!empty($conf->socialnetworks->enabled)) { @@ -2931,6 +3039,28 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } print ''; + // Email + if (!empty($conf->mailing->enabled)) { + $langs->load("mails"); + print ''; + print ''; + } + + // Unsubscribe opt-out + if (!empty($conf->mailing->enabled)) { + $result = $object->getNoEmail(); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + print ''; + } + // Default language if (!empty($conf->global->MAIN_MULTILANGS)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index a7b78174cf1..123ad09560a 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -230,6 +230,9 @@ class Thirdparties extends DolibarrApi $obj = $this->db->fetch_object($result); $soc_static = new Societe($this->db); if ($soc_static->fetch($obj->rowid)) { + if (isModEnabled('mailing')) { + $soc_static->getNoEmail(); + } $obj_ret[] = $this->_cleanObjectDatas($soc_static); } $i++; @@ -263,6 +266,9 @@ class Thirdparties extends DolibarrApi if ($this->company->create(DolibarrApiAccess::$user) < 0) { throw new RestException(500, 'Error creating thirdparty', array_merge(array($this->company->error), $this->company->errors)); } + if (isModEnabled('mailing') && !empty($this->company->email) && isset($this->company->no_email)) { + $this->company->setNoEmail($this->company->no_email); + } return $this->company->id; } @@ -296,7 +302,11 @@ class Thirdparties extends DolibarrApi $this->company->$field = $value; } - if ($this->company->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) { + if (isModEnabled('mailing') && !empty($this->company->email) && isset($this->company->no_email)) { + $this->company->setNoEmail($this->company->no_email); + } + + if ($this->company->update($id, DolibarrApiAccess::$user, 1, '', '', 'update', 1)) { return $this->get($id); } @@ -1876,6 +1886,9 @@ class Thirdparties extends DolibarrApi if (!DolibarrApi::_checkAccessToResource('societe', $this->company->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login.' on this thirdparty'); } + if (isModEnabled('mailing')) { + $this->company->getNoEmail(); + } if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice From 747db835ae78d7755c82d7b095a29123b4785c26 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 29 Aug 2022 12:47:01 +0000 Subject: [PATCH 020/453] Fixing style errors. --- htdocs/societe/card.php | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 9c049148632..d56f9419989 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -770,7 +770,6 @@ if (empty($reshook)) { $result = $object->update($socid, $user, 1, $object->oldcopy->codeclient_modifiable(), $object->oldcopy->codefournisseur_modifiable(), 'update', 0); if ($result > 0) { - // Update mass emailing flag into table mailing_unsubscribe if (GETPOSTISSET('no_email') && $object->email) { $no_email = GETPOST('no_email', 'int'); @@ -1621,10 +1620,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Unsubscribe - if (!empty($conf->mailing->enabled)) { - if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) { - print "\n".''."\n"; - } - if (!GETPOSTISSET("no_email") && !empty($object->email)) { - $result = $object->getNoEmail(); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } - } - print ''; - print ''; - print ''; - print ''; + print ''."\n"; } + if (!GETPOSTISSET("no_email") && !empty($object->email)) { + $result = $object->getNoEmail(); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + print ''; + print ''; + print ''; + print ''; + } // Social networks if (!empty($conf->socialnetworks->enabled)) { From 09f2140411b0c55417be6cdba9199da0793b1c3c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 29 Aug 2022 14:48:40 +0200 Subject: [PATCH 021/453] Update thirdparties.modules.php --- htdocs/core/modules/mailings/thirdparties.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 0db503b620c..6f694cc0b74 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -81,7 +81,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " AND s.entity IN (".getEntity('societe').")"; $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")"; if (GETPOST('default_lang', 'alpha')) { - //$sql .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'"; + $sql .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'"; } } else { $addFilter = ""; From d41c6a93d31d93ba6a48edef13743e94eb847dec Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 29 Aug 2022 16:23:33 +0200 Subject: [PATCH 022/453] Fix : php 8.1 warn,ings --- htdocs/core/class/html.formticket.class.php | 8 ++++---- htdocs/core/lib/payments.lib.php | 2 +- htdocs/core/lib/ticket.lib.php | 2 +- htdocs/main.inc.php | 2 +- htdocs/public/members/new.php | 8 ++++---- htdocs/public/project/new.php | 2 +- htdocs/public/recruitment/index.php | 3 +++ htdocs/public/ticket/create_ticket.php | 2 ++ htdocs/public/ticket/index.php | 3 ++- 9 files changed, 19 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 83071830ae7..2e4035e2131 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -416,7 +416,7 @@ class FormTicket $toolbarname = 'dolibarr_notes'; if ($this->ispublic) { $toolbarname = 'dolibarr_details'; - print '
'.($conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe')).'
'; + print '
'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'))).'
'; } include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $uselocalbrowser = true; @@ -752,7 +752,7 @@ class FormTicket } } print ''; - if ($user->admin && !$noadmininfo) { + if (isset($user->admin) && $user->admin && !$noadmininfo) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } @@ -864,7 +864,7 @@ class FormTicket } } print ''; - if ($user->admin && !$noadmininfo) { + if (isset($user->admin) && $user->admin && !$noadmininfo) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } @@ -1199,7 +1199,7 @@ class FormTicket } } print ''; - if ($user->admin && !$noadmininfo) { + if (isset($user->admin) && $user->admin && !$noadmininfo) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 5c9d9342b01..1ebca6ba65a 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -482,7 +482,7 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, } // Add other message if VAT exists - if ($object->total_vat != 0 || $object->total_tva != 0) { + if (!empty($object->total_vat) || $object->total_tva != 0) { $parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix; if (!empty($conf->global->$parammessageform)) { print $langs->transnoentities($conf->global->$parammessageform); diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 8ef509057c4..28a443f2034 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -206,7 +206,7 @@ function generate_random_id($car = 16) function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') { global $user, $conf, $langs, $mysoc; - + $urllogo = ""; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1); // Show html headers print ''; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6a0fda06cb0..a45130010a3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1600,7 +1600,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity); } - $themeparam = '?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').'&userid='.$user->id.'&entity='.$conf->entity; + $themeparam = '?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').'&'.(!empty($user->id) ? ('userid='.$user->id.'&') : '').';entity='.$conf->entity; $themeparam .= ($ext ? '&'.$ext : '').'&revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV"); if (GETPOSTISSET('dol_hide_topmenu')) { diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index c409703862c..83941861474 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -475,7 +475,7 @@ print '
'; if (!empty($conf->global->MEMBER_NEWFORM_TEXT)) { print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT)."
\n"; } else { - print $langs->trans("NewSubscriptionDesc", $conf->global->MAIN_INFO_SOCIETE_MAIL)."
\n"; + print $langs->trans("NewSubscriptionDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."
\n"; } print '
'; @@ -568,7 +568,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW // Firstname print '
'."\n"; // EMail - print ''."\n"; // Login @@ -623,7 +623,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW } // Birthday print ''."\n"; // Photo print ''."\n"; @@ -786,7 +786,7 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print max(1, intval($objp->duration)).' '.$units[$unit]; print ''; print '\n"; @@ -806,7 +846,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print $string; print ''; // IBAN - print ''; + // Currency + print ''; + // Edit/Delete print ''; print ''; + // Currency + print ''; + print ''; + + // Country + $account->country_id = $account->country_id ? $account->country_id : $mysoc->country_id; + $selectedcode = $account->country_code; + if (GETPOSTISSET("account_country_id")) { + $selectedcode = GETPOST("account_country_id"); + } elseif (empty($selectedcode)) { + $selectedcode = $mysoc->country_code; + } + $account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules + + print ''; + print ''; + + // State + print ''; + // Show fields of bank account foreach ($account->getFieldsToShow() as $val) { if ($val == 'BankCode') { diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 42164ce8b2c..d18f5feae16 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -134,6 +134,9 @@ class UserBankAccount extends Account $sql .= ",domiciliation='".$this->db->escape($this->domiciliation)."'"; $sql .= ",proprio = '".$this->db->escape($this->proprio)."'"; $sql .= ",owner_address = '".$this->db->escape($this->owner_address)."'"; + $sql .= ",currency_code = '".$this->db->escape($this->currency_code)."'"; + $sql .= ",state_id = ".($this->state_id > 0 ? ((int) $this->state_id) : "null"); + $sql .= ",fk_country = ".($this->country_id > 0 ? ((int) $this->country_id) : "null"); if (trim($this->label) != '') { $sql .= ",label = '".$this->db->escape($this->label)."'"; @@ -165,17 +168,23 @@ class UserBankAccount extends Account return -1; } - $sql = "SELECT rowid, fk_user, entity, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; - $sql .= " owner_address, label, datec, tms as datem"; - $sql .= " FROM ".$this->db->prefix()."user_rib"; + $sql = "SELECT ur.rowid, ur.fk_user, ur.entity, ur.bank, ur.number, ur.code_banque, ur.code_guichet, ur.cle_rib, ur.bic, ur.iban_prefix as iban, ur.domiciliation, ur.proprio"; + $sql .= ", ur.owner_address, ur.label, ur.datec, ur.tms as datem"; + $sql .= ', ur.currency_code, ur.state_id, ur.fk_country as country_id'; + $sql .= ', c.code as country_code, c.label as country'; + $sql .= ', d.code_departement as state_code, d.nom as state'; + $sql .= " FROM ".$this->db->prefix()."user_rib as ur"; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON ur.fk_country=c.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON ur.state_id=d.rowid'; + if ($id) { - $sql .= " WHERE rowid = ".((int) $id); + $sql .= " WHERE ur.rowid = ".((int) $id); } if ($ref) { - $sql .= " WHERE label = '".$this->db->escape($ref)."'"; + $sql .= " WHERE ur.label = '".$this->db->escape($ref)."'"; } if ($userid) { - $sql .= " WHERE fk_user = ".((int) $userid); + $sql .= " WHERE ur.fk_user = ".((int) $userid); } $resql = $this->db->query($sql); @@ -198,6 +207,15 @@ class UserBankAccount extends Account $this->label = $obj->label; $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); + $this->currency_code = $obj->currency_code; + + $this->state_id = $obj->state_id; + $this->state_code = $obj->state_code; + $this->state = $obj->state; + + $this->country_id = $obj->country_id; + $this->country_code = $obj->country_code; + $this->country = $obj->country; } $this->db->free($resql); From 930929ebb6dce7bd8c89463cee6bf64d42b1f050 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 17:57:01 +0200 Subject: [PATCH 024/453] Update agenda.php --- htdocs/societe/agenda.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 89b69bda83c..c0525767527 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -27,12 +27,15 @@ * \brief Page of third party events */ +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -$langs->loadLangs(array("companies", "bills", "propal", "orders")); +// Load translation files required by the page +$langs->loadLangs(array('bills', 'companies', 'orders', 'propal')); + if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); @@ -42,6 +45,7 @@ if (GETPOST('actioncode', 'array')) { } else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } + $search_agenda_label = GETPOST('search_agenda_label'); // Security check From a8d480ee2d063524c035e43ccf51cfc709621ebd Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:55:02 +0200 Subject: [PATCH 025/453] Update index.php --- htdocs/compta/index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 55ee99f4cb6..fefdff4aece 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -31,6 +31,8 @@ * \brief Main page of accountancy area */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -54,6 +56,7 @@ if (!empty($conf->commande->enabled)) { $langs->load("orders"); } +// Get parameters $action = GETPOST('action', 'aZ09'); $bid = GETPOST('bid', 'int'); From ab184bbfda838d09d1edd0b9e927074ff5b3c5bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Aug 2022 01:00:43 +0200 Subject: [PATCH 026/453] Update main.inc.php --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a45130010a3..56a85f5d03d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1600,7 +1600,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity); } - $themeparam = '?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').'&'.(!empty($user->id) ? ('userid='.$user->id.'&') : '').';entity='.$conf->entity; + $themeparam = '?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').(empty($user->id) ? '' : ('&userid='.$user->id) : '').'&entity='.$conf->entity; $themeparam .= ($ext ? '&'.$ext : '').'&revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV"); if (GETPOSTISSET('dol_hide_topmenu')) { From 627b894b71c2bc430f5e92736f4a60f02454d10a Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 30 Aug 2022 08:05:18 +0200 Subject: [PATCH 027/453] Update thirdparties.modules.php --- htdocs/core/modules/mailings/thirdparties.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 6f694cc0b74..008888832cd 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -226,7 +226,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.email <> ''"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0"; + $sql .= " AND EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")"; // La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients return parent::getNbOfRecipients($sql); } From 7dcf8969b9608a789f6ea4b02365e641e7b0dc14 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 30 Aug 2022 08:18:20 +0200 Subject: [PATCH 028/453] Revert "Update thirdparties.modules.php" This reverts commit 627b894b71c2bc430f5e92736f4a60f02454d10a. --- htdocs/core/modules/mailings/thirdparties.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 008888832cd..6f694cc0b74 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -226,7 +226,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.email <> ''"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - $sql .= " AND EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")"; + $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0"; // La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients return parent::getNbOfRecipients($sql); } From b476efe55cf4578cc174e4cecaf1bbdd45928048 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 30 Aug 2022 08:30:13 +0200 Subject: [PATCH 029/453] Revert "Revert "Update thirdparties.modules.php"" This reverts commit 7dcf8969b9608a789f6ea4b02365e641e7b0dc14. --- htdocs/core/modules/mailings/thirdparties.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 6f694cc0b74..008888832cd 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -226,7 +226,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.email <> ''"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0"; + $sql .= " AND EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")"; // La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients return parent::getNbOfRecipients($sql); } From a486e2f91f4f11079b320e3634ef6f1d9bfd4490 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 30 Aug 2022 08:32:12 +0200 Subject: [PATCH 030/453] Update thirdparties.modules.php --- htdocs/core/modules/mailings/thirdparties.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 008888832cd..1d7acf02c09 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -226,7 +226,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.email <> ''"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - $sql .= " AND EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")"; + $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")"; // La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients return parent::getNbOfRecipients($sql); } From 425405a9b2f49915df7cf2cdb06fabcc23973c3c Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Tue, 30 Aug 2022 17:01:20 +0200 Subject: [PATCH 031/453] Product supplier price: autofill default supplier VAT --- htdocs/product/fournisseurs.php | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index c5b8004efa8..237c69ca377 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -506,6 +506,43 @@ if ($id > 0 || $ref) { print ''; } } + print ''; } print ''; From 88b5594af31f54bed54d0c89e61930f78c48404e Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 31 Aug 2022 09:59:24 +0200 Subject: [PATCH 032/453] FIX: Preview button position on documents list (case when the file is too long) --- htdocs/core/class/html.formfile.class.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 349b05416aa..6fe10788c54 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -850,6 +850,7 @@ class FormFile // Show file name with link to download $out .= ''; // Show file size @@ -1307,6 +1307,11 @@ class FormFile // File name print ''; } - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print ''; print ''; - if ($object->elementtype == 'task' && !empty($conf->project->enabled)) { + if ($object->elementtype == 'task' && isModEnabled('project')) { print ''; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); print ''; print ''; print '"; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load('projects'); $formproject = new FormProjets($db); @@ -1368,7 +1368,7 @@ if ($action == 'create') { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->contrat->creer) { From 4e390dd29c26b006d9d3bf587e0fd366ee520861 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:07:15 +0200 Subject: [PATCH 066/453] update code --- htdocs/contrat/contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 1bd9d3388f6..1866fb24c3e 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -154,7 +154,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->contrat->creer) { From 0f080269f1b6b0c397cebea879990a29b28ac7b9 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:07:45 +0200 Subject: [PATCH 067/453] update code --- htdocs/contrat/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index ce386fe21b9..7f38e9561a4 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -144,7 +144,7 @@ if ($object->id) { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->contrat->creer) { From 42597a3ff3958e4fa102a30a6f5752ea9497bbac Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:08:12 +0200 Subject: [PATCH 068/453] update code --- htdocs/contrat/note.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 540491698c1..547604d9f4d 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -27,7 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -111,7 +111,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->contrat->creer) { From e6be63c50a327eca29f199c72547e342ddc1e7c3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:08:38 +0200 Subject: [PATCH 069/453] update code --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 088d8f9b6d5..9a6326db10c 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -233,7 +233,7 @@ class Contrat extends CommonObject 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>75), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>75), 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), From 7a6e8d82d578d95d0b2dc93fd6e50bbf6b019e58 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:09:11 +0200 Subject: [PATCH 070/453] update code --- htdocs/core/actions_massactions.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 3f74ba7fdb2..2854a631e42 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -456,7 +456,7 @@ if (!$error && $massaction == 'confirm_presend') { //var_dump($oneemailperrecipient); var_dump($listofqualifiedobj); var_dump($listofqualifiedref); foreach ($looparray as $objectid => $objecttmp) { // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object // Make substitution in email content - if (!empty($conf->project->enabled) && method_exists($objecttmp, 'fetch_projet') && is_null($objecttmp->project)) { + if (isModEnabled('project') && method_exists($objecttmp, 'fetch_projet') && is_null($objecttmp->project)) { $objecttmp->fetch_projet(); } $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $objecttmp); From 2d2d2546de6546844b6be6a73cb44e3957c3eeff Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:10:05 +0200 Subject: [PATCH 071/453] update code --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 83071830ae7..fbf148c8d1b 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -622,7 +622,7 @@ class FormTicket } if ($subelement != 'project') { - if (!empty($conf->project->enabled) && !$this->ispublic) { + if (isModEnabled('project') && !$this->ispublic) { $formproject = new FormProjets($this->db); print '
'; } - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print "\n"; @@ -639,7 +639,7 @@ if (!empty($id) && $action == 'edit') { print "".''; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); $langs->load('projects'); @@ -700,7 +700,7 @@ if (!empty($id) && $action != 'edit') { $morehtmlref = '
'; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' '; if ($user->rights->don->creer) { From d55b08d2d153b0b1529badb1741089aef72f8755 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:17:53 +0200 Subject: [PATCH 081/453] update code --- htdocs/don/document.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 1bb371c7812..53ca935e5ae 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -99,7 +99,7 @@ if ($action == 'classin' && $user->rights->don->creer) { */ $form = new Form($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -129,7 +129,7 @@ if ($object->id) { $morehtmlref = '
'; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' '; if ($user->rights->don->creer) { From 26cdd4db2ae70f6f770d00cf4a471581be05fa79 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:18:19 +0200 Subject: [PATCH 082/453] update code --- htdocs/don/info.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/don/info.php b/htdocs/don/info.php index 29d8f129036..b19826f9bcd 100644 --- a/htdocs/don/info.php +++ b/htdocs/don/info.php @@ -25,7 +25,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -68,7 +68,7 @@ $help_url = 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones|DE:M llxHeader('', $title, $help_url); $form = new Form($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -82,7 +82,7 @@ $linkback = ''; // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' '; if ($user->rights->don->creer) { From b6f6dd53ef08f25f546a0865a4cc94906c10b622 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:18:47 +0200 Subject: [PATCH 083/453] update code --- htdocs/don/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 68f8ab0bbea..73314d9727c 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -27,7 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -93,7 +93,7 @@ $fieldstosearchall = array( $donationstatic = new Don($db); $form = new Form($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $projectstatic = new Project($db); } @@ -219,7 +219,7 @@ if ($resql) { print '
'; - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print ''; @@ -249,7 +249,7 @@ if ($resql) { } print_liste_field_titre("Name", $_SERVER["PHP_SELF"], "d.lastname", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "d.datedon", "", $param, '', $sortfield, $sortorder, 'center '); - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); print_liste_field_titre("Project", $_SERVER["PHP_SELF"], "d.fk_projet", "", $param, "", $sortfield, $sortorder); } @@ -280,7 +280,7 @@ if ($resql) { } print ""; print ''; - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print "'; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $projectid = GETPOST('projectid', 'int') ?GETPOST('projectid', 'int') : 0; if (empty($projectid) && !empty($object->fk_project)) { $projectid = $object->fk_project; @@ -1732,7 +1732,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if (0) { // Do not change on shipment From 721b5726f1dcc30df6b37ed4827ac434d85b6ea7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:23:14 +0200 Subject: [PATCH 091/453] update code --- htdocs/expedition/contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 112d35a63aa..0659229f55c 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -149,7 +149,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if (0) { // Do not change on shipment From 94f4d500352e3c6e8d13f88044f750b17bba3d6f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:23:39 +0200 Subject: [PATCH 092/453] update code --- htdocs/expedition/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/document.php b/htdocs/expedition/document.php index d0729879017..08f30446f72 100644 --- a/htdocs/expedition/document.php +++ b/htdocs/expedition/document.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -123,7 +123,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if (0) { // Do not change on shipment From d779a42b22b047f24e62dc56d43ca8d1108cc66b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:24:03 +0200 Subject: [PATCH 093/453] update code --- htdocs/expedition/note.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index c8fc0ff35be..b81457141ba 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -27,7 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -110,7 +110,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if (0) { // Do not change on shipment From 162cdcc67687e13ee461426410f5f824f929354f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:24:43 +0200 Subject: [PATCH 094/453] update code --- htdocs/expedition/shipment.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 0be623ab6bf..ae7d522a115 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012-2015 Juanjo Menent * Copyright (C) 2018-2021 Frédéric France - * Copyright (C) 2018 Philippe Grand + * Copyright (C) 2018-2022 Philippe Grand * * 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 @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -227,7 +227,7 @@ if (empty($reshook)) { $form = new Form($db); $formfile = new FormFile($db); $formproduct = new FormProduct($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -287,7 +287,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->commande->creer) { From fd07c5d6a074bdf6ec089f60c7da2ef94b6e5b8c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:25:37 +0200 Subject: [PATCH 095/453] update code --- htdocs/expensereport/card.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 05831c5dd97..25adb1ff232 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -117,7 +117,7 @@ $permissiontoadd = $user->rights->expensereport->creer; // Used by the include o $upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref); -$projectRequired = $conf->project->enabled && ! empty($conf->global->EXPENSEREPORT_PROJECT_IS_REQUIRED); +$projectRequired = isModEnabled('project') && ! empty($conf->global->EXPENSEREPORT_PROJECT_IS_REQUIRED); $fileRequired = !empty($conf->global->EXPENSEREPORT_FILE_IS_REQUIRED); if ($object->id > 0) { @@ -1697,7 +1697,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; @@ -2064,7 +2064,7 @@ if ($action == 'create') { print '
'; //print ''; print ''; - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print ''; } print ''; @@ -2109,7 +2109,7 @@ if ($action == 'create') { print ''; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print ''; // Select project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print ''; @@ -2418,7 +2418,7 @@ if ($action == 'create') { if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { $colspan++; } - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $colspan++; } if ($action != 'editline') { @@ -2495,7 +2495,7 @@ if ($action == 'create') { print ''; print ''; print ''; - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print ''; } print ''; @@ -2524,7 +2524,7 @@ if ($action == 'create') { print ''; // Select project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print ''; From 19e31c0a6f5a7d1b1ffcc3abe6dc9dc528cb8b59 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:26:20 +0200 Subject: [PATCH 096/453] update code --- htdocs/fichinter/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index e2d03790f78..80f78b614b9 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -7,7 +7,7 @@ * Copyright (C) 2014-2018 Ferran Marcet * Copyright (C) 2014-2022 Charlene Benke * Copyright (C) 2015-2016 Abbes Bahfir - * Copyright (C) 2018 Philippe Grand + * Copyright (C) 2018-2022 Philippe Grand * Copyright (C) 2020 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/fichinter/modules_fichinter.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -787,7 +787,7 @@ $formfile = new FormFile($db); if (!empty($conf->contrat->enabled)) { $formcontract = new FormContract($db); } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -908,7 +908,7 @@ if ($action == 'create') { print ''; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); $langs->load("project"); @@ -1159,7 +1159,7 @@ if ($action == 'create') { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->ficheinter->creer) { From 4a7417725cbf079ad9a6ac95e5c2313a80703946 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:26:51 +0200 Subject: [PATCH 097/453] update code --- htdocs/fichinter/contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/contact.php b/htdocs/fichinter/contact.php index ef6ffc80881..8528281c607 100644 --- a/htdocs/fichinter/contact.php +++ b/htdocs/fichinter/contact.php @@ -123,7 +123,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->ficheinter->creer) { From 165d05a8d2e356c922b18261d1f3df94e08eff17 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:27:14 +0200 Subject: [PATCH 098/453] update code --- htdocs/fichinter/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php index d0dd326df07..a2511cfee8f 100644 --- a/htdocs/fichinter/document.php +++ b/htdocs/fichinter/document.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -123,7 +123,7 @@ if ($object->id) { // Thirdparty $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->commande->creer) { From fae96c2077663144d451294a4a42838812a92fb4 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:27:36 +0200 Subject: [PATCH 099/453] update code --- htdocs/fichinter/info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php index 589f1901cd6..a5c0abfeb3d 100644 --- a/htdocs/fichinter/info.php +++ b/htdocs/fichinter/info.php @@ -28,7 +28,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -78,7 +78,7 @@ $morehtmlref = '
'; // Thirdparty $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->commande->creer) { From ee0607ace2ed9437c15e1724404f258a85fe4cd1 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:28:04 +0200 Subject: [PATCH 100/453] update code --- htdocs/eventorganization/conferenceorbooth_contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 33b8f633b3a..c7a2f044e96 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -396,7 +396,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From 8568f66d42dbc3dcb23ab2ea2bfb74feb9b28747 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:29:00 +0200 Subject: [PATCH 101/453] update code --- htdocs/fichinter/list.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index d8bb62f6b5d..733dac71987 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } if (!empty($conf->contrat->enabled)) { @@ -43,7 +43,7 @@ if (!empty($conf->contrat->enabled)) { // Load translation files required by the page $langs->loadLangs(array('companies', 'bills', 'interventions')); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); } if (!empty($conf->contrat->enabled)) { @@ -120,7 +120,7 @@ $arrayfields = array( 'f.ref'=>array('label'=>'Ref', 'checked'=>1), 'f.ref_client'=>array('label'=>'RefCustomer', 'checked'=>1), 's.nom'=>array('label'=>'ThirdParty', 'checked'=>1), - 'pr.ref'=>array('label'=>'Project', 'checked'=>1, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1)), + 'pr.ref'=>array('label'=>'Project', 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1)), 'c.ref'=>array('label'=>'Contract', 'checked'=>1, 'enabled'=>(empty($conf->contrat->enabled) ? 0 : 1)), 'f.description'=>array('label'=>'Description', 'checked'=>1), 'f.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>500), @@ -202,7 +202,7 @@ $form = new Form($db); $formfile = new FormFile($db); $objectstatic = new Fichinter($db); $companystatic = new Societe($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $projetstatic = new Project($db); } if (!empty($conf->contrat->enabled)) { @@ -234,7 +234,7 @@ if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,"; } $sql .= " s.nom as name, s.rowid as socid, s.client, s.fournisseur, s.email, s.status as thirdpartystatus"; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $sql .= ", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title"; } if (!empty($conf->contrat->enabled)) { @@ -251,7 +251,7 @@ $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f"; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr on f.fk_projet = pr.rowid"; } if (!empty($conf->contrat->enabled)) { From 536cff5c3f2dc6c7128c0665893aade23d9a2386 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:29:23 +0200 Subject: [PATCH 102/453] update code --- htdocs/fichinter/note.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php index be5f67da555..3fb2e349c04 100644 --- a/htdocs/fichinter/note.php +++ b/htdocs/fichinter/note.php @@ -27,7 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -88,7 +88,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->commande->creer) { From 0112c6cd71c52a35cc22a62a5c1d797b7c531329 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:29:46 +0200 Subject: [PATCH 103/453] update code --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 61c127cab9b..84cf2ae60b7 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -40,7 +40,7 @@ class Fichinter extends CommonObject public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>20), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>20), 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), From adf50229d1cca5d0219f383ab432817b103aea8d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:30:09 +0200 Subject: [PATCH 104/453] update code --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c794a227afa..c7552960a88 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -218,7 +218,7 @@ class CommandeFournisseur extends CommonOrder 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefOrderSupplierShort', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>1), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>45), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>45), 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60), 'date_approve' =>array('type'=>'datetime', 'label'=>'DateApprove', 'enabled'=>1, 'visible'=>-1, 'position'=>62), 'date_approve2' =>array('type'=>'datetime', 'label'=>'DateApprove2', 'enabled'=>1, 'visible'=>3, 'position'=>64), From 9438b71ebdff1631ad2e0d5466859d375beaa500 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:30:46 +0200 Subject: [PATCH 105/453] update code --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 830430f3730..3bb8aeec677 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -297,7 +297,7 @@ class FactureFournisseur extends CommonInvoice 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>130), 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>135), 'fk_facture_source' =>array('type'=>'integer', 'label'=>'Fk facture source', 'enabled'=>1, 'visible'=>-1, 'position'=>140), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>145), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>145), 'fk_account' =>array('type'=>'integer', 'label'=>'Account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160), From bf6a2d4abe95c9f7a2cc380c28e2edf988952e93 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:31:05 +0200 Subject: [PATCH 106/453] update code --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 31bc37b6e1a..9a9ad1ffe62 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -195,7 +195,7 @@ class FactureFournisseurRec extends CommonInvoice 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>210), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>85), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>85), 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), From 7af33751c65172e926e24e9e3ffd38fc3cb888b7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:31:39 +0200 Subject: [PATCH 107/453] update code --- htdocs/fourn/commande/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 67ec98e3c96..6c2dc24c8a9 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005 Eric Seigne * Copyright (C) 2005-2016 Regis Houssin * Copyright (C) 2010-2015 Juanjo Menent - * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2011-2022 Philippe Grand * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Ion Agorria @@ -49,7 +49,7 @@ if (!empty($conf->supplier_proposal->enabled)) { if (isModEnabled("product")) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -160,7 +160,7 @@ $permissiontoadd = $usercancreate; // Used by the include of actions_addupdatede // Project permission $caneditproject = false; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $caneditproject = empty($conf->global->SUPPLIER_ORDER_FORBID_EDIT_PROJECT) || ($object->statut == CommandeFournisseur::STATUS_DRAFT && preg_match('/^[\(]?PROV/i', $object->ref)); } @@ -1535,7 +1535,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formorder = new FormOrder($db); $productstatic = new Product($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -1750,7 +1750,7 @@ if ($action == 'create') { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); $langs->load('projects'); @@ -2038,7 +2038,7 @@ if ($action == 'create') { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($usercancreate) { From 7af999df44e8b9d3c3cf7e9f6861d9ffab23e31d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:32:05 +0200 Subject: [PATCH 108/453] update code --- htdocs/fourn/commande/contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/contact.php b/htdocs/fourn/commande/contact.php index 3cae4f04c73..32eb55d2d4c 100644 --- a/htdocs/fourn/commande/contact.php +++ b/htdocs/fourn/commande/contact.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -135,7 +135,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { From e4521498c5f797447354635ac99cd64c20b42e95 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:32:33 +0200 Subject: [PATCH 109/453] update code --- htdocs/fourn/commande/dispatch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 2f0f7966679..e7bf8ffde81 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -541,7 +541,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { From 0f4e9d1f85761f7328e14cfe76f1b7f71e6c0fdb Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:33:07 +0200 Subject: [PATCH 110/453] update code --- htdocs/fourn/commande/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/document.php b/htdocs/fourn/commande/document.php index 5a017296887..957fa32867f 100644 --- a/htdocs/fourn/commande/document.php +++ b/htdocs/fourn/commande/document.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -131,7 +131,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { From 75c1d28e1ea4c7956db0bafdbebaf7849f2fa3ed Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:33:30 +0200 Subject: [PATCH 111/453] update code --- htdocs/fourn/commande/info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 18c4f5f2670..27f0483d35a 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -139,7 +139,7 @@ $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_ // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { From 6d826d718aacfc989c577dae0119b9578429c6f0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:33:53 +0200 Subject: [PATCH 112/453] update code --- htdocs/fourn/commande/note.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index cfdea75d9d9..7c19c6c8867 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -28,7 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -106,7 +106,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { From b6b6ff4b6f5bf9e93bf89b54d22d4487ef3089a6 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:35:08 +0200 Subject: [PATCH 113/453] update code --- htdocs/fourn/facture/card-rec.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index e996f29b3c8..ba911234e79 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; -if (! empty($conf->project->enabled)) { +if (isModEnabled('project')) { include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; } require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; @@ -869,7 +869,7 @@ llxHeader('', $langs->trans("RepeatableSupplierInvoice"), $help_url); $form = new Form($db); $formother = new FormOther($db); -if (! empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } $companystatic = new Societe($db); @@ -898,7 +898,7 @@ if ($action == 'create') { print dol_get_fiche_head(null, '', '', 0); $rowspan = 4; - if (! empty($conf->project->enabled)) $rowspan++; + if (isModEnabled('project')) $rowspan++; if ($object->fk_account > 0) $rowspan++; print '
'; - print ''; - if ($action != 'editdate' && $usercancreate && $caneditfield) { - print ''; - } - print '
'; - print $langs->trans('DatePropal'); - print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'
'; + // print ''; + // if ($action != 'editdate' && $usercancreate && $caneditfield) { + // print ''; + // } + + // print '
'; + // print $langs->trans('DatePropal'); + // print 'id.'">'.img_edit($langs->trans('SetDate'), 1).'
'; + $editenable = $usercancreate && $caneditfield && $object->statut == Propal::STATUS_DRAFT; + print $form->editfieldkey("DatePropal", 'date', '', $object, $editenable); print '
'; if ($action == 'editdate' && $usercancreate && $caneditfield) { print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 5924cfc9d67..cd56fac3e7b 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -384,7 +384,7 @@ class Propal extends CommonObject $this->socid = $socid; $this->id = $propalid; - $this->duree_validite = ((int) $conf->global->PROPALE_VALIDITY_DURATION); + $this->duree_validite = isset($conf->global->PROPALE_VALIDITY_DURATION)?((int) $conf->global->PROPALE_VALIDITY_DURATION):0; } @@ -2066,7 +2066,7 @@ class Propal extends CommonObject $this->db->begin(); - $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."',fin_validite = '".$this->db->idate($this->fin_validite)."'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."propal SET datep = '".$this->db->idate($date)."'"; $sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut = ".self::STATUS_DRAFT; dol_syslog(__METHOD__, LOG_DEBUG); From 0ee2fce9a245a4654b8ee9c047c0ece3c1ced7c0 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 29 Aug 2022 14:43:17 +0200 Subject: [PATCH 018/453] NEW manage no email with thirdparties (better for GDPR) --- htdocs/societe/class/societe.class.php | 105 +++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ee2d71f6d12..a3f19f6c183 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4008,6 +4008,111 @@ class Societe extends CommonObject return -1; } + /** + * Return number of mass Emailing received by this contacts with its email + * + * @return int Number of EMailings + */ + public function getNbOfEMailings() + { + $sql = "SELECT count(mc.email) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m"; + $sql .= " WHERE mc.fk_mailing=m.rowid AND mc.email = '".$this->db->escape($this->email)."' "; + $sql .= " AND m.entity IN (".getEntity($this->element).") AND mc.statut NOT IN (-1,0)"; // -1 error, 0 not sent, 1 sent with success + + $resql = $this->db->query($sql); + if ($resql) { + $obj = $this->db->fetch_object($resql); + $nb = $obj->nb; + + $this->db->free($resql); + return $nb; + } else { + $this->error = $this->db->error(); + return -1; + } + } + + /** + * Set "blacklist" mailing status + * + * @param int $no_email 1=Do not send mailing, 0=Ok to recieve mailling + * @return int <0 if KO, >0 if OK + */ + public function setNoEmail($no_email) + { + $error = 0; + + // Update mass emailing flag into table mailing_unsubscribe + if ($this->email) { + $this->db->begin(); + + if ($no_email) { + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE entity IN (".getEntity('mailing', 0).") AND email = '".$this->db->escape($this->email)."'"; + $resql = $this->db->query($sql); + if ($resql) { + $obj = $this->db->fetch_object($resql); + $noemail = $obj->nb; + if (empty($noemail)) { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_unsubscribe(email, entity, date_creat) VALUES ('".$this->db->escape($this->email)."', ".getEntity('mailing', 0).", '".$this->db->idate(dol_now())."')"; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + } + } + } else { + $error++; + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + } + } else { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = '".$this->db->escape($this->email)."' AND entity IN (".getEntity('mailing', 0).")"; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + } + } + + if (empty($error)) { + $this->no_email = $no_email; + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + return $error * -1; + } + } + + return 0; + } + + /** + * get "blacklist" mailing status + * set no_email attribut to 1 or 0 + * + * @return int <0 if KO, >0 if OK + */ + public function getNoEmail() + { + if ($this->email) { + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($this->email)."'"; + $resql = $this->db->query($sql); + if ($resql) { + $obj = $this->db->fetch_object($resql); + $this->no_email = $obj->nb; + return 1; + } else { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->error; + return -1; + } + } + return 0; + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** From 9d74c5c776c7e3066448329246ef88e6e4f7b289 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 29 Aug 2022 14:46:26 +0200 Subject: [PATCH 019/453] wip --- .../modules/mailings/thirdparties.modules.php | 6 +- htdocs/societe/card.php | 136 +++++++++++++++++- .../societe/class/api_thirdparties.class.php | 15 +- 3 files changed, 151 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 89bc2cf2b5e..0db503b620c 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -81,7 +81,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " AND s.entity IN (".getEntity('societe').")"; $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")"; if (GETPOST('default_lang', 'alpha')) { - $sql .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'"; + //$sql .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'"; } } else { $addFilter = ""; @@ -226,7 +226,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE s.email <> ''"; $sql .= " AND s.entity IN (".getEntity('societe').")"; - + $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0"; // La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients return parent::getNbOfRecipients($sql); } @@ -316,11 +316,13 @@ class mailing_thirdparties extends MailingTargets $s .= ''; $s .= ajax_combobox("filter_status_thirdparties"); + if (!empty($conf->global->MAIN_MULTILANGS)) { // Choose language require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($this->db); $s .= ''.$langs->trans("DefaultLang").': '; $s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang_thirdparties', 0, null, 1, 0, 0, '', 0, 0, 0, null, 1); + } return $s; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 5d557d30a02..9c049148632 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -253,6 +253,7 @@ if (empty($reshook)) { // Update $result = $object->update($object->id, $user, 0, 1, 1, 'merge'); + if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -465,6 +466,7 @@ if (empty($reshook)) { $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); $object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)); + $object->no_email = GETPOST("no_email", "int"); $object->url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL)); $object->idprof1 = trim(GETPOST('idprof1', 'alphanohtml')); $object->idprof2 = trim(GETPOST('idprof2', 'alphanohtml')); @@ -600,6 +602,16 @@ if (empty($reshook)) { $result = $object->create($user); + if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) { + // Add mass emailing flag into table mailing_unsubscribe + $result = $object->setNoEmail($object->no_email); + if ($result < 0) { + $error++; + $errors = array_merge($errors, ($object->error ? array($object->error) : $object->errors)); + $action = 'create'; + } + } + if ($result >= 0) { if ($object->particulier) { dol_syslog("We ask to create a contact/address too", LOG_DEBUG); @@ -757,6 +769,24 @@ if (empty($reshook)) { $result = $object->update($socid, $user, 1, $object->oldcopy->codeclient_modifiable(), $object->oldcopy->codefournisseur_modifiable(), 'update', 0); + if ($result > 0) { + + // Update mass emailing flag into table mailing_unsubscribe + if (GETPOSTISSET('no_email') && $object->email) { + $no_email = GETPOST('no_email', 'int'); + $result = $object->setNoEmail($no_email); + if ($result < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'edit'; + } + } + + $action = 'view'; + } else { + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'edit'; + } + if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -1590,6 +1620,35 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'.$form->editfieldkey('Web', 'url', '', $object, 0).''.img_picto('', 'globe', 'class="pictofixedwidth"').'
'; + print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)); + print '
'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').'
'.$form->editfieldkey('EMail', 'email', GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''.img_picto('', 'object_email', 'class="pictofixedwidth"').'
'.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).''.img_picto('', 'globe', 'class="pictofixedwidth"').'
'.img_picto('', 'globe', 'class="pictofixedwidth"').'
'.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).''; + print img_picto('', 'object_email'); + print ''.$langs->trans("NbOfEMailingsSend").''.$object->getNbOfEMailings().'
'; + $useempty = (isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)); + print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty); + print '
'.$langs->trans("NbOfEMailingsSend").''.$object->getNbOfEMailings().'
'.$langs->trans("No_Email").''; + if ($object->email) { + print yn($object->no_email); + } else { + print ''.$langs->trans("EMailNotDefined").''; + } + print '
'.img_picto('', 'globe', 'class="pictofixedwidth"').'
'; - print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)); - print '
'; + print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)); + print '
'.$langs->trans("Firstname").' *
'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').''; + print '
'.$langs->trans("Email").(getDolGlobalString("ADHERENT_MAIL_REQUIRED") ? ' *' : '').''; //print img_picto('', 'email', 'class="pictofixedwidth"'); print '
'.$langs->trans("DateOfBirth").''; - print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); + print $form->selectDate(!empty($birthday) ? $birthday : "", 'birth', 0, 0, 1, "newmember", 1, 0); print '
'.$langs->trans("URLPhoto").'
'; - $displayedamount = max(intval($objp->amount), intval($conf->global->MEMBER_MIN_AMOUNT)); + $displayedamount = max(intval($objp->amount), intval(getDolGlobalInt("MEMBER_MIN_AMOUNT"))); $caneditamount = !empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $objp->caneditamount; if ($objp->subscription) { if ($displayedamount > 0 || !$caneditamount) { diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index 5b0c35c10f3..d984b3346d8 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -423,7 +423,7 @@ print '
'; if (!empty($conf->global->PROJECT_NEWFORM_TEXT)) { print $langs->trans($conf->global->PROJECT_NEWFORM_TEXT)."
\n"; } else { - print $langs->trans("FormForNewLeadDesc", $conf->global->MAIN_INFO_SOCIETE_MAIL)."
\n"; + print $langs->trans("FormForNewLeadDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL"))."
\n"; } print '
'; diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 632a3f57da2..32585c94bb4 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -47,7 +47,10 @@ $langs->loadLangs(array("companies", "other", "recruitment")); // Get parameters $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); +$SECUREKEY = GETPOST("securekey"); +$entity = GETPOST('entity', 'int') ? GETPOST('entity', 'int') : $conf->entity; $backtopage = ''; +$suffix = ""; // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 33b3b8bdccd..4defe2be01f 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -71,6 +71,8 @@ $langs->loadLangs(array('companies', 'other', 'mails', 'ticket')); // Get parameters $id = GETPOST('id', 'int'); $msg_id = GETPOST('msg_id', 'int'); +$socid = GETPOST('socid', 'int'); +$suffix = ""; $action = GETPOST('action', 'aZ09'); diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 4ea314c8149..bff53d91edb 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -59,6 +59,7 @@ $langs->loadLangs(array('companies', 'other', 'ticket', 'errors')); // Get parameters $track_id = GETPOST('track_id', 'alpha'); $action = GETPOST('action', 'aZ09'); +$suffix = ""; if (empty($conf->ticket->enabled)) { accessforbidden('', 0, 0, 1); @@ -82,7 +83,7 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); print '
'; -print '

'.($conf->global->TICKET_PUBLIC_TEXT_HOME ? $conf->global->TICKET_PUBLIC_TEXT_HOME : $langs->trans("TicketPublicDesc")).'

'; +print '

'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", $langs->trans("TicketPublicDesc"))).'

'; print '
'; print '

'.dol_escape_htmltag($langs->trans("CreateTicket")).'
'; print '

'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'
'; From ec764595f8614e10c891b582297fecb7797bc545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 29 Aug 2022 16:59:23 +0200 Subject: [PATCH 023/453] enhance bank display for user --- htdocs/langs/en_US/holiday.lang | 5 +- htdocs/langs/fr_FR/holiday.lang | 1 + htdocs/user/bank.php | 90 ++++++++++++++++++++- htdocs/user/class/userbankaccount.class.php | 30 +++++-- 4 files changed, 115 insertions(+), 11 deletions(-) diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 0ab79985ea7..04f47c8428d 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -1,6 +1,7 @@ # Dolibarr language file - Source file is en_US - holiday HRM=HRM -Holidays=Leave +Holidays=Leaves +Holiday=Leave CPTitreMenu=Leave MenuReportMonth=Monthly statement MenuAddCP=New leave request @@ -147,4 +148,4 @@ XIsAUsualNonWorkingDay=%s is usualy a NON working day BlockHolidayIfNegative=Block if balance negative LeaveRequestCreationBlockedBecauseBalanceIsNegative=The creation of this leave request is blocked because your balance is negative ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted=Leave request %s must be draft, canceled or refused to be deleted -HolidayQtyNotModified=Balance of remaining days for %s has not been changed \ No newline at end of file +HolidayQtyNotModified=Balance of remaining days for %s has not been changed diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index c6671f9f6a3..22720779eaf 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -1,6 +1,7 @@ # Dolibarr language file - Source file is en_US - holiday HRM=GRH Holidays=Congés +Holiday=Congé CPTitreMenu=Demande de congés MenuReportMonth=État mensuel MenuAddCP=Créer demande de congés diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 1b7ca92bbbb..81bf184d391 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -33,6 +33,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; if (!empty($conf->holiday->enabled)) { require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; } @@ -122,6 +124,10 @@ if ($action == 'add' && !$cancel && $permissiontoaddbankaccount) { $account->proprio = GETPOST('proprio', 'alpha'); $account->owner_address = GETPOST('owner_address', 'alpha'); + $account->currency_code = trim(GETPOST("account_currency_code")); + $account->state_id = GETPOST("account_state_id", 'int'); + $account->country_id = GETPOST("account_country_id", 'int'); + $result = $account->create($user); if (!$result) { @@ -192,6 +198,10 @@ if ($action == 'update' && !$cancel && $permissiontoaddbankaccount) { $account->proprio = GETPOST('proprio', 'alpha'); $account->owner_address = GETPOST('owner_address', 'alpha'); + $account->currency_code = trim(GETPOST("account_currency_code")); + $account->state_id = GETPOST("account_state_id", 'int'); + $account->country_id = GETPOST("account_country_id", 'int'); + $result = $account->update($user); if (!$result) { @@ -274,6 +284,7 @@ if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { */ $form = new Form($db); +$formcompany = new FormCompany($db); $childids = $user->getAllChildIds(1); @@ -285,14 +296,42 @@ llxHeader('', $title, $help_url); $head = user_prepare_head($object); if ($id && $bankid && $action == 'edit' && ($user->rights->user->user->creer || $user->rights->hrm->write_personal_information->write)) { - print ''; + if ($conf->use_javascript_ajax) { + print "\n\n"; + } + print ''; print ''; print ''; print ''; print ''; } if ($id && $action == 'create' && $user->rights->user->user->creer) { - print ''; + if ($conf->use_javascript_ajax) { + print "\n\n"; + } + print ''; print ''; print ''; print ''; @@ -772,6 +811,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print_liste_field_titre("RIB"); print_liste_field_titre("IBAN"); print_liste_field_titre("BIC"); + print_liste_field_titre("Currency"); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch '); print "
'.$account->iban; + print ''.getIbanHumanReadable($account); if (!empty($account->iban)) { if (!checkIbanForAccount($account)) { print ' '.img_picto($langs->trans("IbanNotValid"), 'warning'); @@ -822,6 +862,9 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac } print ''.$account->currency_code.''; if ($permissiontoaddbankaccount) { @@ -864,6 +907,47 @@ if ($id && ($action == 'edit' || $action == 'create') && $user->rights->user->us print '
'.$langs->trans("BankName").'
'.$langs->trans("Currency"); + print ''; + print ''; + $selectedcode = $account->currency_code; + if (!$selectedcode) { + $selectedcode = $conf->currency; + } + print img_picto('', 'multicurrency', 'class="pictofixedwidth"'); + print $form->selectCurrency((GETPOSTISSET("account_currency_code") ? GETPOST("account_currency_code") : $selectedcode), 'account_currency_code'); + print '
'.$langs->trans("Country").''; + print img_picto('', 'country', 'class="pictofixedwidth"').$form->select_country($selectedcode, 'account_country_id'); + if ($user->admin) { + print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); + } + print '
'.$langs->trans('State').''; + if ($selectedcode) { + print img_picto('', 'state', 'class="pictofixedwidth"'); + print $formcompany->select_state(GETPOSTISSET("account_state_id") ? GETPOST("account_state_id") : $account->state_id, $selectedcode, 'account_state_id'); + } else { + print $countrynotdefined; + } + print '
'; + $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param, 'paddingright')."\n"; $out .= 'trans("File").': '.$file["name"]); $out .= dol_trunc($file["name"], 150); - $out .= ''."\n"; - $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param); + $out .= ''; $out .= ''; + // Preview link + if (!$editline) { + print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity), 'paddingright') . "\n"; + } + // Show file name with link to download //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; @@ -2097,9 +2098,10 @@ class FormFile * @param string $relativepath Relative path of docs * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) * @param string $param More param on http links + * @param string $moreclass Add more class to class style * @return string $out Output string with HTML */ - public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '') + public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '', $moreclass = '') { global $langs, $conf; @@ -2107,7 +2109,7 @@ class FormFile if ($conf->browser->layout != 'phone' && !empty($conf->use_javascript_ajax)) { $urladvancedpreview = getAdvancedPreviewUrl($modulepart, $relativepath, 1, $param); // Return if a file is qualified for preview. if (count($urladvancedpreview)) { - $out .= ''; + $out .= ''; //$out.= ''; if (empty($ruleforpicto)) { //$out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail'); From 9d57680d8267f82f28c8ee3803128f93b8b55c60 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 31 Aug 2022 20:14:54 +0200 Subject: [PATCH 033/453] FIX double fix --- htdocs/adherents/class/adherent.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 7d3328cde34..f5784b43fb2 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -658,8 +658,6 @@ class Adherent extends CommonObject require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $nbrowsaffected = 0; $error = 0; From 9cf33bb932cc1235ea3b3da6e2223a24910447b8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:41:12 +0200 Subject: [PATCH 034/453] update code --- htdocs/fichinter/card-rec.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index 3f644b074bd..8ffcafcccc1 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -244,7 +244,7 @@ $companystatic = new Societe($db); if (!empty($conf->contrat->enabled)) { $contratstatic = new Contrat($db); } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $projectstatic = new Project($db); } @@ -272,7 +272,7 @@ if ($action == 'create') { print dol_get_fiche_head(); $rowspan = 4; - if (!empty($conf->project->enabled) && $object->fk_project > 0) { + if (isModEnabled('project') && $object->fk_project > 0) { $rowspan++; } if (!empty($conf->contrat->enabled) && $object->fk_contrat > 0) { @@ -314,7 +314,7 @@ if ($action == 'create') { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); print "
".$langs->trans("Project").""; $projectid = GETPOST('projectid') ?GETPOST('projectid') : $object->fk_project; @@ -484,7 +484,7 @@ if ($action == 'create') { $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; @@ -803,7 +803,7 @@ if ($action == 'create') { if (!empty($conf->contrat->enabled)) { print_liste_field_titre("Contract", $_SERVER['PHP_SELF'], "f.fk_contrat", "", "", 'width="100px"', $sortfield, $sortorder, 'left '); } - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { print_liste_field_titre("Project", $_SERVER['PHP_SELF'], "f.fk_project", "", "", 'width="100px"', $sortfield, $sortorder, 'left '); } print_liste_field_titre("Duration", $_SERVER['PHP_SELF'], 'f.duree', '', '', 'width="50px"', $sortfield, $sortorder, 'right '); @@ -842,7 +842,7 @@ if ($action == 'create') { } print '
'; if ($objp->fk_project > 0) { $projectstatic->fetch($objp->fk_project); From e13a276a2e45ea9806ce6d0d021a53a150c3433b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:42:34 +0200 Subject: [PATCH 035/453] update code --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index e2b8ace4783..efe7a9e7088 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -511,7 +511,7 @@ $tabcond[25] = !empty($conf->website->enabled); //$tabcond[26]= isModEnabled("product"); $tabcond[27] = isModEnabled("societe"); $tabcond[28] = !empty($conf->holiday->enabled); -$tabcond[29] = !empty($conf->project->enabled); +$tabcond[29] = isModEnabled('project'); $tabcond[30] = !empty($conf->label->enabled); //$tabcond[31]= !empty($conf->accounting->enabled); $tabcond[32] = (!empty($conf->holiday->enabled) || !empty($conf->hrm->enabled)); From 93a441197049cb6d1709304bbd0df5b364fd65e8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:46:25 +0200 Subject: [PATCH 036/453] update code --- htdocs/admin/mails_templates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 7f60b2260d7..651118d8c6a 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -188,7 +188,7 @@ if (!empty($conf->recruitment->enabled) && !empty($user->rights->recruitment->re if (isModEnabled("societe") && !empty($user->rights->societe->lire)) { $elementList['thirdparty'] = img_picto('', 'company', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToThirdparty')); } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $elementList['project'] = img_picto('', 'project', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToProject')); } if (isModEnabled("propal") && !empty($user->rights->propal->lire)) { From 4dbb6cfa6e8aecb3ccd0c8cbc13380ccb4c82ef9 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:47:03 +0200 Subject: [PATCH 037/453] update code --- htdocs/bom/bom_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index d2c64eea0b6..3c2f3e732ba 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -150,7 +150,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From 04679ac000ae72feffabbae8b919b4fb525e0da7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:47:33 +0200 Subject: [PATCH 038/453] update code --- htdocs/bom/bom_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index f088ae34050..c39711ce296 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -457,7 +457,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From 6e6b0d16cc04dc88f40434807cce885c95fcc49f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:48:00 +0200 Subject: [PATCH 039/453] update code --- htdocs/comm/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index ec8ebdd67e6..7c1d9da7e29 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -78,7 +78,7 @@ if (isModEnabled("expedition")) { if (isModEnabled('facture')) { $langs->load("bills"); } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); } if (!empty($conf->ficheinter->enabled)) { From 1ab949b3c45b72c34713aef6ece166936092cfab Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:48:32 +0200 Subject: [PATCH 040/453] update code --- htdocs/comm/action/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 6f6ddc5383e..380c5813155 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1411,7 +1411,7 @@ if ($action == 'create') { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $projectid = GETPOST('projectid', 'int'); @@ -1914,7 +1914,7 @@ if ($id > 0) { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); print '
'.$langs->trans("Project").''; @@ -1939,7 +1939,7 @@ if ($id > 0) { print '
'.$langs->trans("LinkedObject").''; $urloption = '?action=create&donotclearsession=1'; // we use create not edit for more flexibility @@ -2132,7 +2132,7 @@ if ($id > 0) { // Thirdparty //$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); //$morehtmlref.='
'.$langs->trans('Project') . ' '; $morehtmlref .= $langs->trans('Project').' '; From da5fb7047356c223fde7da9824082c3348b2d281 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:49:06 +0200 Subject: [PATCH 041/453] update code --- htdocs/comm/action/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 90ed4ea1944..ada742f9742 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -159,7 +159,7 @@ if ($object->id > 0) { // Thirdparty //$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); //$morehtmlref.='
'.$langs->trans('Project') . ' '; $morehtmlref .= $langs->trans('Project').': '; From 1f3c39090732e396d852f54ab11d39f3eb23a0b8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:49:38 +0200 Subject: [PATCH 042/453] update code --- htdocs/comm/action/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 7fb2f0f129e..278096b3b75 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } From 990ff193aa5981058c4cf5354ae7b146b6981b67 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:50:12 +0200 Subject: [PATCH 043/453] update code --- htdocs/comm/action/info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 0ea24279df4..73acc0e7c82 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -86,7 +86,7 @@ $morehtmlref = '
'; // Thirdparty //$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); //$morehtmlref.='
'.$langs->trans('Project') . ' '; $morehtmlref .= $langs->trans('Project').': '; From 37a2cc3052ea3ae02694774879ae5443eb067b66 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:50:58 +0200 Subject: [PATCH 044/453] update code --- htdocs/comm/propal/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e02ff5d8875..3c93332ab29 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2010-2021 Philippe Grand + * Copyright (C) 2010-2022 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013-2014 Florian Henry @@ -49,7 +49,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -1574,7 +1574,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formpropal = new FormPropal($db); $formmargin = new FormMargin($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -1835,7 +1835,7 @@ if ($action == 'create') { print '
'.$langs->trans("Project").''; @@ -2267,7 +2267,7 @@ if ($action == 'create') { $morehtmlref .= ' ('.$langs->trans("OtherProposals").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').''; if ($usercancreate) { From 1acc9bb99c0192765153a4052d50b241b46211e4 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:51:32 +0200 Subject: [PATCH 045/453] update code --- htdocs/comm/propal/contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 52318684f42..2497ba905a8 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Patrick Rouillon * Copyright (C) 2005-2016 Destailleur Laurent * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2022 Philippe Grand * * 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 @@ -138,7 +138,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->propal->creer) { From fa34b7ac204f133dbc55a4ba2ef25a1ee9b7c24b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:52:00 +0200 Subject: [PATCH 046/453] update code --- htdocs/comm/propal/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 35ab2e28b49..6f17c655e82 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -136,7 +136,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer'); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->propal->creer) { From 50728f4b22641bc2e9120fa40ad9a9a7b433f348 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:52:34 +0200 Subject: [PATCH 047/453] update code --- htdocs/comm/propal/info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index 92285183cf2..c67ec346ecb 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -28,7 +28,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -83,7 +83,7 @@ $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_cl // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->propal->creer) { From 97013cc956465bbd399c6b5935c813e6f1e2e56d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:53:29 +0200 Subject: [PATCH 048/453] update code --- htdocs/comm/propal/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 6b717d3ea6f..f7e54d18fc1 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -204,8 +204,8 @@ $checkedtypetiers = 0; $arrayfields = array( 'p.ref'=>array('label'=>"Ref", 'checked'=>1), 'p.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1), - 'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1)), - 'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1)), + 'pr.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1)), + 'pr.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1)), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1), 's.town'=>array('label'=>"Town", 'checked'=>-1), From 8d73d2ecd595dd0c5ee7840e5a997c64e5a79091 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:54:11 +0200 Subject: [PATCH 049/453] update code --- htdocs/comm/propal/note.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index 28819123cb0..2b007ab3fa0 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -29,7 +29,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -108,7 +108,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->propal->creer) { From 50e96a635687359f4c169e162eb45cc77576f0e3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:55:01 +0200 Subject: [PATCH 050/453] update code --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index aa7753946a7..9e4001c3274 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1364,7 +1364,7 @@ class Propal extends CommonObject $object->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); $object->fk_delivery_address = ''; - /*if (!empty($conf->project->enabled)) + /*if (isModEnabled('project')) { $project = new Project($db); if ($this->fk_project > 0 && $project->fetch($this->fk_project)) { From f26b1cccdcae025d86bb61c40f048c37780bd317 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:55:54 +0200 Subject: [PATCH 051/453] update code --- htdocs/commande/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b97bf147dbb..f07f6d0ec43 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2019 Philippe Grand + * Copyright (C) 2011-2022 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2012 Cedric Salvador @@ -52,7 +52,7 @@ if (isModEnabled("propal")) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -1569,7 +1569,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formorder = new FormOrder($db); $formmargin = new FormMargin($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -1854,7 +1854,7 @@ if ($action == 'create' && $usercancreate) { // TODO How record was recorded OrderMode (llx_c_input_method) // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); print '
'.$langs->trans("Project").''; @@ -2327,7 +2327,7 @@ if ($action == 'create' && $usercancreate) { $morehtmlref .= ' ('.$langs->trans("OtherOrders").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($usercancreate) { From c86617c7b1d49e19eb780e7c35710647ae5ab1d2 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:56:30 +0200 Subject: [PATCH 052/453] update code --- htdocs/commande/contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index c9ef518d1d0..1be1384df30 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -2,7 +2,7 @@ /* Copyright (C) 2005 Patrick Rouillon * Copyright (C) 2005-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2015 Philippe Grand + * Copyright (C) 2011-2022 Philippe Grand * Copyright (C) 2021 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -131,7 +131,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->commande->creer) { From 18fba7a8e7114c8a7887cf8bbbff3c5470a4af8f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:56:58 +0200 Subject: [PATCH 053/453] update code --- htdocs/commande/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index af04389b8d9..501a803b697 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -130,7 +130,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->commande->creer) { From 1b7934062fb21c8f2bb1713c9843b2f2c65b154b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:57:27 +0200 Subject: [PATCH 054/453] update code --- htdocs/commande/info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 93b80b80f1c..396052082c5 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -27,7 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -83,7 +83,7 @@ $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_cl // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->commande->creer) { From b04125f9f950b7a44dbdaef362015aaf8a9a1160 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:58:38 +0200 Subject: [PATCH 055/453] update code --- htdocs/commande/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 4ba2f410cc9..03569128fe3 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -170,8 +170,8 @@ $checkedtypetiers = 0; $arrayfields = array( 'c.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>5), 'c.ref_client'=>array('label'=>"RefCustomerOrder", 'checked'=>-1, 'position'=>10), - 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>-1, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1), 'position'=>20), - 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1), 'position'=>25), + 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>-1, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>20), + 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>25), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30), 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1, 'position'=>31), 's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>35), From 52fed85676d5a9d945e2274ad95adb84bda7026d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 21:59:06 +0200 Subject: [PATCH 056/453] update code --- htdocs/commande/note.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index 934299377e5..2082e356797 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -28,7 +28,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -102,7 +102,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->commande->creer) { From b5b9871c115461f293efec193e0aa5526aafa81c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:00:12 +0200 Subject: [PATCH 057/453] update code --- htdocs/compta/accounting-files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 688b0fd544b..4e7ab4802b7 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -48,7 +48,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/paymentloan.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } From fd707eede1dc26203dd3b86b07930a3a32ca604a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:01:21 +0200 Subject: [PATCH 058/453] update code --- htdocs/compta/bank/various_payment/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 6644a81f62a..fe9bb032fa8 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -151,7 +151,7 @@ $arrayfields = array( 'datep' =>array('label'=>"DatePayment", 'checked'=>1, 'position'=>120), 'datev' =>array('label'=>"DateValue", 'checked'=>-1, 'position'=>130), 'type' =>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>140), - 'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>!empty($conf->project->enabled)), + 'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>isModEnabled('project')), 'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>isModEnabled("banque")), 'entry' =>array('label'=>"BankTransactionLine", 'checked'=>1, 'position'=>310, "enabled"=>isModEnabled("banque")), 'account' =>array('label'=>"AccountAccountingShort", 'checked'=>1, 'position'=>400, "enabled"=>isModEnabled('accounting')), From 628ed5495571e8463da5ac35b1b6af32b58c0ba8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:02:34 +0200 Subject: [PATCH 059/453] update code --- htdocs/comm/propal/class/propal.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 9e4001c3274..3bb8a5b44de 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2020 Juanjo Menent - * Copyright (C) 2010-2017 Philippe Grand + * Copyright (C) 2010-2022 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry @@ -297,7 +297,7 @@ class Propal extends CommonObject 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>24), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>24), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60), From 81c13bcc4c84959ee05df21256b58a0687cce1b1 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:03:33 +0200 Subject: [PATCH 060/453] update code --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index bf97deb3fd8..10cd8357e21 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -314,7 +314,7 @@ class Commande extends CommonOrder 'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>25), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>25), 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60), 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62), 'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65), From b0ec6adf6b30288019ea91ecaba89a6d1eb892d8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:04:45 +0200 Subject: [PATCH 061/453] update code --- htdocs/compta/sociales/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 520f074a0c1..f36694bb3b2 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -100,7 +100,7 @@ $arrayfields = array( 'cs.fk_type' =>array('label'=>"Type", 'checked'=>1, 'position'=>30), 'cs.date_ech' =>array('label'=>"Date", 'checked'=>1, 'position'=>40), 'cs.periode' =>array('label'=>"PeriodEndDate", 'checked'=>1, 'position'=>50), - 'p.ref' =>array('label'=>"ProjectRef", 'checked'=>1, 'position'=>60, 'enable'=>(!empty($conf->project->enabled))), + 'p.ref' =>array('label'=>"ProjectRef", 'checked'=>1, 'position'=>60, 'enable'=>(isModEnabled('project'))), 'cs.fk_user' =>array('label'=>"Employee", 'checked'=>1, 'position'=>70), 'cs.fk_mode_reglement' =>array('checked'=>-1, 'position'=>80, 'label'=>"DefaultPaymentMode"), 'cs.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>100), From d44a75d7c9f05a8edfc332dc6c19dcc77d20f78b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:05:18 +0200 Subject: [PATCH 062/453] update code --- htdocs/compta/facture/class/facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index f15f65954cf..2809b586ea1 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>85), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>85), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100), From 8a73872130ac3d8a1130873119c80d2f8178843b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:05:44 +0200 Subject: [PATCH 063/453] update code --- htdocs/compta/facture/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 51257583ef7..5e8507e7229 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -215,8 +215,8 @@ $arrayfields = array( 'f.date_valid'=>array('label'=>"DateValidation", 'checked'=>0, 'position'=>22), 'f.date_lim_reglement'=>array('label'=>"DateDue", 'checked'=>1, 'position'=>25), 'f.date_closing'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>30), - 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1), 'position'=>40), - 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(empty($conf->project->enabled) ? 0 : 1), 'position'=>41), + 'p.ref'=>array('label'=>"ProjectRef", 'checked'=>1, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>40), + 'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>41), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>50), 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1, 'position'=>51), 's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>55), From 7929f752dcaff04eeb33baa129fb45cf6201baee Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:06:11 +0200 Subject: [PATCH 064/453] update code --- htdocs/contrat/agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index a8dc5e7ee3b..da28bdca8bf 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -110,7 +110,7 @@ if (empty($reshook)) { $form = new Form($db); $formfile = new FormFile($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -171,7 +171,7 @@ if ($id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->contrat->creer) { From d8a25f1b9dae8c14520d21021056aea120bf16bc Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:06:49 +0200 Subject: [PATCH 065/453] update code --- htdocs/contrat/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 439f312bef6..2b724d006d7 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; if (isModEnabled("propal")) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -1045,7 +1045,7 @@ llxHeader('', $langs->trans("Contract"), $help_url); $form = new Form($db); $formfile = new FormFile($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -1204,7 +1204,7 @@ if ($action == 'create') { print "
'; print img_picto('', 'project').$formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 1, 0, 'maxwidth500'); From 033597082017a7f4e51f20b057ad8e8bf5f483a8 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:10:38 +0200 Subject: [PATCH 072/453] update code --- htdocs/core/lib/company.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 6ba3ca18094..b6900ae22b5 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -138,7 +138,7 @@ function societe_prepare_head(Societe $object) $h++; } - if (!empty($conf->project->enabled) && (!empty($user->rights->projet->lire))) { + if (isModEnabled('project') && (!empty($user->rights->projet->lire))) { $nbProject = 0; // Enable caching of thirdrparty count projects require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; @@ -781,11 +781,11 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel $i = -1; - if (!empty($conf->project->enabled) && $user->rights->projet->lire) { + if (isModEnabled('project') && $user->rights->projet->lire) { $langs->load("projects"); $newcardbutton = ''; - if (!empty($conf->project->enabled) && $user->rights->projet->creer && empty($nocreatelink)) { + if (isModEnabled('project') && $user->rights->projet->creer && empty($nocreatelink)) { $newcardbutton .= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage)); } From 1530361963053dc0ec5bce6ad9a0bd51a1afee43 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:11:06 +0200 Subject: [PATCH 073/453] update code --- htdocs/core/lib/contact.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index ad9c47f4c48..322f1cdbb0e 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -57,7 +57,7 @@ function contact_prepare_head(Contact $object) $head[$tab][2] = 'perso'; $tab++; - if (!empty($conf->project->enabled) && $user->hasRight('project', 'lire')) { + if (isModEnabled('project') && $user->hasRight('project', 'lire')) { $nbProject = 0; // Enable caching of thirdrparty count projects require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; @@ -170,11 +170,11 @@ function show_contacts_projects($conf, $langs, $db, $object, $backtopage = '', $ $i = -1; - if (!empty($conf->project->enabled) && $user->rights->projet->lire) { + if (isModEnabled('project') && $user->rights->projet->lire) { $langs->load("projects"); $newcardbutton = ''; - if (!empty($conf->project->enabled) && $user->rights->projet->creer && empty($nocreatelink)) { + if (isModEnabled('project') && $user->rights->projet->creer && empty($nocreatelink)) { $newcardbutton .= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage)); } From 6fc7c9bca8b7c05f33c422e8595d92c3107c2d84 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:11:46 +0200 Subject: [PATCH 074/453] update code --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 53204c4cc41..c82e7deaa5d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7398,7 +7398,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__CANDIDATE_FIRSTNAME__'] = '__CANDIDATE_FIRSTNAME__'; $substitutionarray['__CANDIDATE_LASTNAME__'] = '__CANDIDATE_LASTNAME__'; } - if (!empty($conf->project->enabled)) { // Most objects + if (isModEnabled('project')) { // Most objects $substitutionarray['__PROJECT_ID__'] = '__PROJECT_ID__'; $substitutionarray['__PROJECT_REF__'] = '__PROJECT_REF__'; $substitutionarray['__PROJECT_NAME__'] = '__PROJECT_NAME__'; From 886cb4f0836f926457bdbbe5818e26c3067a9327 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:12:10 +0200 Subject: [PATCH 075/453] update code --- htdocs/core/lib/project.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 8e514a505bf..226a6a6d7cd 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -186,7 +186,7 @@ function project_prepare_head(Project $project, $moreparam = '') if (!empty($conf->tax->enabled)) { $nbElements += $project->getElementCount('chargesociales', 'chargesociales'); } - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $nbElements += $project->getElementCount('project_task', 'projet_task'); } if (!empty($conf->stock->enabled)) { From 01f3d626f2faf3ca9004d2a0353810164aa5ba52 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:12:45 +0200 Subject: [PATCH 076/453] update code --- htdocs/core/lib/security.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 79b020b4883..d0067d7575b 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -876,7 +876,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $checkonentitydone = 1; } if (in_array($feature, $checkproject) && $objectid > 0) { - if (!empty($conf->project->enabled) && empty($user->rights->projet->all->lire)) { + if (isModEnabled('project') && empty($user->rights->projet->all->lire)) { $projectid = $objectid; include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -897,7 +897,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl $checkonentitydone = 1; } if (in_array($feature, $checktask) && $objectid > 0) { - if (!empty($conf->project->enabled) && empty($user->rights->projet->all->lire)) { + if (isModEnabled('project') && empty($user->rights->projet->all->lire)) { $task = new Task($db); $task->fetch($objectid); $projectid = $task->fk_project; From 99d30d08adbafc6c698f4d928434e3b32a10212f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:15:17 +0200 Subject: [PATCH 077/453] update code --- htdocs/core/modules/modCategorie.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index e70cdad999e..6a7ddc8a864 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -145,7 +145,7 @@ class modCategorie extends DolibarrModules if (!empty($conf->bank->enabled)) { $typeexample .= ($typeexample ? " / " : "")."5=Bank account"; } - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $typeexample .= ($typeexample ? " / " : "")."6=Project"; } if (!empty($conf->user->enabled)) { @@ -179,7 +179,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_0_'.Categorie::$MAP_ID_TO_CODE[0]; $this->export_label[$r] = 'CatProdList'; $this->export_icon[$r] = $this->picto; - $this->export_enabled[$r] = 'isModEnabled("product") || !empty($conf->service->abled)'; + $this->export_enabled[$r] = 'isModEnabled("product") || !empty($conf->service->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export")); $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label'); $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 'p.label'=>'Text'); @@ -379,7 +379,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_6_'.Categorie::$MAP_ID_TO_CODE[6]; $this->export_label[$r] = 'CatProjectsList'; $this->export_icon[$r] = $this->picto; - $this->export_enabled[$r] = '!empty($conf->project->enabled)'; + $this->export_enabled[$r] = 'isModEnabled('project')'; $this->export_permission[$r] = array(array("categorie", "lire"), array("projet", "export")); $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name"); $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"Numeric", 's.nom'=>"Text"); @@ -568,7 +568,7 @@ class modCategorie extends DolibarrModules // 5 Bank accounts, TODO ? // 6 Projects - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $r++; $this->import_code[$r] = $this->rights_class.'_6_'.Categorie::$MAP_ID_TO_CODE[6]; $this->import_label[$r] = "CatProjectsLinks"; // Translation key From 948f3964bec54dbc1874f26b87d2fb7211daea0f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:16:24 +0200 Subject: [PATCH 078/453] update code --- .../modules/expensereport/doc/pdf_standard.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 365a2326281..f6536cbb1df 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -1,7 +1,7 @@ * Copyright (C) 2015 Alexandre Spangaro - * Copyright (C) 2016-2021 Philippe Grand + * Copyright (C) 2016-2022 Philippe Grand * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 Francis Appels * Copyright (C) 2019 Markus Welters @@ -152,7 +152,7 @@ class pdf_standard extends ModeleExpenseReport $this->posxqty = 150; $this->postotalht = 160; $this->postotalttc = 180; - // if (empty($conf->project->enabled)) { + // if (!isModEnabled('project')) { // $this->posxtva-=20; // $this->posxup-=20; // $this->posxqty-=20; @@ -584,7 +584,7 @@ class pdf_standard extends ModeleExpenseReport if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $nextColumnPosX = $this->posxtva; } - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $nextColumnPosX = $this->posxprojet; } @@ -600,7 +600,7 @@ class pdf_standard extends ModeleExpenseReport //$pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, $expensereporttypecodetoshow, 0, 'C'); // Project - //if (! empty($conf->project->enabled)) + //if (isModEnabled('project')) //{ // $pdf->SetFont('','', $default_font_size - 1); // $pdf->SetXY($this->posxprojet, $curY); @@ -958,7 +958,7 @@ class pdf_standard extends ModeleExpenseReport // $pdf->MultiCell($this->posxprojet-$this->posxtype - 1, 2, $outputlangs->transnoentities("Type"), '', 'C'); //} - //if (!empty($conf->project->enabled)) + //if (isModEnabled('project')) //{ // // Project // $pdf->line($this->posxprojet - 1, $tab_top, $this->posxprojet - 1, $tab_top + $tab_height); From d5c251ec2333e6881cb10dac1c7a61b0b9677537 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:16:52 +0200 Subject: [PATCH 079/453] update code --- htdocs/delivery/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 108f81751b3..776b02c832e 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -43,7 +43,7 @@ if (!empty($conf->expedition_bon->enabled)) { if (!empty($conf->stock->enabled)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -328,7 +328,7 @@ if ($action == 'create') { // Create. Seems to no be used // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$expedition->thirdparty->getNomUrl(1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if (0) { // Do not change on shipment From f547873f9ac14c8da5be75d3c0c446292da94ee2 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:17:23 +0200 Subject: [PATCH 080/453] update code --- htdocs/don/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/don/card.php b/htdocs/don/card.php index bf9ba2e6388..2ae4c8fac36 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -382,7 +382,7 @@ llxHeader('', $title, $help_url); $form = new Form($db); $formfile = new FormFile($db); $formcompany = new FormCompany($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -511,7 +511,7 @@ if ($action == 'create') { print '
".$langs->trans("Project").""; $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); print "
'.$langs->trans("Status").''.$object->getLibStatut(4).'
'; print ' '; print ''; print ' '; print '".$donationstatic->getFullName($langs)."'.dol_print_date($db->jdate($objp->datedon), 'day').'"; if ($objp->pid) { $projectstatic->id = $objp->pid; From 2b03f30f74967dffb4a14cd176870b1a25acf709 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:19:13 +0200 Subject: [PATCH 084/453] update code --- htdocs/don/note.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/don/note.php b/htdocs/don/note.php index 0b1c555e772..57ca862ad77 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -29,7 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/donation.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -86,7 +86,7 @@ $help_url = 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones|DE:M llxHeader('', $title, $help_url); $form = new Form($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -102,7 +102,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref = '
'; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= $langs->trans('Project').' '; if ($user->rights->don->creer) { From 501af170f93bf885cdfde0de1738a159ce3bf5f1 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:19:56 +0200 Subject: [PATCH 085/453] update code --- htdocs/ecm/index_auto.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 49bd25d0b90..c75cbdb2807 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -347,9 +347,9 @@ if (!empty($conf->global->ECM_AUTO_TREE_ENABLED)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('position'=>120, 'level'=>1, 'module'=>'salaries', 'test'=>$conf->salaries->enabled, 'label'=>$langs->trans("Salaries"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Salaries"))); } - if (!empty($conf->project->enabled)) { - $rowspan++; $sectionauto[] = array('position'=>130, 'level'=>1, 'module'=>'project', 'test'=>$conf->project->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); - $rowspan++; $sectionauto[] = array('position'=>140, 'level'=>1, 'module'=>'project_task', 'test'=>$conf->project->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks"))); + if (isModEnabled('project')) { + $rowspan++; $sectionauto[] = array('position'=>130, 'level'=>1, 'module'=>'project', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); + $rowspan++; $sectionauto[] = array('position'=>140, 'level'=>1, 'module'=>'project_task', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks"))); } if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); From 2ad1ea81bdc170ffe76dd6816969f0372ce2a459 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:20:27 +0200 Subject: [PATCH 086/453] update code --- htdocs/ecm/search.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/ecm/search.php b/htdocs/ecm/search.php index 6bbca0026e1..3faf2ad7cd3 100644 --- a/htdocs/ecm/search.php +++ b/htdocs/ecm/search.php @@ -143,8 +143,8 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); } -if (!empty($conf->project->enabled)) { - $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->project->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); +if (isModEnabled('project')) { + $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>isModEnabled('project'), 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); } if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); From d779dfd7e1ec0e51a2d247c388efea948ea15950 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:21:03 +0200 Subject: [PATCH 087/453] update code --- htdocs/eventorganization/conferenceorboothattendee_note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_note.php b/htdocs/eventorganization/conferenceorboothattendee_note.php index 4c5b2f394a9..d2e912332a6 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_note.php +++ b/htdocs/eventorganization/conferenceorboothattendee_note.php @@ -151,7 +151,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From bcdceebc67e688ac3c6b4ed32a7132d52a078258 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:21:44 +0200 Subject: [PATCH 088/453] update code --- htdocs/eventorganization/class/conferenceorbooth.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 2c22bfb77ab..33d7e5ed641 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -107,7 +107,7 @@ class ConferenceOrBooth extends ActionComm 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1',), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'), 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',), From 29c76ed93c82453055e1991851945853cc976753 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:22:14 +0200 Subject: [PATCH 089/453] update code --- .../eventorganization/class/conferenceorboothattendee.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 158b29e4cf6..75c9220ef3f 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -104,7 +104,7 @@ class ConferenceOrBoothAttendee extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"), 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1), 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), From 7093da905192e962ac0629781a2cdd1392cefb48 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:22:49 +0200 Subject: [PATCH 090/453] update code --- htdocs/expedition/card.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3a0a9869571..6bab59ecb6e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -56,7 +56,7 @@ if (isModEnabled("propal")) { if (!empty($conf->productbatch->enabled)) { require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -819,7 +819,7 @@ if (empty($action)) { $form = new Form($db); $formfile = new FormFile($db); $formproduct = new FormProduct($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -906,7 +906,7 @@ if ($action == 'create') { print '
'.$langs->trans('LineNb').''.$langs->trans('Piece').''.$langs->trans('Date').''.$langs->trans('Project').''.$langs->trans('Type').''.dol_print_date($db->jdate($line->date), 'day').''; if ($line->fk_project > 0) { $projecttmp->id = $line->fk_project; @@ -2270,7 +2270,7 @@ if ($action == 'create') { if ($action == 'editline' && $line->rowid == GETPOST('rowid', 'int')) { // Add line with link to add new file or attach line to an existing file $colspan = 11; - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $colspan++; } if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { @@ -2345,7 +2345,7 @@ if ($action == 'create') { print ''; $formproject->select_projects(-1, $line->fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print '
'.$langs->trans('Date').''.$form->textwithpicto($langs->trans('Project'), $langs->trans("ClosedProjectsAreHidden")).''.$langs->trans('Type').''; $formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, $projectRequired ? 0 : 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print '
'; @@ -986,7 +986,7 @@ if ($action == 'create') { print ""; // Project - if (! empty($conf->project->enabled) && is_object($object->thirdparty) && $object->thirdparty->id > 0) { + if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) { $projectid = GETPOST('projectid') ? GETPOST('projectid') : $object->fk_project; $langs->load('projects'); print ''; // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); // Projet associe @@ -424,7 +424,7 @@ if ($id > 0) { $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->loadLangs(array("projects")); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->loan->write) { From 234dec1b5960a20da403ac484969f327d9c87017 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:43:13 +0200 Subject: [PATCH 132/453] update code --- htdocs/loan/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 3bc60980245..a9d92f472f4 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -103,7 +103,7 @@ if ($object->id) { $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1); // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' : '; if ($user->rights->loan->write) { From dae850e6843f692cda39c04d3a7cad965165a4cd Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:43:35 +0200 Subject: [PATCH 133/453] update code --- htdocs/loan/info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/loan/info.php b/htdocs/loan/info.php index a0db5ca35a7..a0e235a2afb 100644 --- a/htdocs/loan/info.php +++ b/htdocs/loan/info.php @@ -26,7 +26,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -67,7 +67,7 @@ $morehtmlref = '
'; $morehtmlref .= $form->editfieldkey("Label", 'label', $object->label, $object, 0, 'string', '', 0, 1); $morehtmlref .= $form->editfieldval("Label", 'label', $object->label, $object, 0, 'string', '', null, null, '', 1); // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' : '; if ($user->rights->loan->write) { From bc76c9357ec0da856dfebccd80a6be035b6cc2c4 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:39:16 +0200 Subject: [PATCH 134/453] update code --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3bb8a5b44de..670f7d10cb8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -297,7 +297,7 @@ class Propal extends CommonObject 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>23), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>24), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>24), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'datep' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>-1, 'position'=>60), From 9ba54b502d3b671630c6871953a0736233d7f05c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:41:59 +0200 Subject: [PATCH 135/453] update code --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 10cd8357e21..61de56a62fa 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -314,7 +314,7 @@ class Commande extends CommonOrder 'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>27), // deprecated 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>28), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>20), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>25), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>25), 'date_commande' =>array('type'=>'date', 'label'=>'Date', 'enabled'=>1, 'visible'=>1, 'position'=>60), 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>62), 'date_cloture' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>-1, 'position'=>65), From 52bc56bc252b5d5aa29d5b6fc1241db241a9e646 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:42:58 +0200 Subject: [PATCH 136/453] update code --- htdocs/compta/facture/class/facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 2809b586ea1..4d5387e1b24 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -181,7 +181,7 @@ class FactureRec extends CommonInvoice 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'Total', 'enabled'=>1, 'visible'=>-1, 'position'=>70, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'Total ttc', 'enabled'=>1, 'visible'=>-1, 'position'=>75, 'isameasure'=>1), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>85), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>85), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100), From 770e5e7dd2bded88266ea93f1788000c15221047 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:44:13 +0200 Subject: [PATCH 137/453] update code --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 9a6326db10c..5b29f9abffe 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -233,7 +233,7 @@ class Contrat extends CommonObject 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>40), 'date_contrat' =>array('type'=>'datetime', 'label'=>'Date contrat', 'enabled'=>1, 'visible'=>-1, 'position'=>45), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>70), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>75), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>75), 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative Signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'SaleRepresentative follower', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), From 08a7daed2f80da01bf82144032c0e41c3e49d3cb Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:49:51 +0200 Subject: [PATCH 138/453] update code --- htdocs/core/modules/modCategorie.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index 6a7ddc8a864..10955f9511a 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -379,7 +379,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_6_'.Categorie::$MAP_ID_TO_CODE[6]; $this->export_label[$r] = 'CatProjectsList'; $this->export_icon[$r] = $this->picto; - $this->export_enabled[$r] = 'isModEnabled('project')'; + $this->export_enabled[$r] = "isModEnabled('project')"; $this->export_permission[$r] = array(array("categorie", "lire"), array("projet", "export")); $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name"); $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"Numeric", 's.nom'=>"Text"); From 3c453296e8760f8515c5027719bbb3d53fe1c828 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:52:10 +0200 Subject: [PATCH 139/453] update code --- htdocs/eventorganization/class/conferenceorbooth.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 33d7e5ed641..9e2ff6e76e6 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -107,7 +107,7 @@ class ConferenceOrBooth extends ActionComm 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1',), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'), 'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'2',), From dc6059b5873079e88b7584fb2c04089ac2de5044 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:52:54 +0200 Subject: [PATCH 140/453] update code --- .../eventorganization/class/conferenceorboothattendee.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 75c9220ef3f..df9d9a85f09 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -104,7 +104,7 @@ class ConferenceOrBoothAttendee extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"), 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1), 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), 'lastname' => array('type'=>'varchar(100)', 'label'=>'Lastname', 'enabled'=>'1', 'position'=>32, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1), From edfee437bca37fbdb3b10850f21127aff9ff23eb Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:53:54 +0200 Subject: [PATCH 141/453] update code --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 84cf2ae60b7..a2b038bc752 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -40,7 +40,7 @@ class Fichinter extends CommonObject public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'notnull'=>1, 'position'=>15), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>20), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>20), 'fk_contrat' =>array('type'=>'integer', 'label'=>'Fk contrat', 'enabled'=>'$conf->contrat->enabled', 'visible'=>-1, 'position'=>25), 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>30), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), From 0f74b049278c60a933abd4086fa54acb9f466485 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:54:43 +0200 Subject: [PATCH 142/453] update code --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c7552960a88..87c5640479b 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -218,7 +218,7 @@ class CommandeFournisseur extends CommonOrder 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25, 'searchall'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefOrderSupplierShort', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'searchall'=>1), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>45), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>45), 'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>60), 'date_approve' =>array('type'=>'datetime', 'label'=>'DateApprove', 'enabled'=>1, 'visible'=>-1, 'position'=>62), 'date_approve2' =>array('type'=>'datetime', 'label'=>'DateApprove2', 'enabled'=>1, 'visible'=>3, 'position'=>64), From f5a50c828d8508a4386ffb332b44c01633652090 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:55:19 +0200 Subject: [PATCH 143/453] update code --- htdocs/fourn/class/fournisseur.facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 9a9ad1ffe62..c85cdc2d0ed 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -195,7 +195,7 @@ class FactureFournisseurRec extends CommonInvoice 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>210), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>85), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>85), 'fk_account' =>array('type'=>'integer', 'label'=>'Fk account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>175), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), From fb1bfbf800213245ca711334bb35f171cad90e95 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Thu, 1 Sep 2022 09:55:54 +0200 Subject: [PATCH 144/453] update code --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 3bb8aeec677..c9e4af6b0d5 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -297,7 +297,7 @@ class FactureFournisseur extends CommonInvoice 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>130), 'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>135), 'fk_facture_source' =>array('type'=>'integer', 'label'=>'Fk facture source', 'enabled'=>1, 'visible'=>-1, 'position'=>140), - 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>isModEnabled('project'), 'visible'=>-1, 'position'=>145), + 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'visible'=>-1, 'position'=>145), 'fk_account' =>array('type'=>'integer', 'label'=>'Account', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>150), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160), From 2c46410675cfa62b3e6516e1ab9c93e97a3c5255 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2022 11:18:46 +0200 Subject: [PATCH 145/453] FIX list of email in public ticket interface --- .../modulebuilder/template/myobject_list.php | 2 +- htdocs/public/ticket/list.php | 30 ++++++++++--------- htdocs/ticket/list.php | 11 ++++--- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 6f9b266a8c1..5d4ae896134 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -434,7 +434,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { if ($skey != '') { $param .= '&search_'.$key.'[]='.urlencode($skey); diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 8a353eea881..c43ae59abb4 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -345,25 +345,25 @@ if ($action == "view_ticketlist") { } } $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as uc ON uc.rowid=t.fk_user_create"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON ua.rowid=t.fk_user_assign"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id=t.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON ec.fk_c_type_contact=tc.rowid"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sp ON ec.fk_socpeople=sp.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code = t.type_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code = t.category_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code = t.severity_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as uc ON uc.rowid = t.fk_user_create"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON ua.rowid = t.fk_user_assign"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact as ec ON ec.element_id = t.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc ON ec.fk_c_type_contact = tc.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople sp ON ec.fk_socpeople = sp.rowid"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as ef on (t.rowid = ef.fk_object)"; } $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; $sql .= " AND ((tc.source = 'external'"; - $sql .= " AND tc.element='".$db->escape($object->dao->element)."'"; - $sql .= " AND tc.active=1)"; - $sql .= " OR (sp.email='".$db->escape($_SESSION['email_customer'])."'"; - $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; - $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."'))"; + $sql .= " AND tc.element='".$db->escape($object->element)."'"; + $sql .= " AND tc.active=1"; + $sql .= " AND sp.email='".$db->escape($_SESSION['email_customer'])."')"; // email found into an external contact + $sql .= " OR s.email='".$db->escape($_SESSION['email_customer'])."'"; // or email of the linked company + $sql .= " OR t.origin_email='".$db->escape($_SESSION['email_customer'])."')"; // or email of the requester // Manage filter if (!empty($filter)) { foreach ($filter as $key => $value) { @@ -696,6 +696,8 @@ if ($action == "view_ticketlist") { } '; } + } else { + dol_print_error($db); } } else { print '
'; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index f489c9218fc..d80d44813e0 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -140,7 +140,7 @@ foreach ($object->fields as $key => $val) { $arrayfields['t.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($visible < 0) ? 0 : 1), - 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')), + 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>$val['position'], 'help'=> isset($val['help']) ? $val['help'] : '' ); @@ -621,8 +621,8 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } foreach ($search as $key => $val) { - if (is_array($val) && count($val)) { - foreach ($val as $skey) { + if (is_array($search[$key])) { + foreach ($search[$key] as $skey) { if ($skey != '') { $param .= (!empty($val)) ? '&search_'.$key.'[]='.urlencode($skey) : ""; } @@ -746,10 +746,13 @@ $trackid = 'tic'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'."\n"; } $moreforfilter = ''; From 5ba052019596f38662c9d288cc10029dba120057 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Sep 2022 15:38:31 +0200 Subject: [PATCH 146/453] FIX fatal error abs on non int --- htdocs/public/recruitment/view.php | 6 ++++++ htdocs/user/class/user.class.php | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index b92dcbf9824..2eaa51ac2fe 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -217,7 +217,13 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb if ($urllogo) { print '
'; print '
'; + if (!empty($mysoc->url)) { + print ''; + } print ''; + if (!empty($mysoc->url)) { + print ''; + } print '
'; if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1fc536d10bd..3b71811e7b1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2822,7 +2822,7 @@ class User extends CommonObject $result .= (($option == 'nolink') ? '' : $linkstart); if ($withpictoimg) { $paddafterimage = ''; - if (abs($withpictoimg) == 1) { + if (abs((int) $withpictoimg) == 1) { $paddafterimage = 'style="margin-'.($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right').': 3px;"'; } // Only picto From e589cc7d9b35a1f1135fdc2c2fe0bc01b641eda7 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 1 Sep 2022 16:13:21 +0200 Subject: [PATCH 147/453] fix ci error --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index ef64b2e5a74..46790b9cbc5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1605,7 +1605,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", ((int) $conf->global->MAIN_IHM_PARAMS_REV) + 1, 'chaine', 0, '', $conf->entity); } - $themeparam = '?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').(empty($user->id) ? '' : ('&userid='.$user->id) : '').'&entity='.$conf->entity; + $themeparam = '?lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').(empty($user->id) ? '' : ('&userid='.$user->id)).'&entity='.$conf->entity; $themeparam .= ($ext ? '&'.$ext : '').'&revision='.getDolGlobalInt("MAIN_IHM_PARAMS_REV"); if (GETPOSTISSET('dol_hide_topmenu')) { From 5a924d23e3e1d14212e28a61b80fce0bf7592458 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 1 Sep 2022 16:30:48 +0200 Subject: [PATCH 148/453] fix CI errors --- htdocs/public/ticket/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 2f4bd720219..6332f063541 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -81,7 +81,7 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); print '
'; -print '

'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", ''.$langs->trans("TicketPublicDesc")).'

')).'

'; +print '

'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", ''.$langs->trans("TicketPublicDesc")).'

').'

'; print '
'; print '
'; From e1bf5a5e6b53e7ac6da8453c916293d1c8d1e619 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Thu, 1 Sep 2022 17:16:59 +0200 Subject: [PATCH 149/453] FIX : Recursively retrieves all parent bom in the tree that leads to the $bom_id bom to check if we're allowed to add bom as bomline --- htdocs/bom/bom_card.php | 10 ++++++++++ htdocs/bom/class/bom.class.php | 28 ++++++++++++++++++++++++++++ htdocs/langs/en_US/mrp.lang | 1 + htdocs/langs/fr_FR/mrp.lang | 1 + 4 files changed, 40 insertions(+) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index ee619a589e3..11d2b3b4e31 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -180,6 +180,16 @@ if (empty($reshook)) { $error++; } + // We check if we're allowed to add this bom + $TParentBom=array(); + $object->getParentBomTreeRecursive($TParentBom, $object->id); + if($bom_child_id > 0 && !empty($TParentBom) && in_array($bom_child_id, $TParentBom)) { + $n_child = new BOM($db); + $n_child->fetch($bom_child_id); + setEventMessages($langs->transnoentities('BomCantAddChildBom', $n_child->getNomUrl(1), $object->getNomUrl(1)), null, 'errors'); + $error++; + } + if (!$error) { $bomline = new BOMLine($db); $bomline->fk_bom = $id; diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 8adcac855c2..e178c76c024 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1147,6 +1147,34 @@ class BOM extends CommonObject } } } + + /** + * Recursively retrieves all parent bom in the tree that leads to the $bom_id bom + * + * @param array $TParentBom We put all found parent bom in $TParentBom + * @param int $bom_id ID of bom from which we want to get parent bom ids + * @return void + */ + public function getParentBomTreeRecursive(&$TParentBom, $bom_id) { + + $sql = 'SELECT l.fk_bom, b.label + FROM '.MAIN_DB_PREFIX.'bom_bomline l + INNER JOIN '.MAIN_DB_PREFIX.$this->table_element.' b ON b.rowid = l.fk_bom + WHERE fk_bom_child = '.$bom_id; + + $resql = $this->db->query($sql); + if(!empty($resql)) { + + while($res = $this->db->fetch_object($resql)) { + + $TParentBom[$res->fk_bom] = $res->fk_bom; + $this->getParentBomTreeRecursive($TParentBom, $res->fk_bom); + + } + + } + + } } diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 7f29b774b29..9e1c8bb64ce 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -112,3 +112,4 @@ MOAndLines=Manufacturing Orders and lines MoChildGenerate=Generate Child Mo ParentMo=MO Parent MOChild=MO Child +BomCantAddChildBom=The nomenclature %s is already present in the tree leading to the nomenclature %s diff --git a/htdocs/langs/fr_FR/mrp.lang b/htdocs/langs/fr_FR/mrp.lang index e65244b584f..709ff68b963 100644 --- a/htdocs/langs/fr_FR/mrp.lang +++ b/htdocs/langs/fr_FR/mrp.lang @@ -112,3 +112,4 @@ MOAndLines=Ordres de fabrication et lignes MoChildGenerate=Generate Child Mo ParentMo=MO Parent MOChild=MO Child +BomCantAddChildBom=La nomenclature %s est déjà présente dans l'arborescence qui mène à la nomenclature %s From d4122278bdfe3144a77f16a59cb6fca56285af6a Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 1 Sep 2022 15:23:40 +0000 Subject: [PATCH 150/453] Fixing style errors. --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/class/bom.class.php | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 11d2b3b4e31..669eb70d069 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -183,7 +183,7 @@ if (empty($reshook)) { // We check if we're allowed to add this bom $TParentBom=array(); $object->getParentBomTreeRecursive($TParentBom, $object->id); - if($bom_child_id > 0 && !empty($TParentBom) && in_array($bom_child_id, $TParentBom)) { + if ($bom_child_id > 0 && !empty($TParentBom) && in_array($bom_child_id, $TParentBom)) { $n_child = new BOM($db); $n_child->fetch($bom_child_id); setEventMessages($langs->transnoentities('BomCantAddChildBom', $n_child->getNomUrl(1), $object->getNomUrl(1)), null, 'errors'); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index e178c76c024..458e51cdf2c 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1155,7 +1155,8 @@ class BOM extends CommonObject * @param int $bom_id ID of bom from which we want to get parent bom ids * @return void */ - public function getParentBomTreeRecursive(&$TParentBom, $bom_id) { + public function getParentBomTreeRecursive(&$TParentBom, $bom_id) + { $sql = 'SELECT l.fk_bom, b.label FROM '.MAIN_DB_PREFIX.'bom_bomline l @@ -1163,17 +1164,12 @@ class BOM extends CommonObject WHERE fk_bom_child = '.$bom_id; $resql = $this->db->query($sql); - if(!empty($resql)) { - - while($res = $this->db->fetch_object($resql)) { - + if (!empty($resql)) { + while ($res = $this->db->fetch_object($resql)) { $TParentBom[$res->fk_bom] = $res->fk_bom; $this->getParentBomTreeRecursive($TParentBom, $res->fk_bom); - } - } - } } From 30ce816c0cc3b7cab2d2364bf26a6e576cbfcd17 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 1 Sep 2022 17:07:20 +0200 Subject: [PATCH 151/453] Fix: On a not configured personalized accounting group, the group code would be used in the formula. --- htdocs/compta/resultat/result.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 635531ab86b..b6ac4c1b33f 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -405,6 +405,9 @@ if ($modecompta == 'CREANCES-DETTES') { // Set $cpts with array of accounts in the category/group $cpts = $AccCat->getCptsCat($cat['rowid']); + // We should loop over empty $cpts array, else the category _code_ is used in the formula, which leads to wrong result if the code is a number. + if (empty($cpts)) $cpts[] = array(); + $arrayofaccountforfilter = array(); foreach ($cpts as $i => $cpt) { // Loop on each account. @@ -477,7 +480,7 @@ if ($modecompta == 'CREANCES-DETTES') { // Label of group print '
'."\n"; } - // Gender // TODO: add diverse gender + // Gender print ''; print ''; // Address From d17f0c57e212083563ba81d99791e9a99dbf578f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 11:27:16 +0200 Subject: [PATCH 165/453] NEW Link "add to bookmark" always on top in the bookmark popup --- htdocs/bookmarks/bookmarks.lib.php | 33 +++++++++++++++++------------- htdocs/langs/en_US/bookmarks.lang | 1 + htdocs/theme/eldy/dropdown.inc.php | 2 +- htdocs/theme/md/dropdown.inc.php | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index e5781d98561..448a5f085f1 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -64,11 +64,6 @@ function printDropdownBookmarksList() $searchForm .= 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ' onsubmit="return false"' : '').'>'; $searchForm .= ''; - - // Url to list bookmark - $listbtn = ''; - $listbtn .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').''; - // Url to go on create new bookmark page $newbtn = ''; if (!empty($user->rights->bookmark->creer)) { @@ -80,6 +75,10 @@ function printDropdownBookmarksList() } } + // Url to list/edit bookmark + $listbtn = ''; + $listbtn .= img_picto('', 'edit', 'class="paddingright opacitymedium"').$langs->trans('EditBookmarks').''; + // Menu with list of bookmarks $sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark"; $sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)"; @@ -171,27 +170,28 @@ function printDropdownBookmarksList() '; $html .= ' - - - '; - - $html .= ' - + '; + $html .= ' + + + '; + $html .= ' '; } diff --git a/htdocs/langs/en_US/bookmarks.lang b/htdocs/langs/en_US/bookmarks.lang index be0f2f7e25d..26551eee4f0 100644 --- a/htdocs/langs/en_US/bookmarks.lang +++ b/htdocs/langs/en_US/bookmarks.lang @@ -20,3 +20,4 @@ ChooseIfANewWindowMustBeOpenedOnClickOnBookmark=Choose if the linked page should BookmarksManagement=Bookmarks management BookmarksMenuShortCut=Ctrl + shift + m NoBookmarks=No bookmarks defined +NoBookmarkFound=No bookmark found \ No newline at end of file diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index 0ca47fbd2bb..bfde88726e9 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -257,7 +257,7 @@ a.top-menu-dropdown-link { .dropdown-menu > .user-body, .dropdown-body { padding: 15px; border-bottom: 1px solid #f4f4f4; - border-top: 1px solid #dddddd; + border-top: 1px solid #f0f0f0; white-space: normal; } diff --git a/htdocs/theme/md/dropdown.inc.php b/htdocs/theme/md/dropdown.inc.php index 1f60f0b7c2a..64bebc67f79 100644 --- a/htdocs/theme/md/dropdown.inc.php +++ b/htdocs/theme/md/dropdown.inc.php @@ -260,7 +260,7 @@ a.top-menu-dropdown-link { .dropdown-menu > .user-body, .dropdown-body{ padding: 15px; border-bottom: 1px solid #f4f4f4; - border-top: 1px solid #dddddd; + border-top: 1px solid #f0f0f0; white-space: normal; } From a28eb9296fdcb8d245df9e72d26ef18f2680b174 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 11:51:28 +0200 Subject: [PATCH 166/453] Update userbankaccount.class.php --- htdocs/user/class/userbankaccount.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index d18f5feae16..271609139b1 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -174,8 +174,8 @@ class UserBankAccount extends Account $sql .= ', c.code as country_code, c.label as country'; $sql .= ', d.code_departement as state_code, d.nom as state'; $sql .= " FROM ".$this->db->prefix()."user_rib as ur"; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON ur.fk_country=c.rowid'; - $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON ur.state_id=d.rowid'; + $sql .= ' LEFT JOIN '.$this->db->prefix().'c_country as c ON ur.fk_country=c.rowid'; + $sql .= ' LEFT JOIN '.$this->db->prefix().'c_departements as d ON ur.state_id=d.rowid'; if ($id) { $sql .= " WHERE ur.rowid = ".((int) $id); From 360bfed601f018bf9234aafc9f6d44e3cd282479 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 2 Sep 2022 11:57:29 +0200 Subject: [PATCH 167/453] FIX : return void --- htdocs/bom/class/bom.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 374d4af248b..5ddbf05eca4 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1161,7 +1161,7 @@ class BOM extends CommonObject // Protection against infinite loop if ($level > 1000) { - return 0; + return; } if(empty($bom_id)) $bom_id=$this->id; From 4b2eb7ed248bac961e0b9b4c4b8ef18bc7ea9755 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 12:34:34 +0200 Subject: [PATCH 168/453] css --- htdocs/adherents/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 8bf7f7af6a6..8362d311b0a 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -1094,9 +1094,9 @@ while ($i < min($num, $limit)) { } // Country if (!empty($arrayfields['country.code_iso']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; From 84633177dae3d49ccfc6abe800280ab1b68bbad2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 14:44:55 +0200 Subject: [PATCH 169/453] Trans --- htdocs/admin/events.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index b98f3775aad..ceb3c286ac3 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -111,7 +111,7 @@ print '
'; print '
' . $langs->trans('Project') . ''; @@ -1135,7 +1135,7 @@ if ($action == 'create') { $morehtmlref .= '
' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project - if (! empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load('projects'); $morehtmlref .= '
' . $langs->trans('Project') . ' '; if ($usercancreate) { From 29c7ebad27b31e72f8f8cdffa6b003e22ce0ad3f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:35:45 +0200 Subject: [PATCH 114/453] update code --- htdocs/fourn/facture/card.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index ddf54ba0727..b15478dc6c7 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2010-2019 Juanjo Menent - * Copyright (C) 2013-2015 Philippe Grand + * Copyright (C) 2013-2022 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2016 Marcos García * Copyright (C) 2016-2022 Alexandre Spangaro @@ -49,7 +49,7 @@ if (isModEnabled("product")) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; } -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; } @@ -1888,7 +1888,7 @@ $form = new Form($db); $formfile = new FormFile($db); $bankaccountstatic = new Account($db); $paymentstatic = new PaiementFourn($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } @@ -2408,7 +2408,7 @@ if ($action == 'create') { } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $formproject = new FormProjets($db); $langs->load('projects'); @@ -2864,7 +2864,7 @@ if ($action == 'create') { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($usercancreate) { @@ -3247,7 +3247,7 @@ if ($action == 'create') { } $nbrows = 9; $nbcols = 3; - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $nbrows++; } if (isModEnabled("banque")) { From a36491f4dbbc1145b409507bde59a69f167f3671 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:36:15 +0200 Subject: [PATCH 115/453] update code --- htdocs/fourn/facture/contact.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php index 1096cb1eae8..ad36d63e9a7 100644 --- a/htdocs/fourn/facture/contact.php +++ b/htdocs/fourn/facture/contact.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -137,7 +137,7 @@ if ($id > 0 || !empty($ref)) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->facture->creer) { From 218d5a774e01ef79fe02eb28f627d822034f7ba7 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:36:39 +0200 Subject: [PATCH 116/453] update code --- htdocs/fourn/facture/document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 6cedd8884df..4479b89c34d 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -116,7 +116,7 @@ if ($object->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->facture->creer) { From e283e867d81de9b7b0156fd4e711e6c49e11df79 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:37:04 +0200 Subject: [PATCH 117/453] update code --- htdocs/fourn/facture/info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index de5985ae28f..c5491dfdbfd 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -79,7 +79,7 @@ if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0 $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->facture->creer) { From ab71f479248f57dc65b4553908a4709b0070741b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:37:31 +0200 Subject: [PATCH 118/453] update code --- htdocs/fourn/facture/list-rec.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/list-rec.php b/htdocs/fourn/facture/list-rec.php index f876462e15f..93519ff9524 100644 --- a/htdocs/fourn/facture/list-rec.php +++ b/htdocs/fourn/facture/list-rec.php @@ -248,7 +248,7 @@ llxHeader('', $langs->trans("RepeatableSupplierInvoices"), $help_url); $form = new Form($db); $formother = new FormOther($db); -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { $formproject = new FormProjets($db); } $companystatic = new Societe($db); From 7688a2429d863dbbd75f382a52579b14d8c8721d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:37:55 +0200 Subject: [PATCH 119/453] update code --- htdocs/fourn/facture/note.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 46a9f8fdc44..0079e49db50 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -30,7 +30,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } @@ -110,7 +110,7 @@ if ($object->id > 0) { $morehtmlref .= ' ('.$langs->trans("OtherBills").')'; } // Project - if (!empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) { From 3e37330669fc0083b04ab7814f9aa9d07152aee0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:38:21 +0200 Subject: [PATCH 120/453] update code --- htdocs/fourn/paiement/document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/paiement/document.php b/htdocs/fourn/paiement/document.php index 58d04d097d5..b69e081cf16 100644 --- a/htdocs/fourn/paiement/document.php +++ b/htdocs/fourn/paiement/document.php @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; -if (!empty($conf->project->enabled)) { +if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } From 6541e23bcd4cd779c4d9c7ce4451deab043fd5f3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:38:45 +0200 Subject: [PATCH 121/453] update code --- htdocs/hrm/evaluation_contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/evaluation_contact.php b/htdocs/hrm/evaluation_contact.php index 0cc25901302..380cb070d10 100644 --- a/htdocs/hrm/evaluation_contact.php +++ b/htdocs/hrm/evaluation_contact.php @@ -139,7 +139,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From c934fd1dbb40f937de286d8277105a6ca0f931e6 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:39:10 +0200 Subject: [PATCH 122/453] update code --- htdocs/hrm/job_contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/job_contact.php b/htdocs/hrm/job_contact.php index 76f6e73d690..057e183f0b8 100644 --- a/htdocs/hrm/job_contact.php +++ b/htdocs/hrm/job_contact.php @@ -139,7 +139,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From 6d2506eeb9d8cf47968fc7c495cdf14a07d5cf3e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:39:32 +0200 Subject: [PATCH 123/453] update code --- htdocs/hrm/position_contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/position_contact.php b/htdocs/hrm/position_contact.php index 56029f790a7..811de980af9 100644 --- a/htdocs/hrm/position_contact.php +++ b/htdocs/hrm/position_contact.php @@ -139,7 +139,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From 6963e3ddbcc38d5e6b95be232aa6788038864f21 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:39:53 +0200 Subject: [PATCH 124/453] update code --- htdocs/hrm/skill_contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/skill_contact.php b/htdocs/hrm/skill_contact.php index 5f284c4e72c..51610cfebb0 100644 --- a/htdocs/hrm/skill_contact.php +++ b/htdocs/hrm/skill_contact.php @@ -139,7 +139,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From 0bef12000bad7e59dcfcf56c0939f77258814f0d Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:40:15 +0200 Subject: [PATCH 125/453] update code --- htdocs/hrm/establishment/info.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/establishment/info.php b/htdocs/hrm/establishment/info.php index afbd480e928..d83577ee349 100644 --- a/htdocs/hrm/establishment/info.php +++ b/htdocs/hrm/establishment/info.php @@ -147,7 +147,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From 6ad73b065699265e77f0343330d5358423bf0953 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:40:37 +0200 Subject: [PATCH 126/453] update code --- htdocs/knowledgemanagement/knowledgerecord_agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index cbf8ccf0895..6a7817fca92 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -150,7 +150,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($permissiontoadd) { From d5225cdf1d8ca2df954e6933a98427595583cf8e Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:41:05 +0200 Subject: [PATCH 127/453] update code --- htdocs/knowledgemanagement/knowledgerecord_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 66b7b0ca160..f68158089b7 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -366,7 +366,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project') . ' '; if ($permissiontoadd) { From 832d97d997479841de15a7293e6a497fffcc5cbf Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:41:30 +0200 Subject: [PATCH 128/453] update code --- htdocs/knowledgemanagement/knowledgerecord_contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_contact.php b/htdocs/knowledgemanagement/knowledgerecord_contact.php index 2b2facafc18..3d1fdc4378f 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_contact.php +++ b/htdocs/knowledgemanagement/knowledgerecord_contact.php @@ -132,7 +132,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From fa28f18b263252a0c0557dc89a26cb54163bd5df Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:41:50 +0200 Subject: [PATCH 129/453] update code --- htdocs/knowledgemanagement/knowledgerecord_document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_document.php b/htdocs/knowledgemanagement/knowledgerecord_document.php index ce185c9b8cf..53dac51e4e4 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_document.php +++ b/htdocs/knowledgemanagement/knowledgerecord_document.php @@ -130,7 +130,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From 656739de33c7b4926e58be11c9ef98262a69fe2b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:42:11 +0200 Subject: [PATCH 130/453] update code --- htdocs/knowledgemanagement/knowledgerecord_note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index 0f56a6115a3..2d876bf24f3 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -104,7 +104,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; From 9e3f37294183502acbe7087dc25ea3efe4659cdd Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 31 Aug 2022 22:42:43 +0200 Subject: [PATCH 131/453] update code --- htdocs/loan/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index d209c64d088..7ec8e7894fc 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -309,7 +309,7 @@ if ($action == 'create') { print '
'.$langs->trans("Insurance").'
'; print dol_escape_htmltag($cat['label']); - if (count($cpts) > 0) { // Show example of 5 first accounting accounts + if (count($cpts) > 0 && !empty($cpts[0])) { // Show example of 5 first accounting accounts $i = 0; foreach ($cpts as $cpt) { if ($i > 5) { From ce78e0164aeb2ca4dd3a77861ce28c2b5fcd9ec3 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 1 Sep 2022 17:19:08 +0200 Subject: [PATCH 152/453] Fix: When a custom compta group would be unactive, its code would stay in the computed formula. This would lead to wrong totals if the code is a number. --- htdocs/accountancy/class/accountancycategory.class.php | 7 ++++--- htdocs/compta/resultat/result.php | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 77d10516daa..5aec2d48fa2 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -785,12 +785,13 @@ class AccountancyCategory // extends CommonObject } /** - * Return list of custom groups that are active + * Return list of custom groups. * * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups + * @param int $active 1= active, 0=not active * @return array|int Array of groups or -1 if error */ - public function getCats($categorytype = -1) + public function getCats($categorytype = -1, $active = 1) { global $conf, $mysoc; @@ -801,7 +802,7 @@ class AccountancyCategory // extends CommonObject $sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c"; - $sql .= " WHERE c.active = 1"; + $sql .= " WHERE c.active = " . (int) $active; $sql .= " AND c.entity = ".$conf->entity; if ($categorytype >= 0) { $sql .= " AND c.category_type = 1"; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index b6ac4c1b33f..93fc7d57203 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -274,6 +274,7 @@ if ($modecompta == 'CREANCES-DETTES') { } elseif ($modecompta == "BOOKKEEPING") { // Get array of all report groups that are active $cats = $AccCat->getCats(); // WARNING: Computed groups must be after group they include + $unactive_cats = $AccCat->getCats(-1, 0); /* $sql = 'SELECT DISTINCT t.numero_compte as nb FROM '.MAIN_DB_PREFIX.'accounting_bookkeeping as t, '.MAIN_DB_PREFIX.'accounting_account as aa'; @@ -325,6 +326,11 @@ if ($modecompta == 'CREANCES-DETTES') { $vars = array(); + // Unactive categories have a total of 0 to be used in the formula. + foreach($unactive_cats as $un_cat) { + $vars[$un_cat['code']] = 0; + } + // Previous Fiscal year (N-1) foreach ($sommes as $code => $det) { $vars[$code] = $det['NP']; From f1ce73263915d5d24197fe956ab9d6164006fb49 Mon Sep 17 00:00:00 2001 From: Thomas Negre Date: Thu, 1 Sep 2022 18:06:35 +0200 Subject: [PATCH 153/453] empty commit to re-launch stickler From 1269e1b86e23973110ef4f1a933ae4013797f5a5 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 2 Sep 2022 08:44:16 +0200 Subject: [PATCH 154/453] FIX : cast --- htdocs/bom/class/bom.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index e178c76c024..1a21c73baee 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1160,7 +1160,7 @@ class BOM extends CommonObject $sql = 'SELECT l.fk_bom, b.label FROM '.MAIN_DB_PREFIX.'bom_bomline l INNER JOIN '.MAIN_DB_PREFIX.$this->table_element.' b ON b.rowid = l.fk_bom - WHERE fk_bom_child = '.$bom_id; + WHERE fk_bom_child = '.((int) $bom_id); $resql = $this->db->query($sql); if(!empty($resql)) { From a380315056cb0e9372224811a7baa203c2e1fec7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 10:05:25 +0200 Subject: [PATCH 155/453] Clean code --- htdocs/societe/paymentmodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 7d082440661..535c2978877 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -517,7 +517,7 @@ if (empty($reshook)) { } } if ($action == 'syncsepatostripe') { - $companybankaccount->fetch(GETPOST('bankid')); + $companybankaccount->fetch(GETPOST('bankid', 'int')); // print "stripe account = " . json_encode($stripe->getStripeAccount($service)); // print json_encode($companybankaccount); // print "fetch id = " . json_encode($socid); @@ -545,7 +545,7 @@ if (empty($reshook)) { $error++; setEventMessages($stripe->error, $stripe->errors, 'errors'); } else { - setEventMessages("", array("SEPA on Stripe", "SEPA IBAN is now linked to customer account !")); + setEventMessages("", array("SEPA on Stripe", "SEPA IBAN is now linked to the Stripe customer account !")); } } } From 16e1c7ea713bbb8bef343b5c784b3722ebc473eb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 2 Sep 2022 10:25:12 +0200 Subject: [PATCH 156/453] Update result.php Fixed Stickler --- htdocs/compta/resultat/result.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 93fc7d57203..378e594c9db 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -327,7 +327,7 @@ if ($modecompta == 'CREANCES-DETTES') { $vars = array(); // Unactive categories have a total of 0 to be used in the formula. - foreach($unactive_cats as $un_cat) { + foreach ($unactive_cats as $un_cat) { $vars[$un_cat['code']] = 0; } From e450d464aa0eef77e41b865c77fb058dc9750144 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 2 Sep 2022 10:26:30 +0200 Subject: [PATCH 157/453] Update bom_agenda.php --- htdocs/bom/bom_agenda.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index d2c64eea0b6..2e4424bde47 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -17,9 +17,9 @@ */ /** - * \file htdocs/modulebuilder/template/myobject_agenda.php - * \ingroup bom - * \brief Page of MyObject events + * \file htdocs/bom/bom_agenda.php + * \ingroup bom + * \brief Page of BOM events */ // Load Dolibarr environment From c28407a1c9b0a45de91f34cf3f27ae5c0da591a3 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Fri, 2 Sep 2022 10:28:19 +0200 Subject: [PATCH 158/453] FIX : default value for bom_id with $this->id and protection against infinite loop --- htdocs/bom/bom_card.php | 2 +- htdocs/bom/class/bom.class.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 669eb70d069..573478a6b3d 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -182,7 +182,7 @@ if (empty($reshook)) { // We check if we're allowed to add this bom $TParentBom=array(); - $object->getParentBomTreeRecursive($TParentBom, $object->id); + $object->getParentBomTreeRecursive($TParentBom); if ($bom_child_id > 0 && !empty($TParentBom) && in_array($bom_child_id, $TParentBom)) { $n_child = new BOM($db); $n_child->fetch($bom_child_id); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 6cd1d1d42d8..374d4af248b 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1153,11 +1153,19 @@ class BOM extends CommonObject * * @param array $TParentBom We put all found parent bom in $TParentBom * @param int $bom_id ID of bom from which we want to get parent bom ids + * @param int $level Protection against infinite loop * @return void */ - public function getParentBomTreeRecursive(&$TParentBom, $bom_id) + public function getParentBomTreeRecursive(&$TParentBom, $bom_id='', $level=1) { + // Protection against infinite loop + if ($level > 1000) { + return 0; + } + + if(empty($bom_id)) $bom_id=$this->id; + $sql = 'SELECT l.fk_bom, b.label FROM '.MAIN_DB_PREFIX.'bom_bomline l INNER JOIN '.MAIN_DB_PREFIX.$this->table_element.' b ON b.rowid = l.fk_bom @@ -1167,7 +1175,7 @@ class BOM extends CommonObject if (!empty($resql)) { while ($res = $this->db->fetch_object($resql)) { $TParentBom[$res->fk_bom] = $res->fk_bom; - $this->getParentBomTreeRecursive($TParentBom, $res->fk_bom); + $this->getParentBomTreeRecursive($TParentBom, $res->fk_bom, $level+1); } } } From 21517cf5789de767087a02c5ca99861e3f889aa3 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 2 Sep 2022 08:33:27 +0000 Subject: [PATCH 159/453] Fixing style errors. --- htdocs/bom/class/bom.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 374d4af248b..5fa2957e663 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -1156,7 +1156,7 @@ class BOM extends CommonObject * @param int $level Protection against infinite loop * @return void */ - public function getParentBomTreeRecursive(&$TParentBom, $bom_id='', $level=1) + public function getParentBomTreeRecursive(&$TParentBom, $bom_id = '', $level = 1) { // Protection against infinite loop @@ -1164,7 +1164,7 @@ class BOM extends CommonObject return 0; } - if(empty($bom_id)) $bom_id=$this->id; + if (empty($bom_id)) $bom_id=$this->id; $sql = 'SELECT l.fk_bom, b.label FROM '.MAIN_DB_PREFIX.'bom_bomline l From c9a2dea3d8b15ff84ef26c780d7ea186a359ddb1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 10:34:25 +0200 Subject: [PATCH 160/453] Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop From 831420b8e1bf7ab5445adf76837511110788c364 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 2 Sep 2022 10:42:27 +0200 Subject: [PATCH 161/453] FIX: bad bookmark save --- htdocs/bookmarks/bookmarks.lib.php | 45 +++++++++++++++++++----------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index f8daff1cd14..ca0f1486db1 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -36,28 +36,39 @@ function printDropdownBookmarksList() $langs->load("bookmarks"); + $authorized_var=array('page','limit','optioncss','contextpage'); $url = $_SERVER["PHP_SELF"]; - + $url_param=array(); if (!empty($_SERVER["QUERY_STRING"])) { - $url .= (dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''); - } else { - global $sortfield, $sortorder; - $tmpurl = ''; - // No urlencode, all param $url will be urlencoded later - if ($sortfield) { - $tmpurl .= ($tmpurl ? '&' : '').'sortfield='.urlencode($sortfield); - } - if ($sortorder) { - $tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder); - } - if (is_array($_POST)) { - foreach ($_POST as $key => $val) { - if (preg_match('/^search_/', $key) && $val != '') { - $tmpurl .= ($tmpurl ? '&' : '').http_build_query(array($key => $val)); + if (is_array($_GET)) { + foreach ($_GET as $key => $val) { + if ($val != '') { + $url_param[$key]=http_build_query(array($key => $val)); } } } - $url .= ($tmpurl ? '?'.$tmpurl : ''); + } + global $sortfield, $sortorder; + $tmpurl = ''; + // No urlencode, all param $url will be urlencoded later + if ($sortfield) { + $tmpurl .= ($tmpurl ? '&' : '').'sortfield='.urlencode($sortfield); + } + if ($sortorder) { + $tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder); + } + if (is_array($_POST)) { + foreach ($_POST as $key => $val) { + if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var)) + && $val != '' + && !array_key_exists($key, $url_param)) { + $url_param[$key]=http_build_query(array($key => $val)); + } + } + } + $url .= ($tmpurl ? '?'.$tmpurl : ''); + if (!empty($url_param)) { + $url .= '&'.implode('&', $url_param); } $searchForm = ''."\n"; From 8a44b1ab2bfd964e2e2e6b00558b4bc394d0ee05 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 10:55:15 +0200 Subject: [PATCH 162/453] Update bookmarks.lib.php --- htdocs/bookmarks/bookmarks.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index ca0f1486db1..72fc0a9b51e 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -36,7 +36,7 @@ function printDropdownBookmarksList() $langs->load("bookmarks"); - $authorized_var=array('page','limit','optioncss','contextpage'); + $authorized_var=array('limit','optioncss','contextpage'); $url = $_SERVER["PHP_SELF"]; $url_param=array(); if (!empty($_SERVER["QUERY_STRING"])) { From 9d85eb1b7f828e682de7fe100ba7135d53a32500 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 10:57:47 +0200 Subject: [PATCH 163/453] Update bookmarks.lib.php --- htdocs/bookmarks/bookmarks.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 72fc0a9b51e..8eef3396eaa 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -43,7 +43,7 @@ function printDropdownBookmarksList() if (is_array($_GET)) { foreach ($_GET as $key => $val) { if ($val != '') { - $url_param[$key]=http_build_query(array($key => $val)); + $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); } } } @@ -62,7 +62,7 @@ function printDropdownBookmarksList() if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var)) && $val != '' && !array_key_exists($key, $url_param)) { - $url_param[$key]=http_build_query(array($key => $val)); + $url_param[$key]=http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val))); } } } From cf8df1196583af3f86dc714ae99c6843fbb8a678 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 2 Sep 2022 11:01:05 +0200 Subject: [PATCH 164/453] Update new.php add GenderOther --- htdocs/public/members/new.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index ccc229e33bf..d33d469b975 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -7,6 +7,7 @@ * Copyright (C) 2018-2019 Frédéric France * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2021 Waël Almoman + * Copyright (C) 2022 Udo Tamm * * 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 @@ -586,11 +587,11 @@ if (!empty($conf->global->MEMBER_SKIP_TABLE) || !empty($conf->global->MEMBER_NEW print '
'.$langs->trans("PasswordRetype").' *
'.$langs->trans("Gender").''; - $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); - print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); + $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother")); + print $form->selectarray('gender', $arraygender, GETPOST('gender', 'alphanohtml'), 1, 0, 0, '', 0, 0, 0, '', '', 1); print '
'; $tmparray = getCountry($obj->country, 'all'); - print $tmparray['label']; + print ''; + print dol_escape_htmltag($tmparray['label']); print '
'; print ""; -print getTitleFieldOfList("LogEvents", 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, '')."\n"; +print getTitleFieldOfList("TrackableSecurityEvents", 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print "\n"; // Loop on each event type diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ced1f23ed39..6fe10207247 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1238,6 +1238,7 @@ BrowserName=Browser name BrowserOS=Browser OS ListOfSecurityEvents=List of Dolibarr security events SecurityEventsPurged=Security events purged +TrackableSecurityEvents=Trackable security events LogEventDesc=Enable logging for specific security events. Administrators the log via menu %s - %s. Warning, this feature can generate a large amount of data in the database. AreaForAdminOnly=Setup parameters can be set by administrator users only. SystemInfoDesc=System information is miscellaneous technical information you get in read only mode and visible for administrators only. From 38352d0c28a9505aa5de6edd255171a29a9f45dc Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 2 Sep 2022 16:22:54 +0200 Subject: [PATCH 170/453] NEW Manage VAT on all lines on purchases cycle --- htdocs/core/tpl/objectline_title.tpl.php | 2 +- htdocs/fourn/commande/card.php | 11 ++++++++++- htdocs/fourn/facture/card.php | 9 +++++++++ htdocs/supplier_proposal/card.php | 11 ++++++++++- .../class/supplier_proposal.class.php | 1 + 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 762e9b4eefa..6bb64075bd5 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -68,7 +68,7 @@ if (!empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) || !empty($conf->global->FA print $langs->trans('VAT'); } -if (in_array($object->element, array('propal', 'commande', 'facture')) && $object->status == $object::STATUS_DRAFT) { +if (in_array($object->element, array('propal', 'commande', 'facture', 'supplier_proposal', 'order_supplier', 'invoice_supplier')) && $object->status == $object::STATUS_DRAFT) { global $mysoc; if (empty($disableedit)) { diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 67ec98e3c96..b4c72197608 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -405,7 +405,16 @@ if (empty($reshook)) { } // Add a product line - if ($action == 'addline' && $usercancreate) { + if ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) { + // Define vat_rate + $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); + $vat_rate = str_replace('*', '', $vat_rate); + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); + foreach($object->lines as $line) { + $result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $line->info_bits, $line->product_type, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); + } + } elseif ($action == 'addline' && $usercancreate) { $db->begin(); $langs->load('errors'); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index ddf54ba0727..adcdb892d5c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1383,6 +1383,15 @@ if (empty($reshook)) { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } + } elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) { + // Define vat_rate + $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); + $vat_rate = str_replace('*', '', $vat_rate); + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); + foreach($object->lines as $line) { + $result = $object->updateline($line->id, $line->desc, $line->subprice, $vat_rate, $localtax1_rate, $localtax2_rate, $line->qty, $line->fk_product, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, $line->ref_supplier, $line->rang); + } } elseif ($action == 'addline' && $usercancreate) { // Add a product line $db->begin(); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index e4c2efd2c72..7be61673260 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -546,7 +546,16 @@ if (empty($reshook)) { } // Add a product line - if ($action == 'addline' && $usercancreate) { + if ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && GETPOST('vatforalllines', 'alpha')) { + // Define vat_rate + $vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0); + $vat_rate = str_replace('*', '', $vat_rate); + $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); + $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); + foreach($object->lines as $line) { + $result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); + } + } elseif ($action == 'addline' && $usercancreate) { $langs->load('errors'); $error = 0; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 24b45c992eb..7e8c1d1c1b3 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1257,6 +1257,7 @@ class SupplierProposal extends CommonObject $this->note_private = $obj->note_private; $this->note_public = $obj->note_public; $this->statut = (int) $obj->fk_statut; + $this->status = (int) $obj->fk_statut; $this->statut_libelle = $obj->statut_label; $this->datec = $this->db->jdate($obj->datec); // TODO deprecated $this->datev = $this->db->jdate($obj->datev); // TODO deprecated From 3883e66004eace7b024a6cb92364ff24938a2338 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 2 Sep 2022 14:25:03 +0000 Subject: [PATCH 171/453] Fixing style errors. --- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 2 +- htdocs/supplier_proposal/card.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index b4c72197608..f93373a64fa 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -411,7 +411,7 @@ if (empty($reshook)) { $vat_rate = str_replace('*', '', $vat_rate); $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); - foreach($object->lines as $line) { + foreach ($object->lines as $line) { $result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $line->info_bits, $line->product_type, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); } } elseif ($action == 'addline' && $usercancreate) { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index adcdb892d5c..65ae4e81150 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1389,7 +1389,7 @@ if (empty($reshook)) { $vat_rate = str_replace('*', '', $vat_rate); $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); - foreach($object->lines as $line) { + foreach ($object->lines as $line) { $result = $object->updateline($line->id, $line->desc, $line->subprice, $vat_rate, $localtax1_rate, $localtax2_rate, $line->qty, $line->fk_product, 'HT', $line->info_bits, $line->product_type, $line->remise_percent, 0, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice, $line->ref_supplier, $line->rang); } } elseif ($action == 'addline' && $usercancreate) { diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 7be61673260..9719928ab75 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -552,7 +552,7 @@ if (empty($reshook)) { $vat_rate = str_replace('*', '', $vat_rate); $localtax1_rate = get_localtax($vat_rate, 1, $object->thirdparty, $mysoc); $localtax2_rate = get_localtax($vat_rate, 2, $object->thirdparty, $mysoc); - foreach($object->lines as $line) { + foreach ($object->lines as $line) { $result = $object->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $vat_rate, $localtax1_rate, $localtax2_rate, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); } } elseif ($action == 'addline' && $usercancreate) { From f52680a7e0d20ad6f528e6f84ad46f604ca78a0b Mon Sep 17 00:00:00 2001 From: Nicolas MANAUD Date: Fri, 2 Sep 2022 16:29:02 +0200 Subject: [PATCH 172/453] Force date of movement in MouvementStock propagated to subproducts (When using the class MouvementStock, it's possible to force a date of movement by specifying a date (parameter). If this MouvementStock is affected to a product containing sub-product.s, this date of movement forced will also be applied to the MouvementStock of the related sub-products.) --- .../stock/class/mouvementstock.class.php | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 5653a564b9e..c762868aadb 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -586,7 +586,7 @@ class MouvementStock extends CommonObject // Add movement for sub products (recursive call) if (!$error && !empty($conf->global->PRODUIT_SOUSPRODUITS) && empty($conf->global->INDEPENDANT_SUBPRODUCT_STOCK) && empty($disablestockchangeforsubproduct)) { - $error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, 0, $label, $inventorycode); // we use 0 as price, because AWP must not change for subproduct + $error = $this->_createSubProduct($user, $fk_product, $entrepot_id, $qty, $type, 0, $label, $inventorycode, $datem); // we use 0 as price, because AWP must not change for subproduct } if ($movestock && !$error) { @@ -705,17 +705,18 @@ class MouvementStock extends CommonObject /** * Create movement in database for all subproducts * - * @param User $user Object user - * @param int $idProduct Id product - * @param int $entrepot_id Warehouse id - * @param int $qty Quantity - * @param int $type Type - * @param int $price Price - * @param string $label Label of movement - * @param string $inventorycode Inventory code - * @return int <0 if KO, 0 if OK + * @param User $user Object user + * @param int $idProduct Id product + * @param int $entrepot_id Warehouse id + * @param int $qty Quantity + * @param int $type Type + * @param int $price Price + * @param string $label Label of movement + * @param string $inventorycode Inventory code + * @param integer|string $datem Force date of movement + * @return int <0 if KO, 0 if OK */ - private function _createSubProduct($user, $idProduct, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '') + private function _createSubProduct($user, $idProduct, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '') { global $langs; @@ -747,7 +748,7 @@ class MouvementStock extends CommonObject if (!$error) { $tmpmove = dol_clone($this, 1); - $result = $tmpmove->_create($user, $pids[$key], $entrepot_id, ($qty * $pqtys[$key]), $type, 0, $label, $inventorycode); // This will also call _createSubProduct making this recursive + $result = $tmpmove->_create($user, $pids[$key], $entrepot_id, ($qty * $pqtys[$key]), $type, 0, $label, $inventorycode, $datem); // This will also call _createSubProduct making this recursive if ($result < 0) { $this->error = $tmpmove->error; $this->errors = array_merge($this->errors, $tmpmove->errors); From 5bc926815074ecae99e6dcf11ce9c7516f38a75c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 17:33:24 +0200 Subject: [PATCH 173/453] FIX activate/desactivate entry in dictionary --- htdocs/admin/dict.php | 44 +++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3503421d7fe..98502c31a25 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1028,10 +1028,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET active = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1048,10 +1051,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET active = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1068,10 +1074,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET favorite = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1088,10 +1097,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET favorite = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1108,10 +1120,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET eec = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET eec = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1128,10 +1143,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET eec = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET eec = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1140,6 +1158,8 @@ if (empty($reshook)) { } } } + + /* * View */ From e4dea1829e976f1d918d6cd6637f3c50931d0837 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 17:33:24 +0200 Subject: [PATCH 174/453] FIX activate/desactivate entry in dictionary --- htdocs/admin/dict.php | 44 +++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3cba1a333ca..3b1896e7ee7 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1028,10 +1028,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET active = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1048,10 +1051,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET active = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET active = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1068,10 +1074,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET favorite = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1088,10 +1097,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET favorite = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET favorite = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1108,10 +1120,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET eec = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET eec = 1 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1128,10 +1143,13 @@ if (empty($reshook)) { $rowidcol = "rowid"; } + $tablename = $tabname[$id]; + $tablename = preg_replace('/^'.preg_quote(MAIN_DB_PREFIX, '/').'/', '', $tablename); + if ($rowid) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET eec = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } elseif ($code) { - $sql = "UPDATE ".MAIN_DB_PREFIX.$tabname[$id]." SET eec = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); + $sql = "UPDATE ".MAIN_DB_PREFIX.$tablename." SET eec = 0 WHERE code = '".$db->escape(dol_escape_htmltag($code))."'".($entity != '' ? " AND entity = ".(int) $entity : ''); } $result = $db->query($sql); @@ -1140,6 +1158,8 @@ if (empty($reshook)) { } } } + + /* * View */ From 0d9e595f0ef277e7e470f54839e8b1b20c3df477 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Sep 2022 19:43:48 +0200 Subject: [PATCH 175/453] Fix profile to export categories --- htdocs/core/modules/modCategorie.class.php | 42 +++++++++++++--------- htdocs/langs/en_US/categories.lang | 1 + 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index c3b7f256b4b..905392aa996 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -164,8 +164,9 @@ class modCategorie extends DolibarrModules $typeexample .= ($typeexample ? " / " : "")."11=Website page"; } - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel"); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'pcat.label'=>'Text'); + // Definition of vars + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel"); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text'); $this->export_entities_array[$r] = array(); // We define here only fields that use another picto $this->export_help_array[$r] = array('cat.type'=>$typeexample); @@ -181,8 +182,8 @@ class modCategorie extends DolibarrModules $this->export_icon[$r] = $this->picto; $this->export_enabled[$r] = '!empty($conf->product->enabled) || !empty($conf->service->abled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export")); - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label'); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 'p.label'=>'Text'); + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label'); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.label'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'); // We define here only fields that use another picto $keyforselect = 'product'; @@ -192,6 +193,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cp.fk_product'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON extra.fk_object = p.rowid'; @@ -206,7 +208,7 @@ class modCategorie extends DolibarrModules $this->export_enabled[$r] = '!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire")); $this->export_fields_array[$r] = array( - 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", + 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_fournisseur'=>"SupplierCode", 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", @@ -214,7 +216,7 @@ class modCategorie extends DolibarrModules 't.libelle'=>'ThirdPartyType' ); $this->export_TypeFields_array[$r] = array( - 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', + 'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.fournisseur'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_fournisseur'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", @@ -236,6 +238,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cf ON cf.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cf.fk_soc'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object'; @@ -252,7 +255,7 @@ class modCategorie extends DolibarrModules $this->export_enabled[$r] = '!empty($conf->societe->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "export")); $this->export_fields_array[$r] = array( - 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", + 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", @@ -260,7 +263,7 @@ class modCategorie extends DolibarrModules 't.libelle'=>'ThirdPartyType', 'pl.code'=>'ProspectLevel', 'st.code'=>'ProspectStatus' ); $this->export_TypeFields_array[$r] = array( - 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', + 'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", @@ -282,6 +285,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cs.fk_soc'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object'; @@ -299,8 +303,8 @@ class modCategorie extends DolibarrModules $this->export_icon[$r] = $this->picto; $this->export_enabled[$r] = '!empty($conf->adherent->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "export")); - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname'); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname'); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto $keyforselect = 'adherent'; @@ -310,6 +314,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_member as cm ON cm.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'adherent as p ON p.rowid = cm.fk_member'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON cat.rowid = extra.fk_object '; @@ -324,7 +329,7 @@ class modCategorie extends DolibarrModules $this->export_enabled[$r] = '!empty($conf->societe->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "contact", "export")); $this->export_fields_array[$r] = array( - 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", + 'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid' => 'ContactId', 'civ.label' => 'UserTitle', 'p.lastname' => 'LastName', 'p.firstname' => 'Firstname', 'p.address' => 'Address', 'p.zip' => 'Zip', 'p.town' => 'Town', 'c.code' => 'CountryCode', 'c.label' => 'Country', 'p.birthday' => 'DateOfBirth', 'p.poste' => 'PostOrFunction', @@ -335,8 +340,8 @@ class modCategorie extends DolibarrModules 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email" ); $this->export_TypeFields_array[$r] = array( - 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', - 'civ.label' => 'List:c_civility:label:label', 'p.lastname' => 'Text', 'p.firstname' => 'Text', + 'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', + 'civ.label' => 'List:c_civility:label:label', 'p.rowid'=>'Numeric', 'p.lastname' => 'Text', 'p.firstname' => 'Text', 'p.address' => 'Text', 'p.zip' => 'Text', 'p.town' => 'Text', 'c.code' => 'Text', 'c.label' => 'List:c_country:label:label', 'p.birthday' => 'Date', 'p.poste' => 'Text', 'p.phone' => 'Text', 'p.phone_perso' => 'Text', 'p.phone_mobile' => 'Text', 'p.fax' => 'Text', 'p.email' => 'Text', @@ -363,6 +368,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_contact as cc ON cc.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'socpeople as p ON p.rowid = cc.fk_socpeople'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; @@ -381,8 +387,8 @@ class modCategorie extends DolibarrModules $this->export_icon[$r] = $this->picto; $this->export_enabled[$r] = '!empty($conf->projet->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("projet", "export")); - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name"); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"List:societe:nom:rowid", 's.nom'=>"Text"); + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name"); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 's.rowid'=>"List:societe:nom:rowid", 's.nom'=>"Text"); $this->export_entities_array[$r] = array('p.rowid'=>'project', 'p.ref'=>'project', 's.rowid'=>"company", 's.nom'=>"company"); // We define here only fields that use another picto $keyforselect = 'projet'; @@ -392,6 +398,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_project as cp ON cp.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'projet as p ON p.rowid = cp.fk_project'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON extra.fk_object = p.rowid'; @@ -406,8 +413,8 @@ class modCategorie extends DolibarrModules $this->export_icon[$r] = $this->picto; $this->export_enabled[$r] = '!empty($conf->user->enabled)'; $this->export_permission[$r] = array(array("categorie", "lire"), array("user", "export")); - $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'TechnicalID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname'); - $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); + $this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'UserID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname'); + $this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'user', 'p.login'=>'user', 'p.lastname'=>'user', 'p.firstname'=>'user'); // We define here only fields that use another picto $keyforselect = 'user'; @@ -417,6 +424,7 @@ class modCategorie extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_user as cu ON cu.fk_categorie = cat.rowid'; $this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'user as p ON p.rowid = cu.fk_user'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON extra.fk_object = p.rowid'; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index a2d05767cae..5330730ad3a 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -67,6 +67,7 @@ StockCategoriesShort=Warehouse tags/categories ThisCategoryHasNoItems=This category does not contain any items. CategId=Tag/category id ParentCategory=Parent tag/category +ParentCategoryID=ID of parent tag/category ParentCategoryLabel=Label of parent tag/category CatSupList=List of vendors tags/categories CatCusList=List of customers/prospects tags/categories From 6ff1d5574f07b83c0ff4bd1dbc6280afc0d317b4 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 2 Sep 2022 20:50:45 +0200 Subject: [PATCH 176/453] Update ChangeLog --- ChangeLog | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index caec167d380..9a127d4fcee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,7 @@ NEW: Accept 'auto' for ref of object on import of purchase order/proposal NEW: Accountancy - Add more filters and info on page to bind accounting accounts NEW: Accountancy - Add subledger account when generate a transaction with a deposit invoice NEW: Accountancy - Add a massaction to preselect an account (customer and supplier list) +NEW: Accountancy - Add hidden feature for accounting reconciliation NEW: ACE Editor is restored at same cursor position after a save. NEW: Add "addMoreActionsButtons" hook to subscription form NEW: Add an option in GUI to show a Quick add button into top menu bar @@ -50,9 +51,6 @@ NEW: Add column date of Signature on proposal list NEW: Add column template invoice in invoice list NEW: Add column "Total HT" to products array on document creation card NEW: Add configuration for text color of button action -NEW: Add constant to hide categories in TakePos -NEW: Add constant to show category description in TakePos -NEW: Add constant to show only the products in stock in TakePos NEW: Add entity filter in exports NEW: Show the event block on recurring invoices #20870 NEW: Add filter "opportunity status" on statistics of projects. @@ -116,11 +114,11 @@ NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439) NEW: possibility to consume multiple batch NEW: Reverse movement product consumption NEW: Send email to the supplier order contact -NEW: New permission to report time on timesheet. +NEW: add permission to report time on timesheet NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level NEW: Show number of votes into the label of tab "Results" of a survey NEW: Some core tables are created only at module activation -NEW: split consumption line on MO +NEW: MRP - split consumption line on MO NEW: stock filter in reassort lists NEW: stock limit in stock export CSV NEW: Supplier order - Show ref supplier of reception in linked object block @@ -128,6 +126,9 @@ NEW: support user_modif in order NEW: TakePOS - barcode rule to insert product in TakePOS NEW: TakePOS - pagination on search results NEW: TakePOS - show product reference +NEW: TakePOS - add constant to hide categories +NEW: TakePOS - add constant to show category description +NEW: TakePOS - add constant to show only the products in stock NEW: The backup tools has an "lowmemory" option for mysqldump on large database NEW: The 'reposition' class works on ajax constantonoff that make redirects NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice @@ -136,7 +137,6 @@ NEW: total mark rate in list NEW: uncheck "send message" by default on a ticket when private messages has been checked NEW: VAT Report by month - Show detail by rate and also by code NEW: Ticket triggers: allow to automatically send messages on new tickets -NEW: Accountancy - Add hidden feature for accounting reconciliation NEW: Can store the session into database (instead of beeing managed by PHP) NEW: Added MMK currency (Myanmar Kyat) NEW: On a form to send an email, we show all emails of contacts of object @@ -161,7 +161,7 @@ NEW: Identification of tr is possible with by attribute data-id on some pages NEW: Import with select boxes V2 NEW: Can use current entity filter on 'chkbxlst' NEW: Creation of the function select_bom() used to display bom select list -NEW: add printFieldListWhere hook in product reassort card + NEW: Add trigger and event on completely received status change NEW: Add utility function send backup by mail NEW: add WordPress OAuth to save a token (not SSO) @@ -194,6 +194,7 @@ NEW: Add hook before the public ticket list NEW: Add hook doaction in takepos invoice NEW: Add hook for Notif NEW: Add hook for more buttons +NEW: add hook printFieldListWhere in product ressort card NEW: Add hook printFieldListWhere in "show_contacts" function NEW: Add hook printFieldWhere in load_state_board function NEW: Add hooks contact tab badge and hooks parameter for avoid conflicts From 7c04468246f9a92cbb16460e7c92960910990916 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 10:36:54 +0200 Subject: [PATCH 177/453] fix bug#22057 --- htdocs/compta/resultat/clientfourn.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index ed4dac6c3f3..a79729453b7 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -39,6 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'bills', 'donation', 'salaries', 'accountancy', 'loan')); From f4a4ecfdf3ac40d8a4650cbe0bf40e279448d6ee Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Sep 2022 10:52:33 +0200 Subject: [PATCH 178/453] NEW private and public note on user.php use same code on Dolibarr --- htdocs/install/mysql/tables/llx_user.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index a47b40cb3d1..7b86b5c3396 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -76,7 +76,7 @@ create table llx_user idpers3 varchar(128), note_public text, - note text DEFAULT NULL, + note_private text DEFAULT NULL, model_pdf varchar(255) DEFAULT NULL, datelastlogin datetime, datepreviouslogin datetime, From 55f8d722194c7530e7acd1d3f1156d16a7b820c1 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Sep 2022 10:56:19 +0200 Subject: [PATCH 179/453] Update 16.0.0-17.0.0.sql --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 2c093019e72..016dc7283df 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -142,3 +142,5 @@ CREATE TABLE llx_bank_extrafields )ENGINE=innodb; ALTER TABLE llx_bank_extrafields ADD INDEX idx_bank_extrafields (fk_object); + +ALTER TABLE llx_user RENAME COLUMN note TO note_private; From a8465d16fa852e61e369305d39fd9000696fe020 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:05:03 +0200 Subject: [PATCH 180/453] Update code --- htdocs/comm/propal/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index fb75b3f0c6b..553e3e8ea9c 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2010-2021 Philippe Grand + * Copyright (C) 2010-2022 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013-2014 Florian Henry @@ -448,7 +448,7 @@ if (empty($reshook)) { $object->origin_id = GETPOST('originid'); // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); } @@ -1653,7 +1653,7 @@ if ($action == 'create') { $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { if (!empty($objectsrc->multicurrency_code)) { $currency_code = $objectsrc->multicurrency_code; } @@ -1663,7 +1663,7 @@ if ($action == 'create') { } } } else { - if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) { + if (isModEnabled("multicurrency") && !empty($soc->multicurrency_code)) { $currency_code = $soc->multicurrency_code; } } @@ -1865,7 +1865,7 @@ if ($action == 'create') { print ""; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print ''; print '"; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print '"; print '"; @@ -2518,7 +2518,7 @@ if ($action == 'create') { print ''; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { // Multicurrency code print ''; print '"; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print ''; print '"; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print '"; print '"; @@ -2535,7 +2535,7 @@ if ($action == 'create' && $usercancreate) { print ''; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { // Multicurrency code print ''; print ''; print ''; print ''; + print ''; + print ''; - print ''; - print ''; print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'thsticky '); - print_liste_field_titre("Type", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("mainmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("leftmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("RelativeURL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("URL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->transnoentitiesnoconv('DetailUrl')); print_liste_field_titre("LanguageFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center '); - print_liste_field_titre("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder); - print_liste_field_titre("UserType", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans('DetailEnabled')); + print_liste_field_titre("Rights", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->trans('DetailRight')); + print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, '', $langs->trans('DetailTarget')); + print_liste_field_titre("MenuForUsers", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ', $langs->trans('DetailUser')); print "\n"; if (count($menus)) { @@ -3534,7 +3570,15 @@ if ($module == 'initmodule') { print ''; print ''; print ''; From 13260bb973db62184fec38ec6cef55e972149a7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 15:51:19 +0200 Subject: [PATCH 290/453] Merge --- htdocs/core/modules/mailings/thirdparties.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 1d7acf02c09..335e3ac575a 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -317,11 +317,11 @@ class mailing_thirdparties extends MailingTargets $s .= ajax_combobox("filter_status_thirdparties"); if (!empty($conf->global->MAIN_MULTILANGS)) { - // Choose language - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; - $formadmin = new FormAdmin($this->db); - $s .= ''.$langs->trans("DefaultLang").': '; - $s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang_thirdparties', 0, null, 1, 0, 0, '', 0, 0, 0, null, 1); + // Choose language + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin = new FormAdmin($this->db); + $s .= ''.$langs->trans("DefaultLang").': '; + $s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang_thirdparties', 0, null, 1, 0, 0, '', 0, 0, 0, null, 1); } return $s; From bed495fc62a53842b9ac72db83959b6ca0fb29c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 16:05:00 +0200 Subject: [PATCH 291/453] Trans --- htdocs/langs/en_US/modulebuilder.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 53e60fa0fbd..a16dfc52ed2 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -89,8 +89,8 @@ ListOfMenusEntries=List of menu entries ListOfDictionariesEntries=List of dictionaries entries ListOfPermissionsDefined=List of defined permissions SeeExamples=See examples here -EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION) -VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create), 5=Visible on list end view form only (not create, not update).

Using a negative value means field is not shown by default on list but can be selected for viewing).

It can be an expression, for example:
preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
($user->rights->holiday->define_holiday ? 1 : 0) +EnabledDesc=Condition to have this field active.

Examples:
1
isModEnabled('MAIN_MODULE_MYMODULE')
getDolGlobalString('MYMODULE_OPTION')==2 +VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create), 5=Visible on list end view form only (not create, not update).

Using a negative value means field is not shown by default on list but can be selected for viewing).

It can be an expression, for example:
preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
$user->hasRights('holiday', 'define_holiday')?1:5 DisplayOnPdfDesc=Display this field on compatible PDF documents, you can manage position with "Position" field.
Currently, known compatibles PDF models are : eratosthene (order), espadon (ship), sponge (invoices), cyan (propal/quotation), cornas (supplier order)

For document :
0 = not displayed
1 = display
2 = display only if not empty

For document lines :
0 = not displayed
1 = displayed in a column
3 = display in line description column after the description
4 = display in description column after the description only if not empty DisplayOnPdf=Display on PDF IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0) From 9569d0462e51cd72ce825da4de3f5f0ac2047bb0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 16:25:06 +0200 Subject: [PATCH 292/453] Clean code --- htdocs/admin/menus/edit.php | 17 ++++++++++------- htdocs/core/class/html.formadmin.class.php | 2 ++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 64c3f4a7015..d619cd28e91 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -305,7 +305,7 @@ if ($action == 'create') { print '
'; // Type - print ''; @@ -352,12 +353,6 @@ if ($action == 'create') { print ''; print ''; - // Target - print ''; - // Enabled print ''; print ''; @@ -366,6 +361,14 @@ if ($action == 'create') { print ''; print ''; + // Target + print ''; + print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; @@ -1937,7 +1937,7 @@ if ($action == 'create') { } print '
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc, 0, $langs, 1, -1, -1, $conf->currency)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
'; @@ -2649,7 +2649,7 @@ if ($action == 'create') { print ''; - if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { + if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''; print ''; From 98362881a673d3f2d9556254c6dd5e346b820dc4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Sep 2022 11:06:38 +0200 Subject: [PATCH 181/453] Update note.php --- htdocs/user/note.php | 84 +++++++++++++------------------------------- 1 file changed, 24 insertions(+), 60 deletions(-) diff --git a/htdocs/user/note.php b/htdocs/user/note.php index e0ac0bd4dcf..c0c93a75d64 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +// Get parameters $id = GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'usernote'; // To manage different context of search @@ -39,16 +40,19 @@ $object->fetch($id, '', '', 1); $object->getrights(); // If user is not user read and no permission to read other users, we stop -if (($object->id != $user->id) && (!$user->hasRight("user", "user", "read"))) { +if (($object->id != $user->id) && (!$user->rights->user->user->lire)) { accessforbidden(); } +// Permissions +$permissionnote = $user->hasRight("user", "self", "write"); // Used by the include of actions_setnotes.inc.php + // Security check $socid = 0; if ($user->socid > 0) { $socid = $user->socid; } -$feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user'); +$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); @@ -59,37 +63,23 @@ $hookmanager->initHooks(array('usercard', 'usernote', 'globalcard')); /* * Actions */ - $parameters = array('id'=>$socid); -$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - if (empty($reshook)) { - if ($action == 'update' && $user->hasRight("user", "user", "write") && !GETPOST("cancel")) { - $db->begin(); - - $res = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'restricthtml'), ENT_QUOTES | ENT_HTML5)); - if ($res < 0) { - $mesg = '
'.$adh->error.'
'; - $db->rollback(); - } else { - $db->commit(); - } - } + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once } /* * View */ -$form = new Form($db); -$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname; -$title = $person_name." - ".$langs->trans('Notes'); -$help_url = ''; -llxHeader('', $title, $help_url); +llxHeader(); + +$form = new Form($db); if ($id) { $head = user_prepare_head($object); @@ -99,7 +89,7 @@ if ($id) { $linkback = ''; - if ($user->hasRight("user", "user", "read") || $user->admin) { + if ($user->rights->user->user->lire || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } @@ -107,7 +97,7 @@ if ($id) { $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; - dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); + dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; @@ -127,7 +117,7 @@ if ($id) { print '
'; - $editenabled = (($action == 'edit') && $user->hasRight("user", "user", "write")); - - // Note - print ''; - print '"; - print "
'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; $addadmin = ''; if (property_exists($object, 'admin')) { - if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) { + if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); } elseif (!empty($object->admin)) { $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); @@ -138,46 +128,20 @@ if ($id) { } print '
'.$langs->trans("Note").''; - if ($editenabled) { - print ""; - print "id."\">"; - // Editeur wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note_private', $object->note_private, '', 280, 'dolibarr_notes', 'In', true, false, getDolGlobalInt('FCKEDITOR_ENABLE_SOCIETE'), ROWS_8, '90%'); - $doleditor->Create(); - } else { - print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)); - } - print "
"; + print ''; + + //print '
'; + + //print '
'; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + print dol_get_fiche_end(); - - if ($action == 'edit') { - print $form->buttonsSaveCancel(); - } - - - /* - * Actions - */ - - print '
'; - - if ($user->hasRight("user", "user", "write") && $action != 'edit') { - print ''.$langs->trans('Modify').""; - } - - print "
"; - - print "\n"; +} else { + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); } // End of page From e10ce6a6a0002cd65bb31942484da026fc82bf29 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:07:45 +0200 Subject: [PATCH 182/453] Update code --- htdocs/comm/propal/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 31c4489d47f..fb47a3d918a 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2010-2022 Philippe Grand * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry @@ -227,13 +227,13 @@ $arrayfields = array( 'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), 'p.total_ht_invoiced'=>array('label'=>"AmountInvoicedHT", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)), 'p.total_invoiced'=>array('label'=>"AmountInvoicedTTC", 'checked'=>0, 'enabled'=>!empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)), - 'p.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'p.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'p.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'p.multicurrency_total_tva'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'p.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)), - 'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>!empty($conf->multicurrency->enabled) && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)), + 'p.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_total_tva'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'p.multicurrency_total_ht_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedHT', 'checked'=>0, 'enabled'=>isModEnabled("multicurrency") && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)), + 'p.multicurrency_total_invoiced'=>array('label'=>'MulticurrencyAmountInvoicedTTC', 'checked'=>0, 'enabled'=>isModEnabled("multicurrency") && !empty($conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT)), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>-1), 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), From a0bb17aea90612341608e5b19f0e616358702b9c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Sep 2022 11:07:47 +0200 Subject: [PATCH 183/453] wip --- htdocs/core/tpl/notes.tpl.php | 2 ++ htdocs/user/class/user.class.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index 1110e91b019..dfa9b0e4591 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -91,6 +91,8 @@ if ($module == 'propal') { $permission = $user->rights->produit->creer; } elseif ($module == 'ecmfiles') { $permission = $user->rights->ecm->setup; +} elseif ($module == 'user') { + $permission = $user->hasRight("user", "self", "write"); } //else dol_print_error('','Bad value '.$module.' for param module'); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index df2b6bc0174..a521be145ef 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -433,7 +433,7 @@ class User extends CommonObject $sql .= " u.socialnetworks,"; $sql .= " u.signature, u.office_phone, u.office_fax, u.user_mobile, u.personal_mobile,"; $sql .= " u.address, u.zip, u.town, u.fk_state as state_id, u.fk_country as country_id,"; - $sql .= " u.admin, u.login, u.note as note_private, u.note_public,"; + $sql .= " u.admin, u.login, u.note_private, u.note_public,"; $sql .= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,"; $sql .= " u.fk_soc, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid, u.fk_user_expense_validator, u.fk_user_holiday_validator,"; $sql .= " u.statut, u.lang, u.entity,"; @@ -1979,7 +1979,7 @@ class User extends CommonObject $sql .= ", dateemploymentend=".(strval($this->dateemploymentend) != '' ? "'".$this->db->idate($this->dateemploymentend)."'" : 'null'); $sql .= ", datestartvalidity=".(strval($this->datestartvalidity) != '' ? "'".$this->db->idate($this->datestartvalidity)."'" : 'null'); $sql .= ", dateendvalidity=".(strval($this->dateendvalidity) != '' ? "'".$this->db->idate($this->dateendvalidity)."'" : 'null'); - $sql .= ", note = '".$this->db->escape($this->note_private)."'"; + $sql .= ", note_private = '".$this->db->escape($this->note_private)."'"; $sql .= ", note_public = '".$this->db->escape($this->note_public)."'"; $sql .= ", photo = ".($this->photo ? "'".$this->db->escape($this->photo)."'" : "null"); $sql .= ", openid = ".($this->openid ? "'".$this->db->escape($this->openid)."'" : "null"); From f9a404795fbc1b49570d29f429e5434899326592 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:09:05 +0200 Subject: [PATCH 184/453] Update code --- htdocs/comm/propal/class/propal.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 51c07f15269..c91d13d6b9c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand * Copyright (C) 2010-2020 Juanjo Menent - * Copyright (C) 2010-2017 Philippe Grand + * Copyright (C) 2010-2022 Philippe Grand * Copyright (C) 2012-2014 Christophe Battarel * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry @@ -335,11 +335,11 @@ class Propal extends CommonObject 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>220), 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>225), 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>230), - 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>235), - 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>240, 'isameasure'=>1), - 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>245, 'isameasure'=>1), - 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>250, 'isameasure'=>1), - 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>255, 'isameasure'=>1), + 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>235), + 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>240, 'isameasure'=>1), + 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>245, 'isameasure'=>1), + 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>250, 'isameasure'=>1), + 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>255, 'isameasure'=>1), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>260), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), From 120fb10738811fe906f8d8d82c5a02ebbf27ec02 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:09:59 +0200 Subject: [PATCH 185/453] Update code --- htdocs/commande/card.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 73bf27c0cfd..3d70261e0da 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2019 Philippe Grand + * Copyright (C) 2011-2022 Philippe Grand * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2012 Cedric Salvador @@ -13,7 +13,7 @@ * Copyright (C) 2014 Ferran Marcet * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018-2021 Frédéric France - * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2022 Gauthier VERDOL * * 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 @@ -1664,7 +1664,7 @@ if ($action == 'create' && $usercancreate) { $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); } - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { if (!empty($objectsrc->multicurrency_code)) { $currency_code = $objectsrc->multicurrency_code; } @@ -1692,7 +1692,7 @@ if ($action == 'create' && $usercancreate) { $remise_absolue = 0; $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : ''; - if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) { + if (isModEnabled("multicurrency") && !empty($soc->multicurrency_code)) { $currency_code = $soc->multicurrency_code; } @@ -1913,7 +1913,7 @@ if ($action == 'create' && $usercancreate) { print "
'.$form->editfieldkey("Currency", 'multicurrency_code', '', $object, 0).''; @@ -1992,7 +1992,7 @@ if ($action == 'create' && $usercancreate) { print '
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
'; @@ -2646,7 +2646,7 @@ if ($action == 'create' && $usercancreate) { print ''; - if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { + if (isModEnabled("multicurrency") && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''; print ''; From 4a8f61838dea468573b4608c989f06219aa5760f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:11:38 +0200 Subject: [PATCH 186/453] Update code --- htdocs/commande/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 438a00bbb56..12a85f0bf11 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -192,11 +192,11 @@ $arrayfields = array( 'c.total_ht'=>array('label'=>"AmountHT", 'checked'=>1, 'position'=>75), 'c.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0, 'position'=>80), 'c.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0, 'position'=>85), - 'c.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>90), - 'c.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>95), - 'c.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>100), - 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>105), - 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1), 'position'=>110), + 'c.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>90), + 'c.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>95), + 'c.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>100), + 'c.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>105), + 'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116), 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (empty($conf->margin->enabled) || !$user->rights->margins->liretous ? 0 : 1)), From 98b88fab9b301e1b6913fefed4438f748c264f64 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sat, 3 Sep 2022 11:12:45 +0200 Subject: [PATCH 187/453] Update note.php --- htdocs/user/note.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/user/note.php b/htdocs/user/note.php index c0c93a75d64..2b9e8388063 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -40,7 +40,7 @@ $object->fetch($id, '', '', 1); $object->getrights(); // If user is not user read and no permission to read other users, we stop -if (($object->id != $user->id) && (!$user->rights->user->user->lire)) { +if (($object->id != $user->id) && (!$user->hasRight("user", "user", "read"))) { accessforbidden(); } @@ -52,7 +52,7 @@ $socid = 0; if ($user->socid > 0) { $socid = $user->socid; } -$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user'); +$feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user'); $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); @@ -89,7 +89,7 @@ if ($id) { $linkback = ''; - if ($user->rights->user->user->lire || $user->admin) { + if ($user->hasRight("user", "user", "read") || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } @@ -97,7 +97,7 @@ if ($id) { $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); $morehtmlref .= ''; - dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref); + dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref); print '
'; @@ -117,7 +117,7 @@ if ($id) { print '
'; print ''; print ''; - //if (!empty($conf->multicurrency->enabled)) { + //if (isModEnabled("multicurrency")) { // print ''; //} print ''; @@ -1575,7 +1575,7 @@ if ($action == 'create') { // Price print '\n"; // Price multicurrency - /*if (!empty($conf->multicurrency->enabled)) { + /*if (isModEnabled("multicurrency")) { print ''; }*/ // Quantity @@ -1718,7 +1718,7 @@ if ($action == 'create') { print ''; // Price multicurrency - /*if (!empty($conf->multicurrency->enabled)) { + /*if (isModEnabled("multicurrency")) { print ''; }*/ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4aeed158dc5..8be014b8959 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2010-2020 Juanjo Menent * Copyright (C) 2012-2013 Christophe Battarel - * Copyright (C) 2011-2019 Philippe Grand + * Copyright (C) 2011-2022 Philippe Grand * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012-2015 Raphaël Doursenaud * Copyright (C) 2012 Cedric Salvador @@ -5086,7 +5086,7 @@ abstract class CommonObject print ''; print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; } print ''; diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 49dccc2d0fa..b76ad8c7a47 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -830,7 +830,7 @@ class dolReceiptPrinter extends Printer $row = $this->db->fetch_object($resql); $spacestoadd = $nbcharactbyline - strlen($langs->transnoentitiesnoconv("PaymentTypeShort".$row->code)) - 12; $spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0); - $amount_payment = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; + $amount_payment = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount; if ($row->code == "LIQ") { $amount_payment = $amount_payment + $row->pos_change; // Show amount with excess received if is cash payment } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 4efea43b044..3b0c2250c49 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1868,7 +1868,7 @@ function pdf_getlineupexcltax($object, $i, $outputlangs, $hidedetails = 0) } if (empty($reshook)) { if (empty($hidedetails) || $hidedetails > 1) { - $subprice = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_subprice : $object->lines[$i]->subprice); + $subprice = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_subprice : $object->lines[$i]->subprice); $result .= price($sign * $subprice, 0, $outputlangs); } } @@ -2253,7 +2253,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) if ($object->lines[$i]->special_code == 3) { $result .= $outputlangs->transnoentities("Option"); } elseif (empty($hidedetails) || $hidedetails > 1) { - $total_ht = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht); + $total_ht = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ht : $object->lines[$i]->total_ht); if (!empty($object->lines[$i]->situation_percent) && $object->lines[$i]->situation_percent > 0) { // TODO Remove this. The total should be saved correctly in database instead of being modified here. $prev_progress = 0; @@ -2309,7 +2309,7 @@ function pdf_getlinetotalwithtax($object, $i, $outputlangs, $hidedetails = 0) if ($object->lines[$i]->special_code == 3) { $result .= $outputlangs->transnoentities("Option"); } elseif (empty($hidedetails) || $hidedetails > 1) { - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ttc : $object->lines[$i]->total_ttc); + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1 ? $object->lines[$i]->multicurrency_total_ttc : $object->lines[$i]->total_ttc); if ($object->lines[$i]->situation_percent > 0) { // TODO Remove this. The total should be saved correctly in database instead of being modified here. $prev_progress = 0; From 53b7540d6037a5e801f276c04d456126416ea1fb Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:17:05 +0200 Subject: [PATCH 191/453] Update code --- htdocs/core/modules/modCommande.class.php | 6 +++--- htdocs/core/modules/modFacture.class.php | 8 ++++---- htdocs/core/modules/modFournisseur.class.php | 14 +++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 4f2b58ff00d..6a88c14271b 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -211,7 +211,7 @@ class modCommande extends DolibarrModules 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['c.multicurrency_code'] = 'Currency'; $this->export_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate'; $this->export_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -328,7 +328,7 @@ class modCommande extends DolibarrModules 'c.fk_statut' => 'Status*' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate'; $this->import_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -405,7 +405,7 @@ class modCommande extends DolibarrModules 'cd.rang' => 'LinePosition' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate'; $this->import_fields_array[$r]['cd.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index a819dae666c..f7d902d22f1 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -267,7 +267,7 @@ class modFacture extends DolibarrModules 'f.note_private' => 'NotePrivate', 'f.model_pdf' => 'Model' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['f.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; $this->import_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -399,7 +399,7 @@ class modFacture extends DolibarrModules // fk_user_modif // ref_ext ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['fd.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['fd.multicurrency_subprice'] = 'CurrencyRate'; $this->import_fields_array[$r]['fd.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -518,7 +518,7 @@ class modFacture extends DolibarrModules 'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic" ); // Add multicurrency fields - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; $this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; $this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -647,7 +647,7 @@ class modFacture extends DolibarrModules 'pt.code'=>'CodePaymentMode', 'pt.libelle'=>'LabelPaymentMode', 'p.note'=>'PaymentNote', 'p.fk_bank'=>'IdTransaction', 'ba.ref'=>'AccountRef' ); $this->export_help_array[$r] = array('f.paye'=>'InvoicePaidCompletelyHelp'); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; $this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; $this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index afc6fec4fc6..e05d7964094 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -317,7 +317,7 @@ class modFournisseur extends DolibarrModules 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'p.accountancy_code_buy'=>'ProductAccountancyBuyCode', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; $this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; $this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -391,7 +391,7 @@ class modFournisseur extends DolibarrModules 'f.fk_statut'=>'InvoiceStatus', 'f.note_public'=>"InvoiceNote", 'p.rowid'=>'PaymentId', 'pf.amount'=>'AmountPayment', 'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber', 'p.fk_bank'=>'IdTransaction', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; $this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; $this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -458,7 +458,7 @@ class modFournisseur extends DolibarrModules 'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.ref'=>'RefSupplier', 'fd.fk_product'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency'; $this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; $this->export_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -557,7 +557,7 @@ class modFournisseur extends DolibarrModules 'f.model_pdf' => 'Model', 'f.date_valid' => 'Validation Date' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['f.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate'; $this->import_fields_array[$r]['f.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -649,7 +649,7 @@ class modFournisseur extends DolibarrModules 'fd.date_end' => 'End Date', 'fd.fk_unit' => 'Unit' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['fd.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['fd.multicurrency_subprice'] = 'CurrencyRate'; $this->import_fields_array[$r]['fd.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -735,7 +735,7 @@ class modFournisseur extends DolibarrModules 'c.model_pdf' => 'Model' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate'; $this->import_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -817,7 +817,7 @@ class modFournisseur extends DolibarrModules 'cd.fk_unit' => 'Unit' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate'; $this->import_fields_array[$r]['cd.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; From 30c58ab74db0d7ee9481ec6f4db880f79b22408f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:19:18 +0200 Subject: [PATCH 192/453] Update code --- .../core/modules/asset/doc/pdf_standard_asset.modules.php | 4 ++-- htdocs/core/modules/commande/doc/pdf_einstein.modules.php | 6 +++--- .../core/modules/commande/doc/pdf_eratosthene.modules.php | 6 +++--- htdocs/core/modules/modProduct.class.php | 4 ++-- htdocs/core/modules/modPropale.class.php | 6 +++--- htdocs/core/modules/modService.class.php | 4 ++-- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php index de378ee79a8..e313c612eb0 100644 --- a/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php +++ b/htdocs/core/modules/asset/doc/pdf_standard_asset.modules.php @@ -669,13 +669,13 @@ class pdf_standard_asset extends ModelePDFAsset // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $prev_progress = $object->lines[$i]->get_prev_progress($object->id); if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) { // Compute progress from previous situation - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } else { $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } } else { - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $sign * $object->lines[$i]->total_tva; diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index d34c66c0def..b1476b393d0 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -529,7 +529,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collection of totals by value of vat in $this->vat["rate"] = total_tva - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $object->lines[$i]->total_tva; @@ -938,14 +938,14 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $this->atleastoneratenotnull = 0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 28003fff639..34cdb41e6b8 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -754,7 +754,7 @@ class pdf_eratosthene extends ModelePDFCommandes // Collection of totals by value of vat in $this->tva["rate"] = total_tva - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $object->lines[$i]->total_tva; @@ -1152,14 +1152,14 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $this->atleastoneratenotnull = 0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index f3c79de5ab8..604d96fd4cd 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -791,7 +791,7 @@ class modProduct extends DolibarrModules 'sp.remise_percent'=>'DiscountQtyMin' )); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( 'sp.fk_multicurrency'=>'CurrencyCodeId', //ideally this should be automatically obtained from the CurrencyCode on the next line 'sp.multicurrency_code'=>'CurrencyCode', @@ -853,7 +853,7 @@ class modProduct extends DolibarrModules // TODO Make this field not required and calculate it from price and qty 'sp.remise_percent' => '20' )); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( 'sp.fk_multicurrency'=>'eg: 2, rowid for code of multicurrency currency', 'sp.multicurrency_code'=>'GBP', diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 13991cdcafa..524aa0086ea 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -197,7 +197,7 @@ class modPropale extends DolibarrModules 'cd.tva_tx'=>"LineVATRate", 'cd.qty'=>"LineQty", 'cd.total_ht'=>"LineTotalHT", 'cd.total_tva'=>"LineTotalVAT", 'cd.total_ttc'=>"LineTotalTTC", 'p.rowid'=>'ProductId', 'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->export_fields_array[$r]['c.multicurrency_code'] = 'Currency'; $this->export_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate'; $this->export_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -300,7 +300,7 @@ class modPropale extends DolibarrModules 'c.date_livraison' => 'DeliveryDate', 'c.fk_user_valid' => 'ValidatedById' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate'; $this->import_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; @@ -388,7 +388,7 @@ class modPropale extends DolibarrModules 'cd.date_end' => 'End Date', 'cd.buy_price_ht' => 'LineBuyPriceHT' ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency'; $this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate'; $this->import_fields_array[$r]['cd.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 598c9131efb..d2431d3e22c 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -740,7 +740,7 @@ class modService extends DolibarrModules 'sp.remise_percent'=>'DiscountQtyMin' )); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array( 'sp.fk_multicurrency'=>'CurrencyCodeId', //ideally this should be automatically obtained from the CurrencyCode on the next line 'sp.multicurrency_code'=>'CurrencyCode', @@ -782,7 +782,7 @@ class modService extends DolibarrModules // TODO Make this field not required and calculate it from price and qty 'sp.remise_percent' => '20' )); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $this->import_examplevalues_array[$r] = array_merge($this->import_examplevalues_array[$r], array( 'sp.fk_multicurrency'=>'eg: 2, rowid for code of multicurrency currency', 'sp.multicurrency_code'=>'GBP', From 7cf367f0cbd997275927890bcaa541a0c398eca0 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:21:11 +0200 Subject: [PATCH 193/453] Update code --- .../modules/facture/doc/pdf_crabe.modules.php | 22 ++++++++--------- .../facture/doc/pdf_sponge.modules.php | 24 +++++++++---------- .../modules/mrp/doc/pdf_vinci.modules.php | 4 ++-- .../product/doc/pdf_standard.modules.php | 2 +- .../modules/propale/doc/pdf_azur.modules.php | 6 ++--- .../modules/propale/doc/pdf_cyan.modules.php | 6 ++--- 6 files changed, 32 insertions(+), 32 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 3b82e92f1ab..2a94a94103e 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -298,9 +298,9 @@ class pdf_crabe extends ModelePDFFactures if ($conf->facture->dir_output) { $object->fetch_thirdparty(); - $deja_regle = $object->getSommePaiement((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_credit_notes_included = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_deposits_included = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $deja_regle = $object->getSommePaiement((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_credit_notes_included = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_deposits_included = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); // Definition of $dir and $file if ($object->specimen) { @@ -707,13 +707,13 @@ class pdf_crabe extends ModelePDFFactures // Collection of totals by value of VAT in $this->tva["taux"]=total_tva $prev_progress = $object->lines[$i]->get_prev_progress($object->id); if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) { // Compute progress from previous situation - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } else { $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } } else { - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $sign * $object->lines[$i]->total_tva; @@ -966,7 +966,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($tab3_posx, $tab3_top + $y); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0); $pdf->SetXY($tab3_posx + 21, $tab3_top + $y); - $pdf->MultiCell(20, 3, price((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0); + $pdf->MultiCell(20, 3, price((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0); $pdf->SetXY($tab3_posx + 40, $tab3_top + $y); $pdf->MultiCell(20, 3, $text, 0, 'L', 0); $pdf->SetXY($tab3_posx + 58, $tab3_top + $y); @@ -1016,7 +1016,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($tab3_posx, $tab3_top + $y); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date), 'day', false, $outputlangs, true), 0, 'L', 0); $pdf->SetXY($tab3_posx + 21, $tab3_top + $y); - $pdf->MultiCell(20, 3, price($sign * ((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount), 0, $outputlangs), 0, 'L', 0); + $pdf->MultiCell(20, 3, price($sign * ((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount), 0, $outputlangs), 0, 'L', 0); $pdf->SetXY($tab3_posx + 40, $tab3_top + $y); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$row->code); @@ -1323,14 +1323,14 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) ? "TotalHT" : "Total").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities(empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) ? "TotalHT" : "Total") : ''), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $this->atleastoneratenotnull = 0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { @@ -1545,8 +1545,8 @@ class pdf_crabe extends ModelePDFFactures } $pdf->SetTextColor(0, 0, 0); - $creditnoteamount = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received - $depositsamount = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $creditnoteamount = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received + $depositsamount = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); //print "x".$creditnoteamount."-".$depositsamount;exit; $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); if (!empty($object->paye)) { diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index a537e35223f..cb1c2fb64e0 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -331,9 +331,9 @@ class pdf_sponge extends ModelePDFFactures if ($conf->facture->multidir_output[$conf->entity]) { $object->fetch_thirdparty(); - $deja_regle = $object->getSommePaiement((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_credit_notes_included = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_deposits_included = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $deja_regle = $object->getSommePaiement((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_credit_notes_included = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_deposits_included = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); // Definition of $dir and $file if ($object->specimen) { @@ -871,13 +871,13 @@ class pdf_sponge extends ModelePDFFactures // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $prev_progress = $object->lines[$i]->get_prev_progress($object->id); if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) { // Compute progress from previous situation - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } else { $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } } else { - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $sign * $object->lines[$i]->total_tva; @@ -1128,7 +1128,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($tab3_posx, $tab3_top + $y); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($obj->datef), 'day', false, $outputlangs, true), 0, 'L', 0); $pdf->SetXY($tab3_posx + 21, $tab3_top + $y); - $pdf->MultiCell(20, 3, price((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0); + $pdf->MultiCell(20, 3, price((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $obj->multicurrency_amount_ttc : $obj->amount_ttc, 0, $outputlangs), 0, 'L', 0); $pdf->SetXY($tab3_posx + 40, $tab3_top + $y); $pdf->MultiCell(20, 3, $text, 0, 'L', 0); $pdf->SetXY($tab3_posx + 58, $tab3_top + $y); @@ -1164,7 +1164,7 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($tab3_posx, $tab3_top + $y); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date), 'day', false, $outputlangs, true), 0, 'L', 0); $pdf->SetXY($tab3_posx + 21, $tab3_top + $y); - $pdf->MultiCell(20, 3, price($sign * ((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount), 0, $outputlangs), 0, 'L', 0); + $pdf->MultiCell(20, 3, price($sign * ((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount), 0, $outputlangs), 0, 'L', 0); $pdf->SetXY($tab3_posx + 40, $tab3_top + $y); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$row->code); @@ -1557,7 +1557,7 @@ class pdf_sponge extends ModelePDFFactures // Get Total HT - $total_ht = (!empty($conf->multicurrency->enabled) && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = (isModEnabled("multicurrency") && $object->mylticurrency_tx != 1 ? $object->multicurrency_total_ht : $object->total_ht); // Total remise $total_line_remise = 0; @@ -1595,14 +1595,14 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities(empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) ? "TotalHT" : "Total").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities(empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) ? "TotalHT" : "Total") : ''), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $this->atleastoneratenotnull = 0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { @@ -1847,8 +1847,8 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetTextColor(0, 0, 0); - $creditnoteamount = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received - $depositsamount = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $creditnoteamount = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received + $depositsamount = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); if (!empty($object->paye)) { diff --git a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php index ba41c94ab4f..ed10b5ee2bf 100644 --- a/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php +++ b/htdocs/core/modules/mrp/doc/pdf_vinci.modules.php @@ -819,7 +819,7 @@ class pdf_vinci extends ModelePDFMo $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, 'R', 1); @@ -943,7 +943,7 @@ class pdf_vinci extends ModelePDFMo $pdf->SetFillColor(224, 224, 224); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->SetFont('', '', $default_font_size - 1); diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 3f75a87fc73..e4bcc0e4f04 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -421,7 +421,7 @@ class pdf_standard extends ModelePDFProduct $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) $tvaligne=$object->lines[$i]->multicurrency_total_tva; else $tvaligne=$object->lines[$i]->total_tva; $localtax1ligne=$object->lines[$i]->total_localtax1; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 3d209fce798..86d6306a576 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -640,7 +640,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $object->lines[$i]->total_tva; @@ -1113,14 +1113,14 @@ class pdf_azur extends ModelePDFPropales $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $this->atleastoneratenotnull = 0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 224e3979f38..ec04a8e8906 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -764,7 +764,7 @@ class pdf_cyan extends ModelePDFPropales // Collection of totals by value of vat in $this->tva["rate"] = total_tva - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $object->lines[$i]->total_tva; @@ -1238,14 +1238,14 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $this->atleastoneratenotnull = 0; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { From c3cb372f4c5645d0d6b78a3755ad95cdf80a8c45 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:22:57 +0200 Subject: [PATCH 194/453] Update code --- .../doc/pdf_eagle_proforma.modules.php | 4 ++-- .../doc/pdf_canelle.modules.php | 18 +++++++++--------- .../supplier_order/doc/pdf_cornas.modules.php | 6 +++--- .../doc/pdf_muscadet.modules.php | 6 +++--- .../doc/pdf_aurore.modules.php | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 9a6ee3c5f01..fa49b0b6d44 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -682,7 +682,7 @@ class pdf_eagle_proforma extends ModelePDFCommandes // Collection of totals by value of vat in $this->tva["rate"] = total_tva - if ($conf->multicurrency->enabled && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) $tvaligne = $object->lines[$i]->multicurrency_total_tva; else $tvaligne = $object->lines[$i]->total_tva; $localtax1ligne = $object->lines[$i]->total_localtax1; @@ -1035,7 +1035,7 @@ class pdf_eagle_proforma extends ModelePDFCommandes /*$pdf->SetFillColor(255, 255, 255); $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHT") : ''), 0, 'L', 1); - $total_ht = (($conf->multicurrency->enabled && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0), 0, $outputlangs), 0, 'R', 1);*/ diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 5cbdad90b03..39a9aab7e78 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -232,9 +232,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $nblines = count($object->lines); if ($conf->fournisseur->facture->dir_output) { - $deja_regle = $object->getSommePaiement((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_credit_notes_included = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); - $amount_deposits_included = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $deja_regle = $object->getSommePaiement((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_credit_notes_included = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); + $amount_deposits_included = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); // Definition of $dir and $file if ($object->specimen) { @@ -499,7 +499,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $total_excl_tax, 0, 'R', 0); // Collection of totals by VAT value in $this->tva["taux"]=total_tva - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $object->lines[$i]->total_tva; @@ -683,14 +683,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($sign * ($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, $outputlangs), 0, 'R', 1); // Show VAT by rates and total $pdf->SetFillColor(248, 248, 248); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $this->atleastoneratenotnull = 0; foreach ($this->tva as $tvakey => $tvaval) { @@ -802,8 +802,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell($largcol2, $tab2_hl, price($sign * $total_ttc, 0, $outputlangs), $useborder, 'R', 1); $pdf->SetTextColor(0, 0, 0); - $creditnoteamount = $object->getSumCreditNotesUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received - $depositsamount = $object->getSumDepositsUsed((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? 1 : 0); + $creditnoteamount = $object->getSumCreditNotesUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received + $depositsamount = $object->getSumDepositsUsed((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? 1 : 0); //print "x".$creditnoteamount."-".$depositsamount;exit; $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); if (!empty($object->paye)) { @@ -1036,7 +1036,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetXY($tab3_posx, $tab3_top + $y); $pdf->MultiCell(20, 3, dol_print_date($this->db->jdate($row->date), 'day', false, $outputlangs, true), 0, 'L', 0); $pdf->SetXY($tab3_posx + 21, $tab3_top + $y); - $pdf->MultiCell(20, 3, price($sign * ((!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount)), 0, 'L', 0); + $pdf->MultiCell(20, 3, price($sign * ((isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $row->multicurrency_amount : $row->amount)), 0, 'L', 0); $pdf->SetXY($tab3_posx + 40, $tab3_top + $y); $oper = $outputlangs->transnoentitiesnoconv("PaymentTypeShort".$row->code); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index a8f671fb528..00d1e2e28e7 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -693,7 +693,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $object->lines[$i]->total_tva; @@ -975,7 +975,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, 'R', 1); @@ -1099,7 +1099,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetFillColor(224, 224, 224); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->SetFont('', '', $default_font_size - 1); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 12b5b990648..410a631fa62 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -573,7 +573,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $object->lines[$i]->total_tva; @@ -856,7 +856,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetXY($col1x, $tab2_top + 0); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $total_ht = ((!empty($conf->multicurrency->enabled) && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); + $total_ht = ((isModEnabled("multicurrency") && isset($object->multicurrency_tx) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ht : $object->total_ht); $pdf->SetXY($col2x, $tab2_top + 0); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ht + (!empty($object->remise) ? $object->remise : 0)), 0, 'R', 1); @@ -980,7 +980,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFillColor(224, 224, 224); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), $useborder, 'L', 1); - $total_ttc = (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; + $total_ttc = (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) ? $object->multicurrency_total_ttc : $object->total_ttc; $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($total_ttc), $useborder, 'R', 1); $pdf->SetFont('', '', $default_font_size - 1); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index f5825957845..28c8ed0a3bd 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -573,7 +573,7 @@ class pdf_aurore extends ModelePDFSupplierProposal */ // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $object->lines[$i]->total_tva; From 79fc182201b3523e8aaf6118f2c1f2f71feba78a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:24:17 +0200 Subject: [PATCH 195/453] Update code --- htdocs/core/tpl/objectline_create.tpl.php | 6 +++--- htdocs/core/tpl/objectline_edit.tpl.php | 4 ++-- htdocs/core/tpl/objectline_title.tpl.php | 4 ++-- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- htdocs/core/tpl/originproductline.tpl.php | 2 +- htdocs/expedition/shipment.php | 2 +- htdocs/fichinter/card.php | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 54e64ccc769..81a1692c6a3 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -65,7 +65,7 @@ if (empty($inputalsopricewithtax)) { } // Define colspan for the button 'Add' $colspan = 3; // Columns: total ht + col edit + col delete -if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { +if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { $colspan++; //Add column for Total (currency) if required } if (in_array($object->element, array('propal', 'commande', 'order', 'facture', 'facturerec', 'invoice', 'supplier_proposal', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) { @@ -119,7 +119,7 @@ if ($nolinesbefore) { ?> - multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> + multicurrency_code != $conf->currency) { ?> @@ -399,7 +399,7 @@ if ($nolinesbefore) { multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { $coldisplay++; ?> '; - if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { $coldisplay++; print ''; } diff --git a/htdocs/core/tpl/objectline_title.tpl.php b/htdocs/core/tpl/objectline_title.tpl.php index 79d4ebeae11..9646d8ce88f 100644 --- a/htdocs/core/tpl/objectline_title.tpl.php +++ b/htdocs/core/tpl/objectline_title.tpl.php @@ -88,7 +88,7 @@ print ''; print ''; // Multicurrency -if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { +if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { print ''; } @@ -152,7 +152,7 @@ if ($usemargins && !empty($conf->margin->enabled) && empty($user->socid)) { print ''; // Multicurrency -if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { +if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { print ''; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index b660bd89d93..fc1e74f1ac4 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -282,7 +282,7 @@ print vatrate($positiverates.($line->vat_src_code ? ' ('.$line->vat_src_code.')' -multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { ?> +multicurrency_code != $conf->currency) { ?> special_code == 3) { ?> print ''; } print ''; - if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { + if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { print ''; $coldisplay++; } diff --git a/htdocs/core/tpl/originproductline.tpl.php b/htdocs/core/tpl/originproductline.tpl.php index 25c799ffbfd..090ba834ba1 100644 --- a/htdocs/core/tpl/originproductline.tpl.php +++ b/htdocs/core/tpl/originproductline.tpl.php @@ -32,7 +32,7 @@ print ''; print ''; print ''; print ''; -if (!empty($conf->multicurrency->enabled)) { +if (isModEnabled("multicurrency")) { print ''; } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 0be623ab6bf..aef309b90b5 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -558,7 +558,7 @@ if ($id > 0 || !empty($ref)) { print '
'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; $addadmin = ''; if (property_exists($object, 'admin')) { - if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) { + if (isModEnabled('multicompany') && !empty($object->admin) && empty($object->entity)) { $addadmin .= img_picto($langs->trans("SuperAdministratorDesc"), "redstar", 'class="paddingleft"'); } elseif (!empty($object->admin)) { $addadmin .= img_picto($langs->trans("AdministratorDesc"), "star", 'class="paddingleft"'); From 7997776cbbb46105f4e6b54fb5954cb814630069 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:12:52 +0200 Subject: [PATCH 188/453] Update code --- htdocs/commande/class/commande.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ca7d462a432..683074490a8 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -348,12 +348,12 @@ class Commande extends CommonOrder 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225), 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>230), 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>235), - 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>240), - 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>245), - 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>250, 'isameasure'=>1), - 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>255, 'isameasure'=>1), - 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>260, 'isameasure'=>1), - 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>265, 'isameasure'=>1), + 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>240), + 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'MulticurrencyCurrency', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>245), + 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyRate', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>250, 'isameasure'=>1), + 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>255, 'isameasure'=>1), + 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>260, 'isameasure'=>1), + 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>265, 'isameasure'=>1), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>270), 'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>275), 'pos_source' =>array('type'=>'varchar(32)', 'label'=>'POSTerminal', 'enabled'=>1, 'visible'=>-1, 'position'=>280), From 5a98b72faff4e08384ccdc3860713313e62a6db1 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:14:05 +0200 Subject: [PATCH 189/453] Update code --- htdocs/compta/facture/class/facture.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 594ee548da7..c6281e77e67 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -348,12 +348,12 @@ class Facture extends CommonInvoice 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>260), 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLabel', 'enabled'=>'$conf->incoterm->enabled', 'visible'=>-1, 'position'=>265), 'date_pointoftax' =>array('type'=>'date', 'label'=>'DatePointOfTax', 'enabled'=>'$conf->global->INVOICE_POINTOFTAX_DATE', 'visible'=>-1, 'position'=>270), - 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>275), - 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>280), - 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>285, 'isameasure'=>1), - 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>290, 'isameasure'=>1), - 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>291, 'isameasure'=>1), - 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'$conf->multicurrency->enabled', 'visible'=>-1, 'position'=>292, 'isameasure'=>1), + 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'MulticurrencyID', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>275), + 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>280), + 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>285, 'isameasure'=>1), + 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>290, 'isameasure'=>1), + 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>291, 'isameasure'=>1), + 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>292, 'isameasure'=>1), 'fk_fac_rec_source' =>array('type'=>'integer', 'label'=>'RecurringInvoiceSource', 'enabled'=>1, 'visible'=>-1, 'position'=>305), 'last_main_doc' =>array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>-1, 'position'=>310), 'module_source' =>array('type'=>'varchar(32)', 'label'=>'POSModule', 'enabled'=>1, 'visible'=>-1, 'position'=>315), From d96c60ec8b0f86227d2e7326ef30a3864422724c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:16:00 +0200 Subject: [PATCH 190/453] Update code --- htdocs/contrat/card.php | 6 +++--- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/class/dolreceiptprinter.class.php | 2 +- htdocs/core/lib/pdf.lib.php | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 564122f3137..30b884d288c 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1514,7 +1514,7 @@ if ($action == 'create') { print ''.$langs->trans("ServiceNb", $cursorline).''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("PriceUHTCurrency").''.$langs->trans("Qty").''.($objp->subprice != '' ? price($objp->subprice) : '')."'.price($objp->multicurrency_subprice).''.price($objp->multicurrency_subprice).''.$langs->trans('Description').''.$langs->trans('VATRate').''.$langs->trans('PriceUHT').''.$langs->trans('PriceUHTCurrency').''.$langs->trans('Qty').'trans('VAT'); ?> trans('PriceUHT'); ?>trans('PriceUHTCurrency'); ?> diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index b2974ffbbfc..d755c3996a8 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -70,7 +70,7 @@ if (!empty($inputalsopricewithtax)) { if (in_array($object->element, array('propal', 'supplier_proposal', 'facture', 'facturerec', 'invoice', 'commande', 'order', 'order_supplier', 'invoice_supplier', 'invoice_supplier_rec'))) { $colspan++; // With this, there is a column move button } -if (!empty($conf->multicurrency->enabled) && $this->multicurrency_code != $conf->currency) { +if (isModEnabled("multicurrency") && $this->multicurrency_code != $conf->currency) { $colspan += 2; } if (isModEnabled('asset') && $object->element == 'invoice_supplier') { @@ -214,7 +214,7 @@ $coldisplay++; } print '>'.$langs->trans('PriceUHT').''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''.$langs->trans('TotalHTShort').''.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'subprice); ?>multicurrency_subprice); ?> '.price($sign * $line->multicurrency_total_ht).''.$this->tpl['label'].''.$this->tpl['description'].''.$this->tpl['vat_rate'].''.$this->tpl['price'].''.$this->tpl['multicurrency_price'].'
'; - if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { + if (isModEnabled("multicurrency") && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''; print ''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 1c83726f7e6..97d3bfaaf7d 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -998,7 +998,7 @@ if ($action == 'create') { print '"; - if (!empty($conf->multicurrency->enabled)) + if (isModEnabled("multicurrency")) { print ''; print '"; From 3737a854705add1df874f828acc6e61599160be4 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:25:51 +0200 Subject: [PATCH 196/453] Update code --- htdocs/fourn/class/fournisseur.commande.class.php | 14 +++++++------- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/fourn/class/fournisseur.product.class.php | 2 +- htdocs/fourn/class/paiementfourn.class.php | 2 +- htdocs/fourn/commande/card.php | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 8a1dcf682b2..30d95361ca1 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -191,7 +191,7 @@ class CommandeFournisseur extends CommonOrder * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) @@ -247,11 +247,11 @@ class CommandeFournisseur extends CommonOrder 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>3, 'position'=>205), 'location_incoterms' =>array('type'=>'varchar(255)', 'label'=>'IncotermLocation', 'enabled'=>1, 'visible'=>3, 'position'=>210), 'fk_multicurrency' =>array('type'=>'integer', 'label'=>'Fk multicurrency', 'enabled'=>1, 'visible'=>0, 'position'=>215), - 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>220), - 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>225), - 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>230), - 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>235), - 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'!empty($conf->multicurrency->enabled)', 'visible'=>-1, 'position'=>240), + 'multicurrency_code' =>array('type'=>'varchar(255)', 'label'=>'Currency', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>220), + 'multicurrency_tx' =>array('type'=>'double(24,8)', 'label'=>'CurrencyRate', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>225), + 'multicurrency_total_ht' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountHT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>230), + 'multicurrency_total_tva' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountVAT', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>235), + 'multicurrency_total_ttc' =>array('type'=>'double(24,8)', 'label'=>'MulticurrencyAmountTTC', 'enabled'=>'isModEnabled("multicurrency")', 'visible'=>-1, 'position'=>240), 'date_creation' =>array('type'=>'datetime', 'label'=>'Date creation', 'enabled'=>1, 'visible'=>-1, 'position'=>500), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'visible'=>1, 'notnull'=>1, 'position'=>46), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>1000, 'index'=>1), @@ -1888,7 +1888,7 @@ class CommandeFournisseur extends CommonOrder } } - if (!empty($conf->multicurrency->enabled) && $pu_ht_devise > 0) { + if (isModEnabled("multicurrency") && $pu_ht_devise > 0) { $pu = 0; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 2103b97d2e1..e3c3ce8ef36 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2125,7 +2125,7 @@ class FactureFournisseur extends CommonInvoice $product_type = $type; } - if (!empty($conf->multicurrency->enabled) && $pu_devise > 0) { + if (isModEnabled("multicurrency") && $pu_devise > 0) { $pu = 0; } diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 25b26c75852..276c5b20ed9 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -296,7 +296,7 @@ class ProductFournisseur extends Product // Multicurrency $multicurrency_unitBuyPrice = null; $fk_multicurrency = null; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { if (empty($multicurrency_tx)) { $multicurrency_tx = 1; } diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 386c34483de..e0b3fcac0c6 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -862,7 +862,7 @@ class PaiementFourn extends Paiement global $conf; $way = 'dolibarr'; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { foreach ($this->multicurrency_amounts as $value) { if (!empty($value)) { // one value found then payment is in invoice currency $way = 'customer'; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 660d555676f..f6263fe1304 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1616,7 +1616,7 @@ if ($action == 'create') { $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '')); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { if (!empty($objectsrc->multicurrency_code)) { $currency_code = $objectsrc->multicurrency_code; } @@ -1634,7 +1634,7 @@ if ($action == 'create') { $cond_reglement_id = !empty($societe->cond_reglement_supplier_id) ? $societe->cond_reglement_supplier_id : 0; $mode_reglement_id = !empty($societe->mode_reglement_supplier_id) ? $societe->mode_reglement_supplier_id : 0; - if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) { + if (isModEnabled("multicurrency") && !empty($societe->multicurrency_code)) { $currency_code = $societe->multicurrency_code; } @@ -1772,7 +1772,7 @@ if ($action == 'create') { } // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print ''; print '"; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print ''; print ''; @@ -2165,7 +2165,7 @@ if ($action == 'create') { print ''; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { // Multicurrency code print ''; print ''; if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { - if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) { + if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) { print ''; print ''; print ''; @@ -991,7 +991,7 @@ if ($id > 0 || !empty($ref)) { print ''; if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { - if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) { + if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) { // Price print ''; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { // Multicurrency code print ''; print ''; print ''; print '"; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print '"; print '"; @@ -2613,7 +2613,7 @@ if ($action == 'create') { $resteapayer = price2num($object->total_ttc - $totalpaid - $totalcreditnotes - $totaldeposits, 'MT'); // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $multicurrency_totalpaid = $object->getSommePaiement(1); $multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1); $multicurrency_totaldeposits = $object->getSumDepositsUsed(1); @@ -3046,7 +3046,7 @@ if ($action == 'create') { print ''; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { // Multicurrency code print ''; print '
'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'
' . $langs->trans('AmountTTC') . '' . price($objectsrc->total_ttc) . "
' . $langs->trans('MulticurrencyAmountHT') . '' . price($objectsrc->multicurrency_total_ht) . '
' . $langs->trans('MulticurrencyAmountVAT') . '' . price($objectsrc->multicurrency_total_tva) . "
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; @@ -1819,7 +1819,7 @@ if ($action == 'create') { print '
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva).'
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc).'
'; From 62529b10e4949e410215c79caa3a5805f1457f1a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:28:48 +0200 Subject: [PATCH 197/453] Update code --- htdocs/fourn/commande/dispatch.php | 12 ++++++------ htdocs/fourn/facture/card-rec.php | 2 +- htdocs/fourn/facture/card.php | 18 +++++++++--------- htdocs/fourn/facture/list.php | 14 +++++++------- htdocs/fourn/facture/paiement.php | 8 ++++---- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index c7baf022d8e..d5f9a9e8e73 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -243,7 +243,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { $fk_commandefourndet = "fk_commandefourndet_".$reg[1].'_'.$reg[2]; if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { - if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) { + if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) { $dto = GETPOST("dto_".$reg[1].'_'.$reg[2], 'int'); if (!empty($dto)) { $unit_price = price2num(GETPOST("pu_".$reg[1]) * (100 - $dto) / 100, 'MU'); @@ -269,7 +269,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { } if (!$error && !empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { - if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) { + if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) { $dto = price2num(GETPOST("dto_".$reg[1].'_'.$reg[2], 'int'), ''); if (empty($dto)) { $dto = 0; @@ -311,7 +311,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { $fk_commandefourndet = 'fk_commandefourndet_'.$reg[1].'_'.$reg[2]; if (!empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { - if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) { + if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) { $dto = GETPOST("dto_".$reg[1].'_'.$reg[2], 'int'); if (!empty($dto)) { $unit_price = price2num(GETPOST("pu_".$reg[1]) * (100 - $dto) / 100, 'MU'); @@ -344,7 +344,7 @@ if ($action == 'dispatch' && $permissiontoreceive) { } if (!$error && !empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) { - if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) { + if (!isModEnabled("multicurrency") && empty($conf->dynamicprices->enabled)) { $dto = GETPOST("dto_".$reg[1].'_'.$reg[2], 'int'); //update supplier price if (GETPOSTISSET($saveprice)) { @@ -742,7 +742,7 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("Price").''.$langs->trans("ReductionShort").' (%)'.$langs->trans("UpdatePrice").''; print ''; diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php index 8f8d9ec9e47..be1693b7381 100644 --- a/htdocs/fourn/facture/card-rec.php +++ b/htdocs/fourn/facture/card-rec.php @@ -1243,7 +1243,7 @@ if ($action == 'create') { print '
'; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index f0640681e7f..11b7332f587 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1915,7 +1915,7 @@ if ($action == 'create') { if (GETPOST('socid', 'int') > 0) { $societe = new Societe($db); $societe->fetch(GETPOST('socid', 'int')); - if (!empty($conf->multicurrency->enabled) && !empty($societe->multicurrency_code)) { + if (isModEnabled("multicurrency") && !empty($societe->multicurrency_code)) { $currency_code = $societe->multicurrency_code; } } @@ -1964,7 +1964,7 @@ if ($action == 'create') { $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : ''; $transport_mode_id = (!empty($objectsrc->transport_mode_id) ? $objectsrc->transport_mode_id : (!empty($soc->transport_mode_id) ? $soc->transport_mode_id : 0)); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { if (!empty($objectsrc->multicurrency_code)) { $currency_code = $objectsrc->multicurrency_code; } @@ -1991,7 +1991,7 @@ if ($action == 'create') { $datetmp = dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int')); $datedue = ($datetmp == '' ?-1 : $datetmp); - if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) { + if (isModEnabled("multicurrency") && !empty($soc->multicurrency_code)) { $currency_code = $soc->multicurrency_code; } } @@ -2428,7 +2428,7 @@ if ($action == 'create') { } // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; @@ -2537,7 +2537,7 @@ if ($action == 'create') { } print '
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
'; @@ -3169,7 +3169,7 @@ if ($action == 'create') { print ''; - if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { + if (isModEnabled("multicurrency") && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''; print ''; @@ -3256,7 +3256,7 @@ if ($action == 'create') { if (!empty($conf->incoterm->enabled)) { $nbrows++; } - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $nbrows += 5; } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 0072349c06b..305c50b29d5 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -195,13 +195,13 @@ $arrayfields = array( 'u.login'=>array('label'=>"Author", 'checked'=>1), 'dynamount_payed'=>array('label'=>"Paid", 'checked'=>0), 'rtp'=>array('label'=>"Rest", 'checked'=>0), - 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), // Not enabled by default because slow + 'f.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'f.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'f.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'f.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'f.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'multicurrency_dynamount_payed'=>array('label'=>'MulticurrencyAlreadyPaid', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'multicurrency_rtp'=>array('label'=>'MulticurrencyRemainderToPay', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), // Not enabled by default because slow 'f.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), 'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 09507929daf..d9b755fdf4e 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -575,7 +575,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print ''; print ''; @@ -612,7 +612,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); // Multicurrency Price - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $multicurrency_payment = $invoice->getSommePaiement(1); $multicurrency_creditnotes = $invoice->getSumCreditNotesUsed(1); $multicurrency_deposits = $invoice->getSumDepositsUsed(1); @@ -653,7 +653,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { // Currency print '\n"; @@ -767,7 +767,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie // Print total print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print ''; print ''; From 371f5ee581d3413325c385932ac96f9f0c78f057 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:30:24 +0200 Subject: [PATCH 198/453] Update code --- htdocs/modulebuilder/index.php | 2 +- .../template/class/myobject.class.php | 2 +- .../mymodule/doc/pdf_standard_myobject.modules.php | 4 ++-- htdocs/multicurrency/multicurrency_rate.php | 2 +- htdocs/product/fournisseurs.php | 14 +++++++------- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 0762d95d154..81da2909779 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -907,7 +907,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 1d6b6650d27..8265bbadaf8 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -84,7 +84,7 @@ class MyObject extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index 561c09f88d6..3990d49fa6d 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -634,13 +634,13 @@ class pdf_standard_myobject extends ModelePDFMyObject // Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva $prev_progress = $object->lines[$i]->get_prev_progress($object->id); if ($prev_progress > 0 && !empty($object->lines[$i]->situation_percent)) { // Compute progress from previous situation - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } else { $tvaligne = $sign * $object->lines[$i]->total_tva * ($object->lines[$i]->situation_percent - $prev_progress) / $object->lines[$i]->situation_percent; } } else { - if (!empty($conf->multicurrency->enabled) && $object->multicurrency_tx != 1) { + if (isModEnabled("multicurrency") && $object->multicurrency_tx != 1) { $tvaligne = $sign * $object->lines[$i]->multicurrency_total_tva; } else { $tvaligne = $sign * $object->lines[$i]->total_tva; diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 06fe91c120d..3f20476f72a 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -102,7 +102,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); // Access control // TODO Open this page to a given permission so a sale representative can modify change rates. Permission should be added into module multicurrency. // One permission to read rates (history) and one to add/edit rates. -if (!$user->admin || empty($conf->multicurrency->enabled)) { +if (!$user->admin || !isModEnabled("multicurrency")) { accessforbidden(); } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 164dac7d185..03e7881dffb 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -243,7 +243,7 @@ if (empty($reshook)) { $_POST["price"] = 0; } } - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { if (!GETPOST("multicurrency_code")) { $error++; $langs->load("errors"); @@ -299,7 +299,7 @@ if (empty($reshook)) { }*/ $object->packaging = $packaging; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $multicurrency_tx = price2num(GETPOST("multicurrency_tx", 'alpha')); $multicurrency_price = price2num(GETPOST("multicurrency_price", 'alpha')); $multicurrency_code = GETPOST("multicurrency_code", 'alpha'); @@ -630,7 +630,7 @@ if ($id > 0 || $ref) { '; } - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { // Currency print ''; print ''; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { // Price for the quantity in currency print ''; From 8108a60aacf7a388b60449e3d98416e4867d770a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 3 Sep 2022 11:32:24 +0200 Subject: [PATCH 199/453] Update code --- htdocs/societe/card.php | 18 +++++++++--------- htdocs/supplier_proposal/card.php | 14 +++++++------- .../class/supplier_proposal.class.php | 10 +++++----- htdocs/supplier_proposal/list.php | 10 +++++----- htdocs/webhook/class/target.class.php | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index f8beacdbb2e..c6ee771472f 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -540,7 +540,7 @@ if (empty($reshook)) { } // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); } @@ -1174,7 +1174,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $object->forme_juridique_code = GETPOST('forme_juridique_code'); // We set multicurrency_code if enabled - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $object->multicurrency_code = GETPOST('multicurrency_code') ? GETPOST('multicurrency_code') : $conf->currency; } /* Show create form */ @@ -1740,7 +1740,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Capital print ''; print ''; } else { print ''.$langs->trans("Currency".$conf->currency).''; @@ -1788,7 +1788,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print ''; print ''; print ''; } else { print '"> '.$langs->trans("Currency".$conf->currency).''; @@ -2494,7 +2494,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print ''; print ''; print ''; print ''; print ''; print '"; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print '"; print '"; @@ -1685,7 +1685,7 @@ if ($action == 'create') { print ''; // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { // Multicurrency code print ''; print ''; // ID - print ''; + print ''; // Date print ''; @@ -535,11 +535,11 @@ if (is_array($blocks)) { // User print ''; // Action - print ''; + print ''; // Ref print ''; // Unsubscribe - if (!empty($conf->mailing->enabled)) { + if (isModEnabled('mailing')) { if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) { print "\n".''; - print ' - '.$langs->trans("ShowHideDetails").''; + if (count($arraysql)) { + print ' - '.$langs->trans("ShowHideDetails").''; + } else { + print ' - '.$langs->trans("ScriptIsEmpty").''; + } //} print ''."\n"; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 2732e41dc14..41082fa79cd 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -64,6 +64,7 @@ $search_status = (GETPOSTISSET('search_status') ?GETPOST('search_status', 'int') $search_label = GETPOST("search_label", 'alpha'); $search_module_name = GETPOST("search_module_name", 'alpha'); $search_lastresult = GETPOST("search_lastresult", "alphawithlgt"); +$search_processing = GETPOST("search_processing", "int"); $securitykey = GETPOST('securitykey', 'alpha'); $outputdir = $conf->cron->dir_output; @@ -277,6 +278,9 @@ if ($search_status >= 0 && $search_status < 2 && $search_status != '') { if ($search_lastresult != '') { $sql .= natural_search("t.lastresult", $search_lastresult, 1); } +if (GETPOSTISSET('search_processing')) { + $sql .= " AND t.processing = ".((int) $search_processing); +} //Manage filter if (is_array($filter) && count($filter) > 0) { foreach ($filter as $key => $value) { diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cc3e1252b31..cbec6cfc5ea 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2307,4 +2307,6 @@ MAIN_MAIL_SMTPS_AUTH_TYPE=Authentification method UsePassword=Use a password UseOauth=Use a OAUTH token Images=Images -MaxNumberOfImagesInGetPost=Max number of images allowed in a HTML field submitted in a form \ No newline at end of file +MaxNumberOfImagesInGetPost=Max number of images allowed in a HTML field submitted in a form +ScriptIsEmpty=The script is empty +ShowHideTheNRequests=Show/hide the %s SQL request(s) \ No newline at end of file diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index d5f784248be..d9bdd2691eb 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -93,3 +93,4 @@ JobXMustBeEnabled=Job %s must be enabled LastExecutedScheduledJob=Last executed scheduled job NextScheduledJobExecute=Next scheduled job to execute NumberScheduledJobError=Number of scheduled jobs in error +NumberScheduledJobNeverFinished=Number of scheduled jobs never finished diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 51599816c37..dcff3c4b7a1 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -821,6 +821,9 @@ textarea.centpercent { .nounderline { text-decoration: none; } +.nounderlineimp { + text-decoration: none !important; +} .nopadding { padding: 0; } @@ -1532,6 +1535,7 @@ table[summary="list_of_modules"] .fa-cog { .clearboth { clear:both; } .hideobject { display: none; } +.minwidth25 { min-width: 25px; } .minwidth50 { min-width: 50px; } .minwidth75 { min-width: 75px; } /* rule for not too small screen only */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index db65e797f95..1eb0fa7d71f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -973,6 +973,9 @@ textarea.centpercent { .nounderline { text-decoration: none; } +.nounderlineimp { + text-decoration: none !important; +} .nopadding { padding: 0; } @@ -1623,6 +1626,7 @@ tr.nobottom td { .clearboth { clear:both; } .hideobject { display: none; } +.minwidth25 { min-width: 25px; } .minwidth50 { min-width: 50px; } .minwidth75 { min-width: 75px; } /* rule for not too small screen only */ From aff9a423abfef3c223ba236417ba155fababb031 Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Mon, 5 Sep 2022 12:28:59 +0200 Subject: [PATCH 233/453] FIX : fk_expedition in $line can be usefull for triggers --- htdocs/expedition/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e8bfb0249b1..42214d1165e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -581,6 +581,7 @@ if (empty($reshook)) { for ($i = 0; $i < $num_prod; $i++) { if ($lines[$i]->id == $line_id) { // we have found line to update $line = new ExpeditionLigne($db); + $line->fk_expedition = $object->id; // Extrafields Lines $line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line); From 7344b1946a35a35e7b0eb3700f0ef976a07ccad0 Mon Sep 17 00:00:00 2001 From: Radarjr2002 <112626442+Radarjr2002@users.noreply.github.com> Date: Mon, 5 Sep 2022 13:40:39 +0200 Subject: [PATCH 234/453] Update card_presend.tpl.php TODO Get also the main_lastdoc field of $object --- htdocs/core/tpl/card_presend.tpl.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 596feae69d1..18668e7fae2 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -43,14 +43,18 @@ if ($action == 'presend') { $ref = dol_sanitizeFileName($object->ref); if (!in_array($object->element, array('user', 'member'))) { - // TODO get also the main_lastdoc field of $object. If not found, try to guess with following code - - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - // Special case - if ($object->element == 'invoice_supplier') { - $fileparams = dol_most_recent_file($diroutput.'/'.get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+'); - } else { - $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+'); + //$fileparams['fullname'] can be filled from the card + //Get also the main_lastdoc field of $object. If not found, try to guess with following code + if(!empty($object->last_main_doc) && is_readable(DOL_DATA_ROOT.'/'.$object->last_main_doc) && is_file ( DOL_DATA_ROOT.'/'.$object->last_main_doc )){ + $fileparams['fullname'] = DOL_DATA_ROOT.'/'.$object->last_main_doc; + } else { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + // Special case + if ($object->element == 'invoice_supplier') { + $fileparams = dol_most_recent_file($diroutput.'/'.get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+'); + } else { + $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+'); + } } $file = $fileparams['fullname']; From c2a7741607bed10d2e9995b5c287a535d2b71c20 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 5 Sep 2022 11:50:10 +0000 Subject: [PATCH 235/453] Fixing style errors. --- htdocs/core/tpl/card_presend.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 18668e7fae2..826a8e0a12a 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -45,9 +45,9 @@ if ($action == 'presend') { if (!in_array($object->element, array('user', 'member'))) { //$fileparams['fullname'] can be filled from the card //Get also the main_lastdoc field of $object. If not found, try to guess with following code - if(!empty($object->last_main_doc) && is_readable(DOL_DATA_ROOT.'/'.$object->last_main_doc) && is_file ( DOL_DATA_ROOT.'/'.$object->last_main_doc )){ - $fileparams['fullname'] = DOL_DATA_ROOT.'/'.$object->last_main_doc; - } else { + if (!empty($object->last_main_doc) && is_readable(DOL_DATA_ROOT.'/'.$object->last_main_doc) && is_file(DOL_DATA_ROOT.'/'.$object->last_main_doc)) { + $fileparams['fullname'] = DOL_DATA_ROOT.'/'.$object->last_main_doc; + } else { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // Special case if ($object->element == 'invoice_supplier') { From 3e1e37211b90d5b4645ddf919944b4b4b6f0f866 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Mon, 5 Sep 2022 15:48:40 +0200 Subject: [PATCH 236/453] Update mod_codeclient_elephant.php --- .../societe/mod_codeclient_elephant.php | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 6079120a305..4186905f9f6 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -161,31 +161,39 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode */ public function getExample($langs, $objsoc = 0, $type = -1) { + $error = 0; $examplecust = ''; $examplesup = ''; $errmsg = array( "ErrorBadMask", "ErrorCantUseRazIfNoYearInMask", "ErrorCantUseRazInStartedYearIfNoYearMonthInMask", + "ErrorCounterMustHaveMoreThan3Digits", + "ErrorBadMaskBadRazMonth", + "ErrorCantUseRazWithYearOnOneDigit", ); if ($type != 1) { $examplecust = $this->getNextValue($objsoc, 0); if (!$examplecust) { - $examplecust = $langs->trans('NotConfigured'); + $examplecust = '
'.$langs->trans('NotConfigured').'
'; + $error = 1; } if (in_array($examplecust, $errmsg)) { $langs->load("errors"); - $examplecust = $langs->trans($examplecust); + $examplecust = '
'.$langs->trans($examplecust).'
'; + $error = 1; } } if ($type != 0) { $examplesup = $this->getNextValue($objsoc, 1); if (!$examplesup) { - $examplesup = $langs->trans('NotConfigured'); + $examplesup = '
'.$langs->trans('NotConfigured').'
'; + $error = 1; } if (in_array($examplesup, $errmsg)) { $langs->load("errors"); - $examplesup = $langs->trans($examplesup); + $examplesup = '
'.$langs->trans($examplesup).'
'; + $error = 1; } } @@ -194,7 +202,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode } elseif ($type == 1) { return $examplesup; } else { - return $examplecust.'
'.$examplesup; + if ($error == 1) { + return $examplecust.' '.$examplesup; + }else{ + return $examplecust.'
'.$examplesup; + } } } From 46dab68dd0bf9d276defd33ecff5376b475625af Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 5 Sep 2022 13:56:41 +0000 Subject: [PATCH 237/453] Fixing style errors. --- htdocs/core/modules/societe/mod_codeclient_elephant.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 4186905f9f6..e779504edd6 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -170,7 +170,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode "ErrorCantUseRazInStartedYearIfNoYearMonthInMask", "ErrorCounterMustHaveMoreThan3Digits", "ErrorBadMaskBadRazMonth", - "ErrorCantUseRazWithYearOnOneDigit", + "ErrorCantUseRazWithYearOnOneDigit", ); if ($type != 1) { $examplecust = $this->getNextValue($objsoc, 0); @@ -204,7 +204,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode } else { if ($error == 1) { return $examplecust.' '.$examplesup; - }else{ + } else { return $examplecust.'
'.$examplesup; } } From 4262d666cab9708e1c45588ceebb3ac2074fcfd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Mon, 5 Sep 2022 16:15:13 +0200 Subject: [PATCH 238/453] PHP V8 warning and $objectidnext = $object->getIdReplacingInvoice(); not present --- htdocs/fourn/facture/card.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c2fc4e8511a..b928cc5bdf9 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2642,6 +2642,8 @@ if ($action == 'create') { /* * View card */ + $objectidnext = $object->getIdReplacingInvoice(); + $head = facturefourn_prepare_head($object); $titre = $langs->trans('SupplierInvoice'); @@ -2934,7 +2936,7 @@ if ($action == 'create') { } print ' ('.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits) . ')'; } - if (isset($facidnext) && $facidnext > 0) { + if (isset($objectidnext) && $objectidnext > 0) { $facthatreplace = new FactureFournisseur($db); $facthatreplace->fetch($facidnext); print ' ('.$langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)).')'; @@ -3266,7 +3268,7 @@ if ($action == 'create') { } $sql = 'SELECT p.datep as dp, p.ref, p.num_paiement as num_payment, p.rowid, p.fk_bank,'; - $sql .= ' c.id as paiement_type,'; + $sql .= ' c.id as paiement_type, c.code as payment_code,'; $sql .= ' pf.amount,'; $sql .= ' ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal'; $sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn as p'; @@ -3303,7 +3305,7 @@ if ($action == 'create') { $paymentstatic->datepaye = $db->jdate($objp->dp); $paymentstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid); $paymentstatic->num_payment = $objp->num_payment; - $paymentstatic->payment_code = $objp->payment_code; + $paymentstatic->paiementcode = $objp->payment_code; print '
'; print ''; // Label @@ -197,13 +199,13 @@ if ($object->id > 0) { // Amount Local Taxes //TODO: Place into a function to control showing by country or study better option - if ($societe->localtax1_assuj == "1") { //Localtax1 - print ''; + if ($mysoc->localtax1_assuj == "1") { //Localtax1 + print ''; print ''; print ''; } - if ($societe->localtax2_assuj == "1") { //Localtax2 - print ''; + if ($mysoc->localtax2_assuj == "1") { //Localtax2 + print ''; print ''; print ''; } From c6d03b694cdd986cd9b354f460fada1e1bc19fa3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Sep 2022 18:31:48 +0200 Subject: [PATCH 240/453] Fix css for ip exrafield type --- htdocs/core/class/extrafields.class.php | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 004a0cbe5e8..a3925c9160a 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1881,36 +1881,27 @@ class ExtraFields { global $conf, $langs; + $type = 'varchar'; if (!empty($extrafieldsobjectkey)) { $type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; - } else { - $type = $this->attribute_type[$key]; } $cssstring = ''; - if ($type == 'date') { + if (in_array($type, array('date', 'datetime'))) { $cssstring = "center"; - } elseif ($type == 'datetime') { - $cssstring = "center"; - } elseif ($type == 'int') { + } elseif (in_array($type, array('int', 'price', 'double'))) { $cssstring = "right"; - } elseif ($type == 'price') { - $cssstring = "right"; - } elseif ($type == 'double') { - $cssstring = "right"; - } elseif ($type == 'boolean') { + } elseif (in_array($type, array('boolean', 'radio', 'checkbox', 'ip'))) { $cssstring = "center"; - } elseif ($type == 'radio') { - $cssstring = "center"; - } elseif ($type == 'checkbox') { - $cssstring = "center"; - } elseif ($type == 'price') { - $cssstring = "right"; } if (!empty($this->attributes[$extrafieldsobjectkey]['csslist'][$key])) { $cssstring .= ($cssstring ? ' ' : '').$this->attributes[$extrafieldsobjectkey]['csslist'][$key]; + } else { + if (in_array($type, array('ip'))) { + $cssstring .= ($cssstring ? ' ' : '').'tdoverflowmax150'; + } } return $cssstring; From f61ef2948889c07d5b58d56331a5932f5db9ea85 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Tue, 6 Sep 2022 00:00:11 +0200 Subject: [PATCH 241/453] FIX #21416 - Filter tag no-categorie in members --- htdocs/adherents/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 441ce85ec86..607ef8117f6 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -336,7 +336,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d"; if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)"; } -if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) { +if ((!empty($search_categ) && ($search_categ > 0 || $search_categ == -2)) || !empty($catid)) { // We need this table joined to the select in order to filter by categ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member"; } From c28966864b7b5b74bf1f7c3a7121f6c659317d20 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Sep 2022 01:42:48 +0200 Subject: [PATCH 242/453] FIX data integrity for llx_delivery table --- htdocs/delivery/card.php | 7 ++++--- htdocs/expedition/card.php | 6 ++++++ htdocs/install/mysql/migration/repair.sql | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/delivery/card.php b/htdocs/delivery/card.php index 00975946f6b..8082c654a55 100644 --- a/htdocs/delivery/card.php +++ b/htdocs/delivery/card.php @@ -256,9 +256,10 @@ llxHeader('', $title, 'Livraison'); $form = new Form($db); $formfile = new FormFile($db); -if ($action == 'create') { // Create. Seems to no be used -} else // View -{ +if ($action == 'create') { + // Create. Seems to no be used +} else { + // View if ($object->id > 0) { // Origin of a 'livraison' (delivery receipt) is ALWAYS 'expedition' (shipment). // However, origin of shipment in future may differs (commande, proposal, ...) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index d16885faa0f..29336772269 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -405,11 +405,17 @@ if (empty($reshook)) { } } elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->delivery->creer) { // Build a receiving receipt + $db->begin(); + $result = $object->create_delivery($user); if ($result > 0) { + $db->commit(); + header("Location: ".DOL_URL_ROOT.'/delivery/card.php?action=create_delivery&id='.$result); exit; } else { + $db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'confirm_valid' && $confirm == 'yes' && diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 4add688b880..86b3da418a0 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -194,11 +194,13 @@ delete from llx_delivery where rowid not in (select fk_target from llx_elemen -- Fix delete element_element orphelins (right side) delete from llx_element_element where targettype='shipping' and fk_target not in (select rowid from llx_expedition); +delete from llx_element_element where targettype='delivery' and fk_target not in (select rowid from llx_delivery); delete from llx_element_element where targettype='propal' and fk_target not in (select rowid from llx_propal); delete from llx_element_element where targettype='facture' and fk_target not in (select rowid from llx_facture); delete from llx_element_element where targettype='commande' and fk_target not in (select rowid from llx_commande); -- Fix delete element_element orphelins (left side) delete from llx_element_element where sourcetype='shipping' and fk_source not in (select rowid from llx_expedition); +delete from llx_element_element where sourcetype='delivery' and fk_source not in (select rowid from llx_delivery); delete from llx_element_element where sourcetype='propal' and fk_source not in (select rowid from llx_propal); delete from llx_element_element where sourcetype='facture' and fk_source not in (select rowid from llx_facture); delete from llx_element_element where sourcetype='commande' and fk_source not in (select rowid from llx_commande); From c3afd7ab4f950aaafca33e00e7b9420a3935be71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Sep 2022 01:44:52 +0200 Subject: [PATCH 243/453] Menu position --- htdocs/core/modules/modCron.class.php | 2 +- htdocs/core/modules/modEmailCollector.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modCron.class.php b/htdocs/core/modules/modCron.class.php index 00d73dd7d14..3a84b28eef3 100644 --- a/htdocs/core/modules/modCron.class.php +++ b/htdocs/core/modules/modCron.class.php @@ -141,7 +141,7 @@ class modCron extends DolibarrModules 'titre'=>'CronList', 'url'=>'/cron/list.php?leftmenu=admintools', 'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>200, + 'position'=>500, 'enabled'=>'$conf->cron->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms'=>'$user->rights->cron->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', diff --git a/htdocs/core/modules/modEmailCollector.class.php b/htdocs/core/modules/modEmailCollector.class.php index 145dd966044..ef823856a57 100644 --- a/htdocs/core/modules/modEmailCollector.class.php +++ b/htdocs/core/modules/modEmailCollector.class.php @@ -175,7 +175,7 @@ class modEmailCollector extends DolibarrModules 'titre'=>'EmailCollectors', 'url'=>'/admin/emailcollector_list.php?leftmenu=admintools', 'langs'=>'admin', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. - 'position'=>201, + 'position'=>400, 'enabled'=>'$conf->emailcollector->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms'=>'$user->admin', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules 'target'=>'', From faee162b916a3f83c875b48eb028f2447e797965 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 6 Sep 2022 04:48:26 +0200 Subject: [PATCH 244/453] FIX Travis - Complete WIP #22059 --- htdocs/core/modules/modUser.class.php | 10 +++++----- htdocs/user/list.php | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index 719c90c6dab..dc0da3e0ac3 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -225,7 +225,7 @@ class modUser extends DolibarrModules 'u.accountancy_code'=>"UserAccountancyCode", 'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town", 'u.office_phone'=>'Phone', 'u.user_mobile'=>"Mobile", 'u.office_fax'=>'Fax', - 'u.email'=>"Email", 'u.note'=>"Note", 'u.signature'=>'Signature', + 'u.email'=>"Email", 'u.note_public'=>"NotePublic", 'u.note_private'=>"NotePrivate", 'u.signature'=>'Signature', 'u.fk_user'=>'HierarchicalResponsible', 'u.thm'=>'THM', 'u.tjm'=>'TJM', 'u.weeklyhours'=>'WeeklyHours', 'u.dateemployment'=>'DateEmploymentStart', 'u.dateemploymentend'=>'DateEmploymentEnd', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey', 'u.birth'=>'DateOfBirth', @@ -242,7 +242,7 @@ class modUser extends DolibarrModules 'u.accountancy_code'=>'Text', 'u.address'=>"Text", 'u.zip'=>"Text", 'u.town'=>"Text", 'u.office_phone'=>'Text', 'u.user_mobile'=>'Text', 'u.office_fax'=>'Text', - 'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.signature'=>"Text", 'u.datelastlogin'=>'Date', + 'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note_public'=>"Text", 'u.note_private'=>"Text", 'u.signature'=>"Text", 'u.datelastlogin'=>'Date', 'u.fk_user'=>"FormSelect:select_dolusers", 'u.birth'=>'Date', 'u.datepreviouslogin'=>'Date', @@ -261,7 +261,7 @@ class modUser extends DolibarrModules 'u.accountancy_code'=>'user', 'u.address'=>"user", 'u.zip'=>"user", 'u.town'=>"user", 'u.office_phone'=>'user', 'u.user_mobile'=>'user', 'u.office_fax'=>'user', - 'u.email'=>'user', 'u.note'=>"user", 'u.signature'=>'user', + 'u.email'=>'user', 'u.note_public'=>"user", 'u.note_private'=>"user", 'u.signature'=>'user', 'u.fk_user'=>'user', 'u.thm'=>'user', 'u.tjm'=>'user', 'u.weeklyhours'=>'user', 'u.dateemployment'=>'user', 'u.dateemploymentend'=>'user', 'u.salary'=>'user', 'u.color'=>'user', 'u.api_key'=>'user', 'u.birth'=>'user', @@ -303,7 +303,7 @@ class modUser extends DolibarrModules 'u.pass_crypted'=>"Password", 'u.admin'=>"Administrator", 'u.fk_soc'=>"Company*", 'u.address'=>"Address", 'u.zip'=>"Zip", 'u.town'=>"Town", 'u.fk_state'=>"StateId", 'u.fk_country'=>"CountryCode", 'u.office_phone'=>"Phone", 'u.user_mobile'=>"Mobile", 'u.office_fax'=>"Fax", - 'u.email'=>"Email", 'u.note'=>"Note", 'u.signature'=>'Signature', + 'u.email'=>"Email", 'u.note_public'=>"NotePublic", 'u.note_private'=>"NotePrivate", 'u.signature'=>'Signature', 'u.fk_user'=>'HierarchicalResponsible', 'u.thm'=>'THM', 'u.tjm'=>'TJM', 'u.weeklyhours'=>'WeeklyHours', 'u.dateemployment'=>'DateEmploymentStart', 'u.dateemploymentend'=>'DateEmploymentEnd', 'u.salary'=>'Salary', 'u.color'=>'Color', 'u.api_key'=>'ApiKey', 'u.birth'=>'DateOfBirth', @@ -339,7 +339,7 @@ class modUser extends DolibarrModules 'u.pass_crypted'=>'Encrypted password', 'u.fk_soc'=>'0 (internal user) or company name (external user)', 'u.datec'=>dol_print_date(dol_now(), '%Y-%m-%d'), 'u.address'=>"61 jump street", 'u.zip'=>"123456", 'u.town'=>"Big town", 'u.fk_country'=>'US, FR, DE...', 'u.office_phone'=>"0101010101", 'u.office_fax'=>"0101010102", - 'u.email'=>"test@mycompany.com", 'u.salary'=>"10000", 'u.note'=>"This is an example of note for record", 'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00", + 'u.email'=>"test@mycompany.com", 'u.salary'=>"10000", 'u.note_public'=>"This is an example of public note for record", 'u.note_private'=>"This is an example of private note for record", 'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00", 'u.statut'=>"0 (closed) or 1 (active)", ); $this->import_updatekeys_array[$r] = array('u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>'Login'); diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 858a46887ba..416e913d6c9 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -110,7 +110,8 @@ $fieldstosearchall = array( 'u.office_phone'=>"PhonePro", 'u.user_mobile'=>"PhoneMobile", 'u.email'=>"EMail", - 'u.note'=>"Note", + 'u.note_public'=>"NotePublic", + 'u.note_private'=>"NotePrivate", ); if (!empty($conf->api->enabled)) { $fieldstosearchall['u.api_key'] = "ApiKey"; From 9a5927d833bf17fdac2a9bbf982d815ba8c50c13 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 6 Sep 2022 05:30:35 +0200 Subject: [PATCH 245/453] FIX Column label --- htdocs/adherents/class/adherent.class.php | 4 ++-- htdocs/comm/propal/class/propal.class.php | 4 ++-- htdocs/commande/class/commande.class.php | 4 ++-- htdocs/compta/bank/class/account.class.php | 2 +- htdocs/compta/facture/class/facture-rec.class.php | 4 ++-- htdocs/compta/facture/class/facture.class.php | 4 ++-- htdocs/contrat/class/contrat.class.php | 4 ++-- htdocs/fourn/class/fournisseur.commande.class.php | 4 ++-- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- htdocs/societe/class/societe.class.php | 4 ++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index b7f2810912b..abc002b4e89 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -327,8 +327,8 @@ class Adherent extends CommonObject 'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135), 'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145), 'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => -1, 'position' => 150), - 'note_private' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155), - 'note_public' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160), + 'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 155), + 'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 160), 'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165), 'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170), 'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 175), diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 65a2e60777f..f36b8027461 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -310,8 +310,8 @@ class Propal extends CommonObject 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180), 'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190), diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f02e74687af..54e50baa9f7 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -314,8 +314,8 @@ class Commande extends CommonOrder 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1), 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>150), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>150), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160), //'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165), 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170), diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index c3628e12b7c..70f03bc21c8 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -295,7 +295,7 @@ class Account extends CommonObject 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185), diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 6b9837e77bd..8306a5c9c0d 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -184,8 +184,8 @@ class FactureRec extends CommonInvoice 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115), 'date_last_gen' =>array('type'=>'varchar(7)', 'label'=>'Last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>120), 'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'Unit frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>125), diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d646da3b413..4e5f1923297 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -327,8 +327,8 @@ class Facture extends CommonInvoice 'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>205), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>210), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225), 'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230), diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index f364e82dd68..309df80605e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -237,8 +237,8 @@ class Contrat extends CommonObject 'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125), diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 5f671599c50..e78dd9dd02a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -213,8 +213,8 @@ class CommandeFournisseur extends CommonOrder 'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1), 'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1), 'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>150, 'isameasure'=>1), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>160), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>165), 'fk_input_method' =>array('type'=>'integer', 'label'=>'InputMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>170), 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>175), diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 66c441841d1..c4635962368 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -282,8 +282,8 @@ class FactureFournisseur extends CommonInvoice 'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155), 'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160), 'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateLimReglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>180), 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>190), 'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>-1, 'position'=>195), diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 7c5773363c4..fe72e99e76f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -192,8 +192,8 @@ class Societe extends CommonObject 'tva_intra' =>array('type'=>'varchar(20)', 'label'=>'Tva intra', 'enabled'=>1, 'visible'=>-1, 'position'=>210), 'capital' =>array('type'=>'double(24,8)', 'label'=>'Capital', 'enabled'=>1, 'visible'=>-1, 'position'=>215), 'fk_stcomm' =>array('type'=>'integer', 'label'=>'CommercialStatus', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), - 'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>225), - 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>230), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>225), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>230), 'prefix_comm' =>array('type'=>'varchar(5)', 'label'=>'Prefix comm', 'enabled'=>'$conf->global->SOCIETE_USEPREFIX', 'visible'=>-1, 'position'=>235), 'client' =>array('type'=>'tinyint(4)', 'label'=>'Client', 'enabled'=>1, 'visible'=>-1, 'position'=>240), 'fournisseur' =>array('type'=>'tinyint(4)', 'label'=>'Fournisseur', 'enabled'=>1, 'visible'=>-1, 'position'=>245), From a13f232d2d577859ddc2df9319a815a34cbecf16 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 6 Sep 2022 05:42:04 +0200 Subject: [PATCH 246/453] FIX #22057 --- htdocs/compta/resultat/clientfourn.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index ed4dac6c3f3..3658fdbda6b 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php'; // Load translation files required by the page From 2c58aeafed1b21632a9155f5eba0ed2c23a570e1 Mon Sep 17 00:00:00 2001 From: Anthony Berton Date: Tue, 6 Sep 2022 08:31:05 +0200 Subject: [PATCH 247/453] FIX - php V8 html form documents --- htdocs/core/class/html.formfile.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 441ddb60255..05489c3dc50 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1471,10 +1471,10 @@ class FormFile if ($nboffiles > 1 && $conf->browser->layout != 'phone') { print ''; } else { From 4d396bbf50b3149daba7310bb23368bfe36cd54c Mon Sep 17 00:00:00 2001 From: Gauthier PC portable 024 Date: Tue, 6 Sep 2022 09:48:10 +0200 Subject: [PATCH 248/453] FIX : same thing in deleteline --- htdocs/expedition/card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 42214d1165e..8aa54ca8904 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -540,6 +540,7 @@ if (empty($reshook)) { $object->fetch($id); $lines = $object->lines; $line = new ExpeditionLigne($db); + $line->fk_expedition = $object->id; $num_prod = count($lines); for ($i = 0; $i < $num_prod; $i++) { From c6349ce51a137cf6c91e9118c4d0bc1e75758052 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 6 Sep 2022 11:06:48 +0200 Subject: [PATCH 249/453] Fix : Yogosha report 12245 bad field verification --- htdocs/holiday/card.php | 6 ++++++ htdocs/langs/en_US/holiday.lang | 1 + 2 files changed, 7 insertions(+) diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 96a6b40f71b..f1faf827b34 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -254,6 +254,12 @@ if (empty($reshook)) { $error++; } + $approverslist = $object->fetch_users_approver_holiday(); + if (!in_array($approverid, $approverslist)) { + setEventMessages($langs->transnoentitiesnoconv('InvalidValidator'), null, 'errors'); + $error++; + } + $result = 0; if (!$error) { diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index 04f47c8428d..95c8f54d211 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -58,6 +58,7 @@ ConfirmDeleteCP=Confirm the deletion of this leave request? ErrorCantDeleteCP=Error you don't have the right to delete this leave request. CantCreateCP=You don't have the right to make leave requests. InvalidValidatorCP=You must choose the approver for your leave request. +InvalidValidator=The user chosen isn't an approver. NoDateDebut=You must select a start date. NoDateFin=You must select an end date. ErrorDureeCP=Your leave request does not contain working day. From e40d925a572cf8c7942d17b3202504fcbde99d99 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Sep 2022 12:43:07 +0200 Subject: [PATCH 250/453] css --- htdocs/societe/paymentmodes.php | 2 +- htdocs/theme/eldy/global.inc.php | 8 ++++++++ htdocs/theme/md/style.css.php | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index b8a0d4e11f2..20cce294586 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -863,7 +863,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print ''; print img_picto($langs->trans("CreateCustomerOnStripe"), 'stripe'); - print ''; + print ''; print ''; } print ''; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index dcff3c4b7a1..b8326171eb4 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3545,6 +3545,14 @@ input.button[name="upload"] { input.button.smallpaddingimp, input.buttonreset.smallpaddingimp { font-size: 0.8em; } +input.buttonlink { + color: var(--colortextlink); + background-color: transparent; + cursor: pointer; +} +input.buttonlink:hover { + text-decoration: underline; +} input.buttonreset { margin-top: 3px; margin-bottom: 3px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 1eb0fa7d71f..47892574efb 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3511,6 +3511,14 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd .smallpaddingimp { padding: 4px !important; } +input.buttonlink { + color: var(--colortextlink); + background-color: transparent; + cursor: pointer; +} +input.buttonlink:hover { + text-decoration: underline; +} input.buttonreset { margin-top: 3px; margin-bottom: 3px; From c06963f2ff49994ef5240b8376c4271f4564741e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Sep 2022 14:21:32 +0200 Subject: [PATCH 251/453] Trans --- htdocs/langs/en_US/withdrawals.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index 75cee952bcd..c7820a965aa 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -118,7 +118,7 @@ WithdrawRequestErrorNilAmount=Unable to create direct debit request for empty am SepaMandate=SEPA Direct Debit Mandate SepaMandateShort=SEPA Mandate PleaseReturnMandate=Please return this mandate form by email to %s or by mail to -SEPALegalText=By signing this mandate form, you authorize (A) %s to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with the instructions from %s. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. Your rights regarding the above mandate are explained in a statement that you can obtain from your bank. +SEPALegalText=By signing this mandate form, you authorize (A) %s and its payment service provider to send instructions to your bank to debit your account and (B) your bank to debit your account in accordance with the instructions from %s. As part of your rights, you are entitled to a refund from your bank under the terms and conditions of your agreement with your bank. Your rights regarding the above mandate are explained in a statement that you can obtain from your bank. CreditorIdentifier=Creditor Identifier CreditorName=Creditor Name SEPAFillForm=(B) Please complete all the fields marked * From 3df3bd8c4af3bb8e341ca37661221a771174d1b5 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Tue, 6 Sep 2022 15:37:00 +0200 Subject: [PATCH 252/453] Fix ; permission check code --- htdocs/core/boxes/box_activity.php | 6 +- htdocs/core/boxes/box_birthdays.php | 2 +- htdocs/core/boxes/box_clients.php | 2 +- ...box_customers_outstanding_bill_reached.php | 2 +- htdocs/core/boxes/box_fournisseurs.php | 2 +- htdocs/core/boxes/box_last_ticket.php | 2 +- htdocs/core/boxes/box_prospect.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 864 +++++++++--------- htdocs/holiday/list.php | 8 +- htdocs/hrm/index.php | 4 +- htdocs/user/class/user.class.php | 2 +- 11 files changed, 448 insertions(+), 448 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 20c2e814d82..017c5fe3d02 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -62,9 +62,9 @@ class box_activity extends ModeleBoxes // FIXME: Pb into some status $this->enabled = ($conf->global->MAIN_FEATURES_LEVEL); // Not enabled by default due to bugs (see previous comments) - $this->hidden = !((isModEnabled('facture') && $user->rights->facture->lire) - || (isModEnabled('commande') && $user->rights->commande->lire) - || (isModEnabled('propal') && $user->rights->propale->lire) + $this->hidden = !((isModEnabled('facture') && $user->hasRight('facture', 'read')) + || (isModEnabled('commande') && $user->hasRight('commande', 'read')) + || (isModEnabled('propal') && $user->hasRight('propale', 'read')) ); } diff --git a/htdocs/core/boxes/box_birthdays.php b/htdocs/core/boxes/box_birthdays.php index 6aec6f4064a..945552753ea 100644 --- a/htdocs/core/boxes/box_birthdays.php +++ b/htdocs/core/boxes/box_birthdays.php @@ -60,7 +60,7 @@ class box_birthdays extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->user->user->lire && empty($user->socid)); + $this->hidden = !($user->hasRight('user', 'user', 'read') && empty($user->socid)); } /** diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 4a7ea965006..364b79932ef 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -65,7 +65,7 @@ class box_clients extends ModeleBoxes $this->enabled = 0; // disabled by this option } - $this->hidden = !($user->rights->societe->lire && empty($user->socid)); + $this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid)); } /** diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php index 0f1fe97dfee..2bf5a2c0693 100644 --- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php +++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php @@ -65,7 +65,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes $this->enabled = 0; // disabled by this option } - $this->hidden = !($user->rights->societe->lire && empty($user->socid)); + $this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid)); } /** diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 2dceee98dda..59280aeec62 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -60,7 +60,7 @@ class box_fournisseurs extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->rights->societe->lire && empty($user->socid)); + $this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid)); } /** diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php index f73566fe972..32efe7293fa 100644 --- a/htdocs/core/boxes/box_last_ticket.php +++ b/htdocs/core/boxes/box_last_ticket.php @@ -84,7 +84,7 @@ class box_last_ticket extends ModeleBoxes 'text' => $langs->trans("BoxLastTicketContent"), ); - if ($user->rights->ticket->read) { + if ($user->hasRight('ticket', 'read')) { $sql = "SELECT t.rowid as id, t.ref, t.track_id, t.fk_soc, t.fk_user_create, t.fk_user_assign, t.subject, t.message, t.fk_statut as status, t.type_code, t.category_code, t.severity_code, t.datec, t.date_read, t.date_close, t.origin_email,"; $sql .= " type.label as type_label, category.label as category_label, severity.label as severity_label,"; $sql .= " s.nom as company_name, s.email as socemail, s.client, s.fournisseur"; diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index e9824339f1e..205cf09419c 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -67,7 +67,7 @@ class box_prospect extends ModeleBoxes $this->enabled = 0; // disabled by this option } - $this->hidden = !($user->rights->societe->lire && empty($user->socid)); + $this->hidden = !($user->hasRight('societe', 'read') && empty($user->socid)); } /** diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5c6a9e64c4d..01bc426458e 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -96,7 +96,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Members $tmpentry = array( 'enabled' => (isModEnabled('adherent')), - 'perms' => (!empty($user->rights->adherent->lire)), + 'perms' => (!empty($user->hasRight('adherent', 'lire'))), 'module' => 'adherent' ); $menu_arr[] = array( @@ -125,7 +125,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ) || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) ), - 'perms'=> (!empty($user->rights->societe->lire) || !empty($user->rights->fournisseur->lire) || !empty($user->rights->supplier_order->lire) || !empty($user->rights->supplier_invoice->lire) || !empty($user->rights->supplier_proposal->lire)), + 'perms'=> (!empty($user->hasRight('societe', 'lire')) || !empty($user->hasRight('fournisseur', 'lire')) || !empty($user->hasRight('supplier_order', 'lire')) || !empty($user->hasRight('supplier_invoice', 'lire')) || !empty($user->hasRight('supplier_proposal', 'lire'))), 'module'=>'societe|fournisseur' ); $menu_arr[] = array( @@ -150,7 +150,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Products-Services $tmpentry = array( 'enabled'=> (isModEnabled('product') || isModEnabled('service') || isModEnabled('expedition')), - 'perms'=> (!empty($user->rights->produit->lire) || !empty($user->rights->service->lire) || !empty($user->rights->expedition->lire)), + 'perms'=> (!empty($user->hasRight('produit', 'lire')) || !empty($user->hasRight('service', 'lire')) || !empty($user->hasRight('expedition', 'lire'))), 'module'=>'product|service' ); $menu_arr[] = array( @@ -177,7 +177,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // MRP - GPAO $tmpentry = array( 'enabled'=>(isModEnabled('bom') || isModEnabled('mrp')), - 'perms'=>(!empty($user->rights->bom->read) || !empty($user->rights->mrp->read)), + 'perms'=>(!empty($user->hasRight('bom', 'read')) || !empty($user->hasRight('mrp', 'read'))), 'module'=>'bom|mrp' ); $menu_arr[] = array( @@ -202,7 +202,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Projects $tmpentry = array( 'enabled'=> (isModEnabled('projet') ? 1 : 0), - 'perms'=> (!empty($user->rights->projet->lire) ? 1 : 0), + 'perms'=> (!empty($user->hasRight('projet', 'lire')) ? 1 : 0), 'module'=>'projet' ); $menu_arr[] = array( @@ -234,25 +234,25 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = || isModEnabled('contrat') || isModEnabled('ficheinter') ) ? 1 : 0, - 'perms'=>(!empty($user->rights->propal->lire) - || !empty($user->rights->commande->lire) - || !empty($user->rights->supplier_proposal->lire) - || !empty($user->rights->fournisseur->lire) - || !empty($user->rights->fournisseur->commande->lire) - || !empty($user->rights->supplier_order->lire) - || !empty($user->rights->contrat->lire) - || !empty($user->rights->ficheinter->lire) + 'perms'=>(!empty($user->hasRight('propal', 'lire')) + || !empty($user->hasRight('commande', 'lire')) + || !empty($user->hasRight('supplier_proposal', 'lire')) + || !empty($user->hasRight('fournisseur', 'lire')) + || !empty($user->hasRight('fournisseur', 'commande', 'lire')) + || !empty($user->hasRight('supplier_order', 'lire')) + || !empty($user->hasRight('contrat', 'lire')) + || !empty($user->hasRight('ficheinter', 'lire')) ), 'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' ); - $onlysupplierorder = !empty($user->rights->fournisseur->commande->lire) && - empty($user->rights->propal->lire) && - empty($user->rights->commande->lire) && - empty($user->rights->supplier_order->lire) && - empty($user->rights->supplier_proposal->lire) && - empty($user->rights->contrat->lire) && - empty($user->rights->ficheinter->lire); + $onlysupplierorder = !empty($user->hasRight('fournisseur', 'commande', 'lire')) && + empty($user->hasRight('propal', 'lire')) && + empty($user->hasRight('commande', 'lire')) && + empty($user->hasRight('supplier_order', 'lire')) && + empty($user->hasRight('supplier_proposal', 'lire')) && + empty($user->hasRight('contrat', 'lire')) && + empty($user->hasRight('ficheinter', 'lire')); $menu_arr[] = array( 'name' => 'Commercial', @@ -283,9 +283,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = isModEnabled('loan') || isModEnabled('margins') ) ? 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)), + 'perms'=>(!empty($user->hasRight('facture', 'lire')) || !empty($user->hasRight('don', 'contact', 'lire')) + || !empty($user->hasRight('tax', 'charges', 'lire')) || !empty($user->hasRight('salaries', 'read')) + || !empty($user->hasRight('fournisseur', 'facture', 'lire')) || !empty($user->hasRight('loan', 'read')) || !empty($user->hasRight('margins', 'liretous'))), 'module'=>'facture|supplier_invoice|don|tax|salaries|loan' ); $menu_arr[] = array( @@ -310,7 +310,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Bank $tmpentry = array( 'enabled'=>(isModEnabled('banque') || isModEnabled('prelevement')), - 'perms'=>(!empty($user->rights->banque->lire) || !empty($user->rights->prelevement->lire) || !empty($user->rights->paymentbybanktransfer->read)), + 'perms'=>(!empty($user->hasRight('banque', 'lire')) || !empty($user->hasRight('prelevement', 'lire')) || !empty($user->hasRight('paymentbybanktransfer', 'read'))), 'module'=>'banque|prelevement|paymentbybanktransfer' ); $menu_arr[] = array( @@ -335,7 +335,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Accounting $tmpentry = array( 'enabled'=>(isModEnabled('comptabilite') || isModEnabled('accounting') || isModEnabled('asset') || isModEnabled('intracommreport')), - 'perms'=>(!empty($user->rights->compta->resultat->lire) || !empty($user->rights->accounting->comptarapport->lire) || !empty($user->rights->accounting->mouvements->lire) || !empty($user->rights->asset->read) || !empty($user->rights->intracommreport->read)), + 'perms'=>(!empty($user->hasRight('compta', 'resultat', 'lire')) || !empty($user->hasRight('accounting', 'comptarapport', 'lire')) || !empty($user->hasRight('accounting', 'mouvements', 'lire')) || !empty($user->hasRight('asset', 'read')) || !empty($user->hasRight('intracommreport', 'read'))), 'module'=>'comptabilite|accounting|asset|intracommreport' ); $menu_arr[] = array( @@ -360,7 +360,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // HRM $tmpentry = array( 'enabled'=>(isModEnabled('hrm') || (isModEnabled('holiday')) || isModEnabled('deplacement') || isModEnabled('expensereport') || isModEnabled('recruitment')), - 'perms'=>(!empty($user->rights->user->user->lire) || !empty($user->rights->holiday->read) || !empty($user->rights->deplacement->lire) || !empty($user->rights->expensereport->lire) || !empty($user->rights->recruitment->recruitmentjobposition->read)), + 'perms'=>(!empty($user->hasRight('user', 'user', 'lire')) || !empty($user->hasRight('holiday', 'read')) || !empty($user->hasRight('deplacement', 'lire')) || !empty($user->hasRight('expensereport', 'lire')) || !empty($user->hasRight('recruitment', 'recruitmentjobposition', 'read'))), 'module'=>'hrm|holiday|deplacement|expensereport|recruitment' ); @@ -386,7 +386,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Tickets and knowledge base $tmpentry = array( 'enabled'=>(isModEnabled('ticket') || isModEnabled('knowledgemanagement')), - 'perms'=>(!empty($user->rights->ticket->read) || !empty($user->rights->knowledgemanagement->knowledgerecord->read)), + 'perms'=>(!empty($user->hasRight('ticket', 'read')) || !empty($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read'))), 'module'=>'ticket|knowledgemanagement' ); $link = ''; @@ -1150,20 +1150,20 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = } } - $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); - if ($user->rights->user->user->lire) { + $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->hasRight('user', 'user', 'read'), '', $mainmenu, 'users', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); + if ($user->hasRight('user', 'user', 'read')) { if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") { - $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); + $newmenu->add("", $langs->trans("Users"), 1, $user->hasRight('user', 'user', 'lire') || $user->admin); $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->hasRight("user", "user", "write") || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home'); - $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin); - $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin); + $newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->hasRight('user', 'user', 'lire') || $user->admin); + $newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->hasRight('user', 'user', 'lire') || $user->admin); if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } - $newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("", $langs->trans("Groups"), 1, ($user->hasRight('user', 'user', 'lire') || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); $newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->hasRight("user", "group_advance", "create") : $user->hasRight("user", "user", "create")) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); - $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); + $newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->hasRight('user', 'group_advance', 'read') : $user->hasRight('user', 'user', 'lire')) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)); } } } @@ -1187,9 +1187,9 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le // Societes if (isModEnabled('societe')) { $langs->load("companies"); - $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->rights->societe->lire, '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/societe/index.php?leftmenu=thirdparties", $langs->trans("ThirdParty"), 0, $user->hasRight('societe', 'lire'), '', $mainmenu, 'thirdparties', 0, '', '', '', img_picto('', 'company', 'class="paddingright pictofixedwidth"')); - if ($user->rights->societe->creer) { + if ($user->hasRight('societe', 'creer')) { $newmenu->add("/societe/card.php?action=create", $langs->trans("MenuNewThirdParty"), 1); if (!$conf->use_javascript_ajax) { $newmenu->add("/societe/card.php?action=create&private=1", $langs->trans("MenuNewPrivateIndividual"), 1); @@ -1202,30 +1202,30 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le // Prospects if (isModEnabled('societe') && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'prospects'); + $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 2, $user->hasRight('societe', 'lire'), '', $mainmenu, 'prospects'); /* no more required, there is a filter that can do more - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->hasRight('societe', 'lire')); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->hasRight('societe', 'lire')); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->hasRight('societe', 'lire')); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->hasRight('societe', 'lire')); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->hasRight('societe', 'lire')); */ - $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->rights->societe->creer); + $newmenu->add("/societe/card.php?leftmenu=prospects&action=create&type=p", $langs->trans("MenuNewProspect"), 3, $user->hasRight('societe', 'creer')); } // Customers/Prospects if (isModEnabled('societe') && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->rights->societe->lire, '', $mainmenu, 'customers'); + $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 2, $user->hasRight('societe', 'lire'), '', $mainmenu, 'customers'); - $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 3, $user->rights->societe->creer); + $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 3, $user->hasRight('societe', 'creer')); } // Suppliers if (isModEnabled('societe') && (((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) || isModEnabled('supplier_proposal'))) { $langs->load("suppliers"); - $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers'); - $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f", $langs->trans("MenuNewSupplier"), 3, $user->rights->societe->creer && ($user->rights->fournisseur->lire || $user->rights->supplier_order->lire || $user->rights->supplier_invoice->lire || $user->rights->supplier_proposal->lire)); + $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 2, ($user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire')), '', $mainmenu, 'suppliers'); + $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f", $langs->trans("MenuNewSupplier"), 3, $user->hasRight('societe', 'creer') && ($user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire'))); } // Categories @@ -1240,36 +1240,36 @@ function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $le if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { $menutoshow = $langs->trans("ProspectsCategoriesShort"); } - $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } // Categories suppliers if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->rights->categorie->lire); + $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 1, $user->hasRight('categorie', 'lire')); } } // Contacts - $newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->rights->societe->contact->lire, '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/societe/index.php?leftmenu=thirdparties", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses")), 0, $user->hasRight('societe', 'contact', 'lire'), '', $mainmenu, 'contacts', 0, '', '', '', img_picto('', 'contact', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->rights->societe->contact->creer); - $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->rights->societe->contact->lire); + $newmenu->add("/contact/card.php?leftmenu=contacts&action=create", (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("NewContact") : $langs->trans("NewContactAddress")), 1, $user->hasRight('societe', 'contact', 'creer')); + $newmenu->add("/contact/list.php?leftmenu=contacts", $langs->trans("List"), 1, $user->hasRight('societe', 'contact', 'lire')); if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->rights->societe->contact->lire); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=p", $langs->trans("Prospects"), 2, $user->hasRight('societe', 'contact', 'lire')); } if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->rights->societe->contact->lire); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=c", $langs->trans("Customers"), 2, $user->hasRight('societe', 'contact', 'lire')); } if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->rights->societe->contact->lire); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=f", $langs->trans("Suppliers"), 2, $user->hasRight('societe', 'contact', 'lire')); } - $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->rights->societe->contact->lire); - //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->rights->societe->contact->lire); + $newmenu->add("/contact/list.php?leftmenu=contacts&type=o", $langs->trans("ContactOthers"), 2, $user->hasRight('societe', 'contact', 'lire')); + //$newmenu->add("/contact/list.php?userid=$user->id", $langs->trans("MyContacts"), 1, $user->hasRight('societe', 'contact', 'lire')); // Categories if (isModEnabled('categorie')) { $langs->load("categories"); // Categories Contact - $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } } } @@ -1294,98 +1294,98 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left // Customer proposal if (isModEnabled('propal')) { $langs->load("propal"); - $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->rights->propale->lire, '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer); - $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire); + $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->hasRight('propale', 'lire'), '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->hasRight('propale', 'creer')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->hasRight('propale', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") { - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire); - //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->hasRight('propale', 'lire')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->hasRight('propale', 'lire')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->hasRight('propale', 'lire')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->hasRight('propale', 'lire')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->hasRight('propale', 'lire')); + //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->hasRight('propale', 'lire')); } - $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->rights->propale->lire); + $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->hasRight('propale', 'lire')); } // Customers orders if (isModEnabled('commande')) { $langs->load("orders"); - $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); - $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); + $newmenu->add("/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 200, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->hasRight('commande', 'creer')); + $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->hasRight('commande', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->hasRight('commande', 'lire')); if (isModEnabled('expedition')) { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->hasRight('commande', 'lire')); } - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire); - //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->hasRight('commande', 'lire')); + //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->hasRight('commande', 'lire')); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->hasRight('commande', 'lire')); } - $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); + $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->hasRight('commande', 'lire')); } // Supplier proposal if (isModEnabled('supplier_proposal')) { $langs->load("supplier_proposal"); - $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->rights->supplier_proposal->lire, '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->rights->supplier_proposal->creer); - $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->rights->supplier_proposal->lire); - $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->supplier_proposal->lire); + $newmenu->add("/supplier_proposal/index.php?leftmenu=propals_supplier", $langs->trans("SupplierProposalsShort"), 0, $user->hasRight('supplier_proposal', 'lire'), '', $mainmenu, 'propals_supplier', 300, '', '', '', img_picto('', 'supplier_proposal', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals", $langs->trans("SupplierProposalNew"), 1, $user->hasRight('supplier_proposal', 'creer')); + $newmenu->add("/supplier_proposal/list.php?leftmenu=supplier_proposals", $langs->trans("List"), 1, $user->hasRight('supplier_proposal', 'lire')); + $newmenu->add("/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier", $langs->trans("Statistics"), 1, $user->hasRight('supplier_proposal', 'lire')); } // Suppliers orders if (isModEnabled('supplier_order')) { $langs->load("orders"); - $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire, '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->rights->fournisseur->commande->creer); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/index.php?leftmenu=orders_suppliers", $langs->trans("SuppliersOrders"), 0, $user->hasRight('fournisseur', 'commande', 'lire'), '', $mainmenu, 'orders_suppliers', 400, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/commande/card.php?action=create&leftmenu=orders_suppliers", $langs->trans("NewSupplierOrderShort"), 1, $user->hasRight('fournisseur', 'commande', 'creer')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers", $langs->trans("List"), 1, $user->hasRight('fournisseur', 'commande', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders_suppliers") { - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=0", $langs->trans("StatusSupplierOrderDraftShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); if (empty($conf->global->SUPPLIER_ORDER_HIDE_VALIDATED)) { - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=1", $langs->trans("StatusSupplierOrderValidated"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); } - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $user->rights->fournisseur->commande->lire); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $user->rights->fournisseur->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=2", $langs->trans("StatusSupplierOrderApprovedShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=3", $langs->trans("StatusSupplierOrderOnProcessShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=4", $langs->trans("StatusSupplierOrderReceivedPartiallyShort"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=5", $langs->trans("StatusSupplierOrderReceivedAll"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=6,7", $langs->trans("StatusSupplierOrderCanceled"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&statut=9", $langs->trans("StatusSupplierOrderRefused"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); } - // Billed is another field. We should add instead a dedicated filter on list. if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("Billed"), 2, $user->rights->fournisseur->commande->lire); + // Billed is another field. We should add instead a dedicated filter on list. if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders_suppliers") $newmenu->add("/fourn/commande/list.php?leftmenu=orders_suppliers&billed=1", $langs->trans("Billed"), 2, $user->hasRight('fournisseur', 'commande', 'lire')); - $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire); + $newmenu->add("/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier", $langs->trans("Statistics"), 1, $user->hasRight('fournisseur', 'commande', 'lire')); } // Contrat if (isModEnabled('contrat')) { $langs->load("contracts"); - $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->rights->contrat->lire, '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->rights->contrat->creer); - $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->rights->contrat->lire); + $newmenu->add("/contrat/index.php?leftmenu=contracts", $langs->trans("ContractsSubscriptions"), 0, $user->hasRight('contrat', 'lire'), '', $mainmenu, 'contracts', 2000, '', '', '', img_picto('', 'contract', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/contrat/card.php?action=create&leftmenu=contracts", $langs->trans("NewContractSubscription"), 1, $user->hasRight('contrat', 'creer')); + $newmenu->add("/contrat/list.php?leftmenu=contracts", $langs->trans("List"), 1, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts", $langs->trans("MenuServices"), 1, $user->hasRight('contrat', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "contracts") { - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->rights->contrat->lire); - $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->rights->contrat->lire); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=0", $langs->trans("MenuInactiveServices"), 2, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4", $langs->trans("MenuRunningServices"), 2, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=4&filter=expired", $langs->trans("MenuExpiredServices"), 2, $user->hasRight('contrat', 'lire')); + $newmenu->add("/contrat/services_list.php?leftmenu=contracts&mode=5", $langs->trans("MenuClosedServices"), 2, $user->hasRight('contrat', 'lire')); } } // Interventions if (isModEnabled('ficheinter')) { $langs->load("interventions"); - $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201); - $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202); + $newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->hasRight('ficheinter', 'lire'), '', $mainmenu, 'ficheinter', 2200, '', '', '', img_picto('', 'intervention', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->hasRight('ficheinter', 'creer'), '', '', '', 201); + $newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->hasRight('ficheinter', 'lire'), '', '', '', 202); if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { - $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->rights->ficheinter->lire, '', '', '', 203); + $newmenu->add("/fichinter/card-rec.php?leftmenu=ficheinter", $langs->trans("ListOfTemplates"), 1, $user->hasRight('ficheinter', 'lire'), '', '', '', 203); } - $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire); + $newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->hasRight('ficheinter', 'lire')); } } } @@ -1410,69 +1410,69 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen // Customers invoices if (isModEnabled('facture')) { $langs->load("bills"); - $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->rights->facture->lire, '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->rights->facture->creer); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_list'); + $newmenu->add("/compta/facture/index.php?leftmenu=customers_bills", $langs->trans("BillsCustomers"), 0, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills', 0, '', '', '', img_picto('', 'bill', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/facture/card.php?action=create", $langs->trans("NewBill"), 1, $user->hasRight('facture', 'creer')); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills", $langs->trans("List"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_list'); if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu)) { - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->facture->lire); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->facture->lire); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->facture->lire); - $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->rights->facture->lire); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->hasRight('facture', 'lire')); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->hasRight('facture', 'lire')); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->hasRight('facture', 'lire')); + $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_canceled&search_status=3", $langs->trans("BillShortStatusCanceled"), 2, $user->hasRight('facture', 'lire')); } - $newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates", $langs->trans("ListOfTemplates"), 1, $user->rights->facture->creer, '', $mainmenu, 'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice. + $newmenu->add("/compta/facture/invoicetemplate_list.php?leftmenu=customers_bills_templates", $langs->trans("ListOfTemplates"), 1, $user->hasRight('facture', 'creer'), '', $mainmenu, 'customers_bills_templates'); // No need to see recurring invoices, if user has no permission to create invoice. - $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment'); + $newmenu->add("/compta/paiement/list.php?leftmenu=customers_bills_payment", $langs->trans("Payments"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_payment'); if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) { - $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->rights->facture->lire, '', $mainmenu, 'customer_bills_tovalid'); + $newmenu->add("/compta/paiement/tovalidate.php?leftmenu=customers_bills_tovalid", $langs->trans("MenuToValid"), 2, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customer_bills_tovalid'); } if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills/', $leftmenu)) { - $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_payment_report'); + $newmenu->add("/compta/paiement/rapport.php?leftmenu=customers_bills_payment_report", $langs->trans("Reportings"), 2, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_payment_report'); } - $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->facture->lire, '', $mainmenu, 'customers_bills_stats'); + $newmenu->add("/compta/facture/stats/index.php?leftmenu=customers_bills_stats", $langs->trans("Statistics"), 1, $user->hasRight('facture', 'lire'), '', $mainmenu, 'customers_bills_stats'); } // Suppliers invoices if (isModEnabled('societe') && isModEnabled('supplier_invoice')) { $langs->load("bills"); - $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer), '', $mainmenu, 'suppliers_bills_create'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_list'); + $newmenu->add("/fourn/facture/index.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"), 0, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills', 0, '', '', '', img_picto('', 'supplier_invoice', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/fourn/facture/card.php?leftmenu=suppliers_bills&action=create", $langs->trans("NewBill"), 1, ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')), '', $mainmenu, 'suppliers_bills_create'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("List"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_list'); if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_draft'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_notpaid'); - $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_draft&search_status=0", $langs->trans("BillShortStatusDraft"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_draft'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_notpaid&search_status=1", $langs->trans("BillShortStatusNotPaid"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_notpaid'); + $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_paid'); } - $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'supplierinvoicestemplate_list'); + $newmenu->add("/fourn/facture/list-rec.php?leftmenu=supplierinvoicestemplate_list", $langs->trans("ListOfTemplates"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'supplierinvoicestemplate_list'); - $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment'); + $newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_payment'); if ($usemenuhider || empty($leftmenu) || preg_match('/suppliers_bills/', $leftmenu)) { - $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment_report'); + $newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_payment_report", $langs->trans("Reportings"), 2, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_payment_report'); } - $newmenu->add("/compta/facture/stats/index.php?mode=supplier&leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_stats'); + $newmenu->add("/compta/facture/stats/index.php?mode=supplier&leftmenu=suppliers_bills_stats", $langs->trans("Statistics"), 1, $user->hasRight('fournisseur', 'facture', 'lire'), '', $mainmenu, 'suppliers_bills_stats'); } // Orders if (isModEnabled('commande')) { $langs->load("orders"); if (isModEnabled('facture')) { - $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'order', 'class="paddingright pictofixedwidth"')); } - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->hasRight('commande', 'lire')); } // Supplier Orders to bill if (isModEnabled('supplier_invoice')) { if (!empty($conf->global->SUPPLIER_MENU_ORDER_RECEIVED_INTO_INVOICE)) { $langs->load("supplier"); - $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); + $newmenu->add("/fourn/commande/list.php?leftmenu=orders&search_status=5&billed=0", $langs->trans("MenuOrdersSupplierToBill"), 0, $user->hasRight('commande', 'lire'), '', $mainmenu, 'orders', 0, '', '', '', img_picto('', 'supplier_order', 'class="paddingright pictofixedwidth"')); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->hasRight('commande', 'lire')); } } @@ -1480,58 +1480,58 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen // Donations if (isModEnabled('don')) { $langs->load("donations"); - $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->rights->don->lire, '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/don/index.php?leftmenu=donations&mainmenu=billing", $langs->trans("Donations"), 0, $user->hasRight('don', 'lire'), '', $mainmenu, 'donations', 0, '', '', '', img_picto('', 'donation', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "donations") { - $newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->rights->don->creer); - $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->rights->don->lire); + $newmenu->add("/don/card.php?leftmenu=donations&action=create", $langs->trans("NewDonation"), 1, $user->hasRight('don', 'creer')); + $newmenu->add("/don/list.php?leftmenu=donations", $langs->trans("List"), 1, $user->hasRight('don', 'lire')); } - // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->rights->don->lire); + // if ($leftmenu=="donations") $newmenu->add("/don/stats/index.php",$langs->trans("Statistics"), 1, $user->hasRight('don', 'lire')); } // Taxes and social contributions if (isModEnabled('tax')) { - $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->rights->tax->charges->lire, '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/charges/index.php?leftmenu=tax&mainmenu=billing", $langs->trans("MenuTaxesAndSpecialExpenses"), 0, $user->hasRight('tax', 'charges', 'lire'), '', $mainmenu, 'tax', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->rights->tax->charges->lire); + $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("MenuSocialContributions"), 1, $user->hasRight('tax', 'charges', 'lire')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_social/i', $leftmenu)) { - $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/sociales/card.php?leftmenu=tax_social&action=create", $langs->trans("MenuNewSocialContribution"), 2, $user->hasRight('tax', 'charges', 'creer')); + $newmenu->add("/compta/sociales/list.php?leftmenu=tax_social", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=billing", $langs->trans("Payments"), 2, $user->hasRight('tax', 'charges', 'lire')); } // VAT if (empty($conf->global->TAX_DISABLE_VAT_MENUS)) { global $mysoc; - $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->rights->tax->charges->lire, '', $mainmenu, 'tax_vat'); + $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat&mainmenu=billing", $langs->transcountry("VAT", $mysoc->country_code), 1, $user->hasRight('tax', 'charges', 'lire'), '', $mainmenu, 'tax_vat'); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_vat/i', $leftmenu)) { - $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/payments.php?mode=tvaonly&leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/tva/card.php?leftmenu=tax_vat&action=create", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer')); + $newmenu->add("/compta/tva/list.php?leftmenu=tax_vat", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/tva/payments.php?mode=tvaonly&leftmenu=tax_vat", $langs->trans("Payments"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/tva/index.php?leftmenu=tax_vat", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/tva/clients.php?leftmenu=tax_vat", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/tva/quadri_detail.php?leftmenu=tax_vat", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire')); } //Local Taxes 1 if ($mysoc->useLocalTax(1) && (isset($mysoc->localtax1_assuj) && $mysoc->localtax1_assuj == "1")) { - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&mainmenu=billing&localTaxType=1", $langs->transcountry("LT1", $mysoc->country_code), 1, $user->hasRight('tax', 'charges', 'lire')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_1_vat/i', $leftmenu)) { - $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1", $langs->trans("New"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/card.php?leftmenu=tax_1_vat&action=create&localTaxType=1", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer')); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_1_vat&localTaxType=1", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire')); } } //Local Taxes 2 if ($mysoc->useLocalTax(2) && (isset($mysoc->localtax2_assuj) && $mysoc->localtax2_assuj == "1")) { - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&mainmenu=billing&localTaxType=2", $langs->transcountry("LT2", $mysoc->country_code), 1, $user->hasRight('tax', 'charges', 'lire')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_2_vat/i', $leftmenu)) { - $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2", $langs->trans("New"), 2, $user->rights->tax->charges->creer); - $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("List"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->rights->tax->charges->lire); - $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->rights->tax->charges->lire); + $newmenu->add("/compta/localtax/card.php?leftmenu=tax_2_vat&action=create&localTaxType=2", $langs->trans("New"), 2, $user->hasRight('tax', 'charges', 'creer')); + $newmenu->add("/compta/localtax/list.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("List"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/index.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByMonth"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/clients.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByThirdparties"), 2, $user->hasRight('tax', 'charges', 'lire')); + $newmenu->add("/compta/localtax/quadri_detail.php?leftmenu=tax_2_vat&localTaxType=2", $langs->trans("ReportByQuarter"), 2, $user->hasRight('tax', 'charges', 'lire')); } } } @@ -1540,32 +1540,32 @@ function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen // Salaries if (isModEnabled('salaries')) { $langs->load("salaries"); - $newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->rights->salaries->read, '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 0, $user->hasRight('salaries', 'read'), '', $mainmenu, 'tax_salary', 0, '', '', '', img_picto('', 'salary', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) { - $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->rights->salaries->write); - $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->rights->salaries->read); - $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->rights->salaries->read); - $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->rights->salaries->read); + $newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("New"), 1, $user->hasRight('salaries', 'write')); + $newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("List"), 1, $user->hasRight('salaries', 'read')); + $newmenu->add("/salaries/payments.php?leftmenu=tax_salary", $langs->trans("Payments"), 1, $user->hasRight('salaries', 'read')); + $newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 1, $user->hasRight('salaries', 'read')); } } // Loan if (isModEnabled('loan')) { $langs->load("loan"); - $newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->rights->loan->read, '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/loan/list.php?leftmenu=tax_loan&mainmenu=billing", $langs->trans("Loans"), 0, $user->hasRight('loan', 'read'), '', $mainmenu, 'tax_loan', 0, '', '', '', img_picto('', 'loan', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_loan/i', $leftmenu)) { - $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->rights->loan->write); - //$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->rights->loan->read); + $newmenu->add("/loan/card.php?leftmenu=tax_loan&action=create", $langs->trans("NewLoan"), 1, $user->hasRight('loan', 'write')); + //$newmenu->add("/loan/payment/list.php?leftmenu=tax_loan",$langs->trans("Payments"),2,$user->hasRight('loan', 'read')); } } // Various payment if (isModEnabled('banque') && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { $langs->load("banks"); - $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->rights->banque->lire, '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various&mainmenu=billing", $langs->trans("MenuVariousPayment"), 0, $user->hasRight('banque', 'lire'), '', $mainmenu, 'tax_various', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_various/i', $leftmenu)) { - $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->rights->banque->modifier); - $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->rights->banque->lire); + $newmenu->add("/compta/bank/various_payment/card.php?leftmenu=tax_various&action=create", $langs->trans("New"), 1, $user->hasRight('banque', 'modifier')); + $newmenu->add("/compta/bank/various_payment/list.php?leftmenu=tax_various", $langs->trans("List"), 1, $user->hasRight('banque', 'lire')); } } } @@ -1591,75 +1591,75 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef // Accounting (Double entries) if (isModEnabled('accounting')) { - //$permtoshowmenu = (isModEnabled('accounting') || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire); + //$permtoshowmenu = (isModEnabled('accounting') || $user->hasRight('accounting', 'bind', 'write') || $user->hasRight('compta', 'resultat', 'lire')); //$newmenu->add("/accountancy/index.php?leftmenu=accountancy", $langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy'); // Configuration - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) { global $mysoc; - $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10); + $newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_general', 10); // Fiscal year - Not really yet used. In a future will lock some periods. if ($conf->global->MAIN_FEATURES_LEVEL > 1) { - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'fiscalyear', 20); + $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 1, $user->hasRight('accounting', 'fiscalyear', 'write'), '', $mainmenu, 'fiscalyear', 20); } - $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 30); - $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 40); - $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); - $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 41); - $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 50); - $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 60); + $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_journal', 30); + $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chartmodel', 40); + $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41); + $newmenu->add("/accountancy/admin/subaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ChartOfSubaccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 41); + $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_chart', 50); + $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 60); if (isModEnabled('banque')) { - $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_bank', 70); + $newmenu->add("/compta/bank/list.php?mainmenu=accountancy&leftmenu=accountancy_admin&search_status=-1", $langs->trans("MenuBankAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_bank', 70); } if (isModEnabled('facture') || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) { - $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 80); + $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 80); } if (isModEnabled('tax')) { - $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 90); + $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 90); } if (isModEnabled('expensereport')) { - $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 100); + $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_default', 100); } - $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 110); + $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_product', 110); if ($conf->global->MAIN_FEATURES_LEVEL > 1) { - $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_closure', 120); + $newmenu->add("/accountancy/admin/closure.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuClosureAccounts"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_closure', 120); } - $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_export', 130); + $newmenu->add("/accountancy/admin/export.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("ExportOptions"), 1, $user->hasRight('accounting', 'chartofaccount'), '', $mainmenu, 'accountancy_admin_export', 130); } // Transfer in accounting - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'transfer', 1, '', '', '', img_picto('', 'long-arrow-alt-right', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_transfer", $langs->trans("TransferInAccounting"), 0, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'transfer', 1, '', '', '', img_picto('', 'long-arrow-alt-right', 'class="paddingright pictofixedwidth"')); // Binding - // $newmenu->add("", $langs->trans("Binding"), 0, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch'); + // $newmenu->add("", $langs->trans("Binding"), 0, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch'); if (isModEnabled('facture') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) { - $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); + $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&mainmenu=accountancy", $langs->trans("CustomersVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_customer'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_customer/', $leftmenu)) { - $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); - $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); + $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write')); + $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_customer", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write')); } } if (isModEnabled('supplier_invoice') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) { - $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_supplier'); + $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&mainmenu=accountancy", $langs->trans("SuppliersVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_supplier'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_supplier/', $leftmenu)) { - $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); - $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); + $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write')); + $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_supplier", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write')); } } if (isModEnabled('expensereport') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) { - $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_expensereport'); + $newmenu->add("/accountancy/expensereport/index.php?leftmenu=accountancy_dispatch_expensereport&mainmenu=accountancy", $langs->trans("ExpenseReportsVentilation"), 1, $user->hasRight('accounting', 'bind', 'write'), '', $mainmenu, 'dispatch_expensereport'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_dispatch_expensereport/', $leftmenu)) { - $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->rights->accounting->bind->write); - $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->rights->accounting->bind->write); + $newmenu->add("/accountancy/expensereport/list.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("ToBind"), 2, $user->hasRight('accounting', 'bind', 'write')); + $newmenu->add("/accountancy/expensereport/lines.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport", $langs->trans("Binded"), 2, $user->hasRight('accounting', 'bind', 'write')); } } // Journals - if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { - $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', '', ''); + if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') { + $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', '', ''); // Multi journal $sql = "SELECT rowid, code, label, nature"; @@ -1714,13 +1714,13 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if ($nature) { $langs->load('accountancy'); $journallabel = $langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... - $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->hasRight('accounting', 'comptarapport', 'lire')); } $i++; } } else { // Should not happend. Entries are added - $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); } } else { dol_print_error($db); @@ -1730,80 +1730,80 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef // Files if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire); + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); } // Accounting - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire || $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->hasRight('accounting', 'mouvements', 'lire') || $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); // General Ledger - $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->rights->accounting->mouvements->lire); + $newmenu->add("/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Bookkeeping"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); // Journals - $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->rights->accounting->mouvements->lire); + $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("Journals"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); // Account Balance - $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire); + $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->hasRight('accounting', 'mouvements', 'lire')); // Closure - $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure'); + $newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->hasRight('accounting', 'fiscalyear', 'write'), '', $mainmenu, 'closure'); // Reports - $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'ca'); + $newmenu->add("/accountancy/index.php?leftmenu=accountancy_report", $langs->trans("Reportings"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', $mainmenu, 'ca'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report", $langs->trans("MenuReportInOut"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report", $langs->trans("ByPredefinedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report", $langs->trans("ByPersonalizedAccountGroups"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); } $modecompta = 'CREANCES-DETTES'; - if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') { $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED } if ($modecompta) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); } } $modecompta = 'RECETTES-DEPENSES'; - //if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + //if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED if ($modecompta) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->rights->accounting->comptarapport->lire); - //$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); - //$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + //$newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->hasRight('accounting', 'comptarapport', 'lire')); + //$newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->hasRight('accounting', 'comptarapport', 'lire')); } } $modecompta = 'CREANCES-DETTES'; - if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') { $modecompta = 'BOOKKEEPING'; // Not yet implemented. } if ($modecompta && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); } } $modecompta = 'RECETTES-DEPENSES'; - if (isModEnabled('accounting') && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') { $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented. } if ($modecompta && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->rights->accounting->comptarapport->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->rights->accounting->comptarapport->lire); + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 3, $user->hasRight('accounting', 'comptarapport', 'lire')); } } } @@ -1812,79 +1812,79 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef if (isModEnabled('comptabilite')) { // Files if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) { - $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'files', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 0, $user->hasRight('compta', 'resultat', 'lire'), '', $mainmenu, 'files', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); } // Bilan, resultats - $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->rights->compta->resultat->lire, '', $mainmenu, 'ca', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/resultat/index.php?leftmenu=report&mainmenu=accountancy", $langs->trans("Reportings"), 0, $user->hasRight('compta', 'resultat', 'lire'), '', $mainmenu, 'ca', 0, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/report/', $leftmenu)) { - $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/resultat/index.php?leftmenu=report", $langs->trans("MenuReportInOut"), 1, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=report", $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); /* On verra ca avec module compabilite expert - $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/resultat/compteres.php?leftmenu=report","Compte de resultat",2,$user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/resultat/bilan.php?leftmenu=report","Bilan",2,$user->hasRight('compta', 'resultat', 'lire')); */ /* - $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/cumul.php?leftmenu=report","Cumule",2,$user->hasRight('compta', 'resultat', 'lire')); if (isModEnabled('propal')) { - $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/prev.php?leftmenu=report","Previsionnel",2,$user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/comp.php?leftmenu=report","Transforme",2,$user->hasRight('compta', 'resultat', 'lire')); } */ $modecompta = 'CREANCES-DETTES'; - $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/index.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ReportTurnover"), 1, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/casoc.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/byratecountry.php?leftmenu=report&modecompta=".$modecompta, $langs->trans("ByVatRate"), 2, $user->hasRight('compta', 'resultat', 'lire')); $modecompta = 'RECETTES-DEPENSES'; - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 1, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire')); //Achats $modecompta = 'CREANCES-DETTES'; - $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/supplier_turnover.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnover"), 1, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_thirdparty.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/supplier_turnover_by_prodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"), 2, $user->hasRight('compta', 'resultat', 'lire')); /* $modecompta = 'RECETTES-DEPENSES'; - $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->rights->compta->resultat->lire); - $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->rights->compta->resultat->lire); + $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportPurchaseTurnoverCollected"), 1, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByCompanies"), 2, $user->hasRight('compta', 'resultat', 'lire')); + $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByUsers"), 2, $user->hasRight('compta', 'resultat', 'lire')); */ // Journals - $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 50); - $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->rights->compta->resultat->lire, '', '', '', 51); + $newmenu->add("/compta/journal/sellsjournal.php?leftmenu=report", $langs->trans("SellsJournal"), 1, $user->hasRight('compta', 'resultat', 'lire'), '', '', '', 50); + $newmenu->add("/compta/journal/purchasesjournal.php?leftmenu=report", $langs->trans("PurchasesJournal"), 1, $user->hasRight('compta', 'resultat', 'lire'), '', '', '', 51); } - //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->rights->compta->resultat->lire||$user->rights->accounting->comptarapport->lire); + //if ($leftmenu=="ca") $newmenu->add("/compta/journaux/index.php?leftmenu=ca",$langs->trans("Journals"),1,$user->hasRight('compta', 'resultat', 'lire')||$user->hasRight('accounting', 'comptarapport', 'lire')); } // Intracomm report if (isModEnabled('intracommreport')) { - $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReport"), 0, $user->hasRight('intracommreport', 'read'), '', $mainmenu, 'intracommreport', 60, '', '', '', img_picto('', 'intracommreport', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || preg_match('/intracommreport/', $leftmenu)) { // DEB / DES - $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->rights->intracommreport->write, '', $mainmenu, 'intracommreport', 1); - $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->rights->intracommreport->read, '', $mainmenu, 'intracommreport', 1); + $newmenu->add("/intracommreport/card.php?action=create&leftmenu=intracommreport", $langs->trans("MenuIntracommReportNew"), 1, $user->hasRight('intracommreport', 'write'), '', $mainmenu, 'intracommreport', 1); + $newmenu->add("/intracommreport/list.php?leftmenu=intracommreport", $langs->trans("MenuIntracommReportList"), 1, $user->hasRight('intracommreport', 'read'), '', $mainmenu, 'intracommreport', 1); } } // Assets if (isModEnabled('asset')) { - $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->rights->asset->read, '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->rights->asset->write); - $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read)), '', $mainmenu, 'asset_model'); + $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->hasRight('asset', 'read'), '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->hasRight('asset', 'write')); + $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->hasRight('asset', 'read')); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->hasRight('asset', 'model_advance', 'read'))), '', $mainmenu, 'asset_model'); if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) { - $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->write))); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->read) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->asset->model_advance->read))); + $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->hasRight('asset', 'model_advance', 'write')))); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->hasRight('asset', 'model_advance', 'read')))); } } } @@ -1910,56 +1910,56 @@ function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = // Bank-Cash account if (isModEnabled('banque')) { - $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->rights->banque->lire, '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("MenuBankCash"), 0, $user->hasRight('banque', 'lire'), '', $mainmenu, 'bank', 0, '', '', '', img_picto('', 'bank_account', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->rights->banque->configurer); - $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->lire, '', $mainmenu, 'bank'); - $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->rights->banque->lire); - $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->rights->banque->lire); + $newmenu->add("/compta/bank/card.php?action=create", $langs->trans("MenuNewFinancialAccount"), 1, $user->hasRight('banque', 'configurer')); + $newmenu->add("/compta/bank/list.php?leftmenu=bank&mainmenu=bank", $langs->trans("List"), 1, $user->hasRight('banque', 'lire'), '', $mainmenu, 'bank'); + $newmenu->add("/compta/bank/bankentries_list.php", $langs->trans("ListTransactions"), 1, $user->hasRight('banque', 'lire')); + $newmenu->add("/compta/bank/budget.php", $langs->trans("ListTransactionsByCategory"), 1, $user->hasRight('banque', 'lire')); - $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->rights->banque->transfer); + $newmenu->add("/compta/bank/transfer.php", $langs->trans("MenuBankInternalTransfer"), 1, $user->hasRight('banque', 'transfer')); } if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->rights->categorie->creer, '', $mainmenu, 'tags'); - $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->rights->banque->configurer, '', $mainmenu, 'tags'); + $newmenu->add("/categories/index.php?type=5", $langs->trans("Rubriques"), 1, $user->hasRight('categorie', 'creer'), '', $mainmenu, 'tags'); + $newmenu->add("/compta/bank/categ.php", $langs->trans("RubriquesTransactions"), 1, $user->hasRight('banque', 'configurer'), '', $mainmenu, 'tags'); } // Direct debit order if (isModEnabled('prelevement')) { - $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->rights->prelevement->bons->lire, '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank", $langs->trans("PaymentByDirectDebit"), 0, $user->hasRight('prelevement', 'bons', 'lire'), '', $mainmenu, 'withdraw', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "withdraw") { - $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->rights->prelevement->bons->creer); + $newmenu->add("/compta/prelevement/create.php?mainmenu=bank", $langs->trans("NewStandingOrder"), 1, $user->hasRight('prelevement', 'bons', 'creer')); - $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->prelevement->bons->lire); - $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->prelevement->bons->lire); + $newmenu->add("/compta/prelevement/orders_list.php?mainmenu=bank", $langs->trans("WithdrawalsReceipts"), 1, $user->hasRight('prelevement', 'bons', 'lire')); + $newmenu->add("/compta/prelevement/list.php?mainmenu=bank", $langs->trans("WithdrawalsLines"), 1, $user->hasRight('prelevement', 'bons', 'lire')); + $newmenu->add("/compta/prelevement/rejets.php?mainmenu=bank", $langs->trans("Rejects"), 1, $user->hasRight('prelevement', 'bons', 'lire')); + $newmenu->add("/compta/prelevement/stats.php?mainmenu=bank", $langs->trans("Statistics"), 1, $user->hasRight('prelevement', 'bons', 'lire')); } } // Bank transfer order if (isModEnabled('paymentbybanktransfer')) { - $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->rights->paymentbybanktransfer->read, '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/paymentbybanktransfer/index.php?leftmenu=banktransfer&mainmenu=bank", $langs->trans("PaymentByBankTransfer"), 0, $user->hasRight('paymentbybanktransfer', 'read'), '', $mainmenu, 'banktransfer', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "banktransfer") { - $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->rights->paymentbybanktransfer->create); + $newmenu->add("/compta/prelevement/create.php?type=bank-transfer&mainmenu=bank", $langs->trans("NewPaymentByBankTransfer"), 1, $user->hasRight('paymentbybanktransfer', 'create')); - $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->rights->paymentbybanktransfer->read); - $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->rights->paymentbybanktransfer->read); - $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->rights->paymentbybanktransfer->read); - $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->rights->paymentbybanktransfer->read); + $newmenu->add("/compta/prelevement/orders_list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferReceipts"), 1, $user->hasRight('paymentbybanktransfer', 'read')); + $newmenu->add("/compta/prelevement/list.php?type=bank-transfer&mainmenu=bank", $langs->trans("PaymentByBankTransferLines"), 1, $user->hasRight('paymentbybanktransfer', 'read')); + $newmenu->add("/compta/prelevement/rejets.php?type=bank-transfer&mainmenu=bank", $langs->trans("Rejects"), 1, $user->hasRight('paymentbybanktransfer', 'read')); + $newmenu->add("/compta/prelevement/stats.php?type=bank-transfer&mainmenu=bank", $langs->trans("Statistics"), 1, $user->hasRight('paymentbybanktransfer', 'read')); } } // Management of checks if (empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && isModEnabled('banque') && (isModEnabled('facture') || !empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))) { - $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->rights->banque->cheque, '', $mainmenu, 'checks', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank", $langs->trans("MenuChequeDeposits"), 0, $user->hasRight('banque', 'cheque'), '', $mainmenu, 'checks', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); if (preg_match('/checks/', $leftmenu)) { - $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->rights->banque->cheque); - $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&mainmenu=bank", $langs->trans("List"), 1, $user->rights->banque->cheque); + $newmenu->add("/compta/paiement/cheque/card.php?leftmenu=checks_bis&action=new&mainmenu=bank", $langs->trans("NewChequeDeposit"), 1, $user->hasRight('banque', 'cheque')); + $newmenu->add("/compta/paiement/cheque/list.php?leftmenu=checks_bis&mainmenu=bank", $langs->trans("List"), 1, $user->hasRight('banque', 'cheque')); } } @@ -1990,88 +1990,88 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme if ($mainmenu == 'products') { // Products if (isModEnabled('product')) { - $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"')); - $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); - $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); + $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->hasRight('produit', 'lire'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="pictofixedwidth"')); + $newmenu->add("/product/card.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->hasRight('produit', 'creer')); + $newmenu->add("/product/list.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->hasRight('produit', 'lire')); if (isModEnabled('stock')) { - $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + $newmenu->add("/product/reassort.php?type=0", $langs->trans("MenuStocks"), 1, $user->hasRight('produit', 'lire') && $user->hasRight('stock', 'lire')); } if (isModEnabled('productbatch')) { $langs->load("stocks"); - $newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); - $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + $newmenu->add("/product/reassortlot.php?type=0&search_subjecttolotserial=1", $langs->trans("StocksByLotSerial"), 1, $user->hasRight('produit', 'lire') && $user->hasRight('stock', 'lire')); + $newmenu->add("/product/stock/productlot_list.php", $langs->trans("LotSerial"), 1, $user->hasRight('produit', 'lire') && $user->hasRight('stock', 'lire')); } if (isModEnabled('variants')) { - $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->rights->produit->lire); + $newmenu->add("/variants/list.php", $langs->trans("VariantAttributes"), 1, $user->hasRight('produit', 'lire')); } if (isModEnabled('propal') || (isModEnabled('commande') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('facture') || isModEnabled('fournisseur') || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire); + $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->hasRight('produit', 'lire')); } // Categories if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->hasRight('categorie', 'lire')); } } // Services if (isModEnabled('service')) { - $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"')); - $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); - $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); + $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->hasRight('service', 'lire'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="pictofixedwidth"')); + $newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->hasRight('service', 'creer')); + $newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->hasRight('service', 'lire')); if (isModEnabled('propal') || isModEnabled('commande') || isModEnabled('facture') || (isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_proposal') || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) { - $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire); + $newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->hasRight('service', 'lire')); } // Categories if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); + $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); + //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->hasRight('categorie', 'lire')); } } // Warehouse if (isModEnabled('stock')) { $langs->load("stocks"); - $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"')); - $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->rights->stock->creer); - $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); - $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->rights->stock->mouvement->lire); + $newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"')); + $newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->hasRight('stock', 'creer')); + $newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->hasRight('stock', 'lire')); + $newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->hasRight('stock', 'mouvement', 'lire')); - $newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->rights->stock->mouvement->creer); + $newmenu->add("/product/stock/massstockmove.php", $langs->trans("MassStockTransferShort"), 1, $user->hasRight('stock', 'mouvement', 'creer')); if (isModEnabled('supplier_order')) { - $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire); + $newmenu->add("/product/stock/replenish.php", $langs->trans("Replenishment"), 1, $user->hasRight('stock', 'mouvement', 'creer') && $user->hasRight('fournisseur', 'lire')); } - $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->rights->produit->lire && $user->rights->stock->lire); + $newmenu->add("/product/stock/stockatdate.php", $langs->trans("StockAtDate"), 1, $user->hasRight('produit', 'lire') && $user->hasRight('stock', 'lire')); // Categories for warehouses if (isModEnabled('categorie')) { - $newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=stock&type=9", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } } if (isModEnabled('stocktransfer')) { - $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans("ModuleStockTransferName"), 0, $user->rights->stocktransfer->stocktransfer->read, '', $mainmenu, 'stocktransfer', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"')); - $newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->rights->stocktransfer->stocktransfer->write); - $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->rights->stocktransfer->stocktransfer->read); + $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans("ModuleStockTransferName"), 0, $user->hasRight('stocktransfer', 'stocktransfer', 'read'), '', $mainmenu, 'stocktransfer', 0, '', '', '', img_picto('', 'stock', 'class="pictofixedwidth"')); + $newmenu->add('/product/stock/stocktransfer/stocktransfer_card.php?action=create', $langs->trans('StockTransferNew'), 1, $user->hasRight('stocktransfer', 'stocktransfer', 'write')); + $newmenu->add('/product/stock/stocktransfer/stocktransfer_list.php', $langs->trans('List'), 1, $user->hasRight('stocktransfer', 'stocktransfer', 'read')); } // Inventory if (isModEnabled('stock')) { $langs->load("stocks"); if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->creer); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->lire); + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->hasRight('stock', 'creer')); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->hasRight('stock', 'lire')); } } else { - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("Inventories"), 0, $user->hasRight('stock', 'inventory_advance', 'read'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'inventory', 'class="pictofixedwidth"')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "stock_inventories") { - $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write); - $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read); + $newmenu->add("/product/inventory/card.php?action=create&leftmenu=stock_inventories", $langs->trans("NewInventory"), 1, $user->hasRight('stock', 'inventory_advance', 'write')); + $newmenu->add("/product/inventory/list.php?leftmenu=stock_inventories", $langs->trans("List"), 1, $user->hasRight('stock', 'inventory_advance', 'read')); } } } @@ -2079,33 +2079,33 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme // Shipments if (isModEnabled('expedition')) { $langs->load("sendings"); - $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->rights->expedition->lire, '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="pictofixedwidth"')); - $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); - $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); + $newmenu->add("/expedition/index.php?leftmenu=sendings", $langs->trans("Shipments"), 0, $user->hasRight('expedition', 'lire'), '', $mainmenu, 'sendings', 0, '', '', '', img_picto('', 'shipment', 'class="pictofixedwidth"')); + $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->hasRight('expedition', 'creer')); + $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->hasRight('expedition', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") { - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->rights->expedition->lire); - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->rights->expedition->lire); - $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->rights->expedition->lire); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->hasRight('expedition', 'lire')); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->hasRight('expedition', 'lire')); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->hasRight('expedition', 'lire')); } - $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire); + $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->hasRight('expedition', 'lire')); } // Receptions if (isModEnabled('reception')) { $langs->load("receptions"); - $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth"')); - $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer); - $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->rights->reception->lire); + $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->hasRight('reception', 'lire'), '', $mainmenu, 'receptions', 0, '', '', '', img_picto('', 'dollyrevert', 'class="pictofixedwidth"')); + $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->hasRight('reception', 'creer')); + $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->hasRight('reception', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire); + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->hasRight('reception', 'lire')); } if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire); + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->hasRight('reception', 'lire')); } if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") { - $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire); + $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->hasRight('reception', 'lire')); } - $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire); + $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->hasRight('reception', 'lire')); } } } @@ -2129,17 +2129,17 @@ function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = if (isModEnabled('bom') || isModEnabled('mrp')) { $langs->load("mrp"); - $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->rights->bom->read, '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->rights->bom->write, '', $mainmenu, 'bom'); - $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->rights->bom->read, '', $mainmenu, 'bom'); + $newmenu->add("", $langs->trans("MenuBOM"), 0, $user->hasRight('bom', 'read'), '', $mainmenu, 'bom', 0, '', '', '', img_picto('', 'bom', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/bom/bom_card.php?leftmenu=bom&action=create", $langs->trans("NewBOM"), 1, $user->hasRight('bom', 'write'), '', $mainmenu, 'bom'); + $newmenu->add("/bom/bom_list.php?leftmenu=bom", $langs->trans("List"), 1, $user->hasRight('bom', 'read'), '', $mainmenu, 'bom'); } if (isModEnabled('mrp')) { $langs->load("mrp"); - $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->rights->mrp->read, '', $mainmenu, 'mo', 0, '', '', '', img_picto('', 'mrp', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/mrp/mo_card.php?leftmenu=mo&action=create", $langs->trans("NewMO"), 1, $user->rights->mrp->write, '', $mainmenu, 'mo'); - $newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->rights->mrp->read, '', $mainmenu, 'mo'); + $newmenu->add("", $langs->trans("MenuMRP"), 0, $user->hasRight('mrp', 'read'), '', $mainmenu, 'mo', 0, '', '', '', img_picto('', 'mrp', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/mrp/mo_card.php?leftmenu=mo&action=create", $langs->trans("NewMO"), 1, $user->hasRight('mrp', 'write'), '', $mainmenu, 'mo'); + $newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->hasRight('mrp', 'read'), '', $mainmenu, 'mo'); } } } @@ -2166,7 +2166,7 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme $tmpentry = array( 'enabled'=>(isModEnabled('projet')), - 'perms'=>(!empty($user->rights->projet->lire)), + 'perms'=>(!empty($user->hasRight('projet', 'lire'))), 'module'=>'projet' ); $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); @@ -2184,8 +2184,8 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme } // Project assigned to user - $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->rights->projet->lire, '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->rights->projet->creer); + $newmenu->add("/projet/index.php?leftmenu=projects".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titleboth, 0, $user->hasRight('projet', 'lire'), '', $mainmenu, 'projects', 0, '', '', '', img_picto('', 'project', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/projet/card.php?leftmenu=projects&action=create".($search_project_user ? '&search_project_user='.$search_project_user : ''), $titlenew, 1, $user->hasRight('projet', 'creer')); if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : '').'&search_status=99', $langs->trans("List"), 1, $showmode, '', 'project', 'list'); @@ -2197,23 +2197,23 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); } - $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->hasRight('projet', 'lire')); // Categories if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=cat&type=6", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'lire'), '', $mainmenu, 'cat'); } if (empty($conf->global->PROJECT_HIDE_TASKS)) { // Project affected to user - $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->rights->projet->lire, '', 'project', 'tasks', 0, '', '', '', img_picto('', 'projecttask', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->rights->projet->creer); - $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire); - $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/activity/index.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("Activities"), 0, $user->hasRight('projet', 'lire'), '', 'project', 'tasks', 0, '', '', '', img_picto('', 'projecttask', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/projet/tasks.php?leftmenu=tasks&action=create", $langs->trans("NewTask"), 1, $user->hasRight('projet', 'creer')); + $newmenu->add("/projet/tasks/list.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->hasRight('projet', 'lire')); + $newmenu->add("/projet/tasks/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->hasRight('projet', 'lire')); - $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/projet/tasks/time.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->rights->projet->lire); + $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->hasRight('projet', 'lire'), '', 'project', 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/projet/tasks/time.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $user->hasRight('projet', 'lire')); } } } @@ -2238,32 +2238,32 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = if (isModEnabled('hrm')) { $langs->load("hrm"); - $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->rights->user->user->lire, '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->rights->user->user->creer); - $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->rights->user->user->lire); + $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee", $langs->trans("Employees"), 0, $user->hasRight('user', 'user', 'read'), '', $mainmenu, 'hrm', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/user/card.php?mainmenu=hrm&leftmenu=hrm&action=create&employee=1", $langs->trans("NewEmployee"), 1, $user->hasRight('user', 'user', 'write')); + $newmenu->add("/user/list.php?mainmenu=hrm&leftmenu=hrm&mode=employee&contextpage=employeelist", $langs->trans("List"), 1, $user->hasRight('user', 'user', 'read')); - $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillsManagement"), 0, $user->hasRight('hrm', 'all', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="paddingright pictofixedwidth"')); // Skills - $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Skills"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="paddingright pictofixedwidth"')); - //$newmenu->add("/hrm/skill_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewSkill"), 1, $user->rights->hrm->all->write); - //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); + $newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Skills"), 1, $user->hasRight('hrm', 'all', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'shapes', 'class="paddingright pictofixedwidth"')); + //$newmenu->add("/hrm/skill_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewSkill"), 1, $user->hasRight('hrm', 'all', 'write')); + //$newmenu->add("/hrm/skill_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read')); // Job (Description of work to do and skills required) - $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsPosition"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - //$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->rights->hrm->all->write); - //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); + $newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("JobsPosition"), 1, $user->hasRight('hrm', 'all', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + //$newmenu->add("/hrm/job_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Job")), 1, $user->hasRight('hrm', 'all', 'write')); + //$newmenu->add("/hrm/job_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read')); // Position = Link job - user - $newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("EmployeePositions"), 1, $user->rights->hrm->all->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user-cog', 'class="paddingright pictofixedwidth"')); - //$newmenu->add("/hrm/position.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Position")), 1, $user->rights->hrm->all->write); - //$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->all->read); + $newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("EmployeePositions"), 1, $user->hasRight('hrm', 'all', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user-cog', 'class="paddingright pictofixedwidth"')); + //$newmenu->add("/hrm/position.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->transnoentities("NewObject", $langs->trans("Position")), 1, $user->hasRight('hrm', 'all', 'write')); + //$newmenu->add("/hrm/position_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'all', 'read')); // Evaluation - $newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Evals"), 1, $user->rights->hrm->evaluation->read, '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); - //$newmenu->add("/hrm/evaluation_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewEval"), 1, $user->rights->hrm->evaluation->write); - //$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->rights->hrm->evaluation->read); - $newmenu->add("/hrm/compare.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillComparison"), 1, $user->rights->hrm->evaluation->read || $user->rights->hrm->compare_advance->read); + $newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("Evals"), 1, $user->hasRight('hrm', 'evaluation', 'read'), '', $mainmenu, 'hrm_sm', 0, '', '', '', img_picto('', 'user', 'class="paddingright pictofixedwidth"')); + //$newmenu->add("/hrm/evaluation_card.php?mainmenu=hrm&leftmenu=hrm_sm&action=create", $langs->trans("NewEval"), 1, $user->hasRight('hrm', 'evaluation', 'write')); + //$newmenu->add("/hrm/evaluation_list.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("List"), 1, $user->hasRight('hrm', 'evaluation', 'read')); + $newmenu->add("/hrm/compare.php?mainmenu=hrm&leftmenu=hrm_sm", $langs->trans("SkillComparison"), 1, $user->hasRight('hrm', 'evaluation', 'read') || $user->hasRight('hrm', 'compare_advance', 'read')); } // Leave/Holiday/Vacation module @@ -2271,47 +2271,47 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = // Load translation files required by the page $langs->loadLangs(array("holiday", "trips")); - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("CPTitreMenu"), 0, $user->rights->holiday->read, '', $mainmenu, 'holiday', 0, '', '', '', img_picto('', 'holiday', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->rights->holiday->write, '', $mainmenu); - $newmenu->add("/holiday/card_group.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("NewHolidayForGroup"), 1, ($user->rights->holiday->writeall && $user->rights->holiday->readall), '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1, $user->rights->holiday->read, '', $mainmenu); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("CPTitreMenu"), 0, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday', 0, '', '', '', img_picto('', 'holiday', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/holiday/card.php?mainmenu=hrm&leftmenu=holiday&action=create", $langs->trans("New"), 1, $user->hasRight('holiday', 'write'), '', $mainmenu); + $newmenu->add("/holiday/card_group.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("NewHolidayForGroup"), 1, ($user->hasRight('holiday', 'writeall') && $user->hasRight('holiday', 'readall')), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("List"), 1, $user->hasRight('holiday', 'read'), '', $mainmenu); if ($usemenuhider || empty($leftmenu) || $leftmenu == "holiday") { - $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=1&mainmenu=hrm&leftmenu=holiday", $langs->trans("DraftCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=2&mainmenu=hrm&leftmenu=holiday", $langs->trans("ToReviewCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=3&mainmenu=hrm&leftmenu=holiday", $langs->trans("ApprovedCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=4&mainmenu=hrm&leftmenu=holiday", $langs->trans("CancelCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/list.php?search_status=5&mainmenu=hrm&leftmenu=holiday", $langs->trans("RefuseCP"), 2, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); } - $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read, '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall, '', $mainmenu, 'holiday_sm'); - $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday, '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->hasRight('holiday', 'read'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->hasRight('holiday', 'readall'), '', $mainmenu, 'holiday_sm'); + $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->hasRight('holiday', 'define_holiday'), '', $mainmenu, 'holiday_sm'); } // Trips and expenses (old module) if (isModEnabled('deplacement')) { $langs->load("trips"); - $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->deplacement->lire, '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->deplacement->creer); - $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->deplacement->lire); - $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->deplacement->lire); + $newmenu->add("/compta/deplacement/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->hasRight('deplacement', 'lire'), '', $mainmenu, 'tripsandexpenses', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("New"), 1, $user->hasRight('deplacement', 'creer')); + $newmenu->add("/compta/deplacement/list.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("List"), 1, $user->hasRight('deplacement', 'lire')); + $newmenu->add("/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->hasRight('deplacement', 'lire')); } // Expense report if (isModEnabled('expensereport')) { $langs->loadLangs(array("trips", "bills")); - $newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->rights->expensereport->lire, '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->rights->expensereport->creer); - $newmenu->add("/expensereport/list.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("List"), 1, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("TripsAndExpenses"), 0, $user->hasRight('expensereport', 'lire'), '', $mainmenu, 'expensereport', 0, '', '', '', img_picto('', 'trip', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/expensereport/card.php?action=create&leftmenu=expensereport&mainmenu=hrm", $langs->trans("New"), 1, $user->hasRight('expensereport', 'creer')); + $newmenu->add("/expensereport/list.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("List"), 1, $user->hasRight('expensereport', 'lire')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "expensereport") { - $newmenu->add("/expensereport/list.php?search_status=0&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Draft"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=2&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Validated"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=5&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Approved"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=6&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Paid"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=4&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Canceled"), 2, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/list.php?search_status=99&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Refused"), 2, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/list.php?search_status=0&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Draft"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=2&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Validated"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=5&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Approved"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=6&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Paid"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=4&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Canceled"), 2, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/list.php?search_status=99&leftmenu=expensereport&mainmenu=hrm", $langs->trans("Refused"), 2, $user->hasRight('expensereport', 'lire')); } - $newmenu->add("/expensereport/payment/list.php?leftmenu=expensereport_payments&mainmenu=hrm", $langs->trans("Payments"), 1, $user->rights->expensereport->lire); - $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->rights->expensereport->lire); + $newmenu->add("/expensereport/payment/list.php?leftmenu=expensereport_payments&mainmenu=hrm", $langs->trans("Payments"), 1, $user->hasRight('expensereport', 'lire')); + $newmenu->add("/expensereport/stats/index.php?leftmenu=expensereport&mainmenu=hrm", $langs->trans("Statistics"), 1, $user->hasRight('expensereport', 'lire')); } if (isModEnabled('projet')) { @@ -2320,7 +2320,7 @@ function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = $search_project_user = GETPOST('search_project_user', 'int'); - $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->rights->projet->lire, '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/projet/activity/perweek.php?leftmenu=tasks".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("NewTimeSpent"), 0, $user->hasRight('projet', 'lire'), '', $mainmenu, 'timespent', 0, '', '', '', img_picto('', 'timespent', 'class="paddingright pictofixedwidth"')); } } } @@ -2348,22 +2348,22 @@ function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu } if (isModEnabled('mailing')) { - $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->rights->mailing->lire, '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->rights->mailing->creer); - $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->rights->mailing->lire); + $newmenu->add("/comm/mailing/index.php?leftmenu=mailing", $langs->trans("EMailings"), 0, $user->hasRight('mailing', 'lire'), '', $mainmenu, 'mailing', 0, '', '', '', img_picto('', 'email', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/comm/mailing/card.php?leftmenu=mailing&action=create", $langs->trans("NewMailing"), 1, $user->hasRight('mailing', 'creer')); + $newmenu->add("/comm/mailing/list.php?leftmenu=mailing", $langs->trans("List"), 1, $user->hasRight('mailing', 'lire')); } if (isModEnabled('export')) { $langs->load("exports"); - $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->rights->export->lire, '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->rights->export->creer); - //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->rights->export->lire); + $newmenu->add("/exports/index.php?leftmenu=export", $langs->trans("FormatedExport"), 0, $user->hasRight('export', 'lire'), '', $mainmenu, 'export', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/exports/export.php?leftmenu=export", $langs->trans("NewExport"), 1, $user->hasRight('export', 'creer')); + //$newmenu->add("/exports/export.php?leftmenu=export",$langs->trans("List"),1, $user->hasRight('export', 'lire')); } if (isModEnabled('import')) { $langs->load("exports"); - $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->rights->import->run, '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run); + $newmenu->add("/imports/index.php?leftmenu=import", $langs->trans("FormatedImport"), 0, $user->hasRight('import', 'run'), '', $mainmenu, 'import', 0, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->hasRight('import', 'run')); } } } @@ -2387,39 +2387,39 @@ function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmen // Load translation files required by the page $langs->loadLangs(array("members", "compta")); - $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Members"), 0, $user->rights->adherent->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'member', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/adherents/card.php?leftmenu=members&action=create", $langs->trans("NewMember"), 1, $user->rights->adherent->creer); - $newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1", $langs->trans("MenuMembersValidated"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=withoutsubscription", $langs->trans("WithoutSubscription"), 3, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate", $langs->trans("UpToDate"), 3, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate", $langs->trans("OutOfDate"), 3, $user->rights->adherent->lire); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->rights->adherent->lire); - $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); + $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Members"), 0, $user->hasRight('adherent', 'read'), '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'member', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/adherents/card.php?leftmenu=members&action=create", $langs->trans("NewMember"), 1, $user->hasRight('adherent', 'write')); + $newmenu->add("/adherents/list.php?leftmenu=members", $langs->trans("List"), 1, $user->hasRight('adherent', 'read')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1", $langs->trans("MenuMembersToValidate"), 2, $user->hasRight('adherent', 'read')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1", $langs->trans("MenuMembersValidated"), 2, $user->hasRight('adherent', 'read')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=withoutsubscription", $langs->trans("WithoutSubscription"), 3, $user->hasRight('adherent', 'read')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=uptodate", $langs->trans("UpToDate"), 3, $user->hasRight('adherent', 'read')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=1&filter=outofdate", $langs->trans("OutOfDate"), 3, $user->hasRight('adherent', 'read')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=0", $langs->trans("MenuMembersResiliated"), 2, $user->hasRight('adherent', 'read')); + $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->hasRight('adherent', 'read')); - $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->rights->adherent->export); + $newmenu->add("/adherents/cartes/carte.php?leftmenu=export", $langs->trans("MembersCards"), 1, $user->hasRight('adherent', 'export')); if (!empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && ($usemenuhider || empty($leftmenu) || $leftmenu == 'none' || $leftmenu == "members" || $leftmenu == "export")) { - $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->rights->adherent->export); + $newmenu->add("/adherents/htpasswd.php?leftmenu=export", $langs->trans("Filehtpasswd"), 1, $user->hasRight('adherent', 'export')); } if (isModEnabled('categorie')) { $langs->load("categories"); - $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 1, $user->hasRight('categorie', 'read'), '', $mainmenu, 'cat'); } - $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Subscriptions"), 0, $user->rights->adherent->cotisation->lire, '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1,1&mainmenu=members", $langs->trans("NewSubscription"), 1, $user->rights->adherent->cotisation->creer); - $newmenu->add("/adherents/subscription/list.php?leftmenu=members", $langs->trans("List"), 1, $user->rights->adherent->cotisation->lire); - $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->rights->adherent->lire); + $newmenu->add("/adherents/index.php?leftmenu=members&mainmenu=members", $langs->trans("Subscriptions"), 0, $user->hasRight('adherent', 'cotisation', 'read'), '', $mainmenu, 'members', 0, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/adherents/list.php?leftmenu=members&statut=-1,1&mainmenu=members", $langs->trans("NewSubscription"), 1, $user->hasRight('adherent', 'cotisation', 'write')); + $newmenu->add("/adherents/subscription/list.php?leftmenu=members", $langs->trans("List"), 1, $user->hasRight('adherent', 'cotisation', 'read')); + $newmenu->add("/adherents/stats/index.php?leftmenu=members", $langs->trans("MenuMembersStats"), 1, $user->hasRight('adherent', 'read')); - //$newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Tools"),0,$user->rights->adherent->export, '', $mainmenu, 'export'); - //if (isModEnabled('export') && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->rights->adherent->export); + //$newmenu->add("/adherents/index.php?leftmenu=export&mainmenu=members",$langs->trans("Tools"),0,$user->hasRight('adherent', 'export'), '', $mainmenu, 'export'); + //if (isModEnabled('export') && ($usemenuhider || empty($leftmenu) || $leftmenu=="export")) $newmenu->add("/exports/index.php?leftmenu=export",$langs->trans("Datas"),1,$user->hasRight('adherent', 'export')); // Type - $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("MembersTypes"), 0, $user->rights->adherent->configurer, '', $mainmenu, 'setup', 0, '', '', '', img_picto('', 'members', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members&action=create", $langs->trans("New"), 1, $user->rights->adherent->configurer); - $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer); + $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("MembersTypes"), 0, $user->hasRight('adherent', 'configurer'), '', $mainmenu, 'setup', 0, '', '', '', img_picto('', 'members', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members&action=create", $langs->trans("New"), 1, $user->hasRight('adherent', 'configurer')); + $newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("List"), 1, $user->hasRight('adherent', 'configurer')); } } } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index d4d2c3fff36..521695b45f2 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -209,9 +209,9 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Holiday'; $objectlabel = 'Holiday'; - $permissiontoread = $user->rights->holiday->read; - $permissiontodelete = $user->rights->holiday->delete; - $permissiontoapprove = $user->rights->holiday->approve; + $permissiontoread = $user->hasRight('holiday', 'read'); + $permissiontodelete = $user->hasRight('holiday', 'delete'); + $permissiontoapprove = $user->hasRight('holiday', 'approve'); $uploaddir = $conf->holiday->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -580,7 +580,7 @@ if ($resql) { // Approver if (!empty($arrayfields['cp.fk_validator']['checked'])) { - if ($user->rights->holiday->readall) { + if ($user->hasRight('holiday', 'readall')) { print '\n"; $totalbuyingprice = 0; +$totalcurrentstock = 0; +$totalvirtualstock = 0; $i = 0; while ($i < ($limit ? min($num, $limit) : $num)) { @@ -550,6 +552,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { if ($mode == 'future') { // Current stock print ''; + $totalcurrentstock += $currentstock; print ''; @@ -558,6 +561,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Final virtual stock print ''; + $totalvirtualstock += $virtualstock; } else { // Stock at date print ''; @@ -591,6 +595,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Current stock print ''; + $totalcurrentstock += $currentstock; } // Action @@ -619,8 +624,23 @@ if ($mode == 'future') { if (empty($date) || !$dateIsValid) { print ''; } else { - print ''; - print ''; + print ''; + print ''; + print ''; + if ($mode == 'future') { + print ''; + print ''; + print ''; + print ''; + } else { + print ''; + print ''; + print ''; + print ''; + print ''; + } + print ''; + print ''; } print '
'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''.$langs->trans('RefSupplier').''.$langs->trans('Date').''.$langs->trans('DateMaxPayment').''.$langs->trans('Currency').''.$langs->trans('MulticurrencyAmountTTC').''.$langs->trans('MulticurrencyAlreadyPaid').''.$objp->multicurrency_code."
'.$langs->trans('TotalTTC').':   
'.$langs->trans("Currency").''; @@ -973,7 +973,7 @@ END; } print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("PriceQtyMinHT", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print_liste_field_titre("PriceQtyMinHTCurrency", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); } if (!empty($arrayfields['pfp.unitprice']['checked'])) { @@ -982,7 +982,7 @@ END; if (!empty($arrayfields['pfp.multicurrency_unitprice']['checked'])) { print_liste_field_titre("UnitPriceHTCurrency", $_SERVER["PHP_SELF"], "pfp.multicurrency_unitprice", "", $param, '', $sortfield, $sortorder, 'right '); } - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print_liste_field_titre("Currency", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } print_liste_field_titre("DiscountQtyMin", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); @@ -1089,7 +1089,7 @@ END; print $productfourn->fourn_price ? ''.price($productfourn->fourn_price).'' : ""; print ''; print $productfourn->fourn_multicurrency_price ? ''.price($productfourn->fourn_multicurrency_price).'' : ""; @@ -1112,7 +1112,7 @@ END; } // Currency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''; print $productfourn->fourn_multicurrency_code ? currency_name($productfourn->fourn_multicurrency_code) : ''; print '
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print ''.$langs->trans("Currency".$object->multicurrency_code).'
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; @@ -2002,7 +2002,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // We set multicurrency_code if enabled - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $object->multicurrency_code = GETPOST('multicurrency_code') ? GETPOST('multicurrency_code') : $object->multicurrency_code; } } @@ -2439,7 +2439,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'.$form->editfieldkey('Capital', 'capital', '', $object, 0).' '.$langs->trans("Currency".$object->multicurrency_code).'
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; @@ -2930,7 +2930,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Capital print '
'.$langs->trans('Capital').''; if ($object->capital) { - if (!empty($conf->multicurrency->enabled) && !empty($object->multicurrency_code)) { + if (isModEnabled("multicurrency") && !empty($object->multicurrency_code)) { print price($object->capital, '', $langs, 0, -1, -1, $object->multicurrency_code); } else { print price($object->capital, '', $langs, 0, -1, -1, $conf->currency); @@ -2971,7 +2971,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5228f0ccac2..b7270037a09 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -307,7 +307,7 @@ if (empty($reshook)) { $object->origin_id = GETPOST('originid'); // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); } @@ -1190,7 +1190,7 @@ if ($action == 'create') { $objectsrc->fetch_optionals(); $object->array_options = $objectsrc->array_options; - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { if (!empty($objectsrc->multicurrency_code)) { $currency_code = $objectsrc->multicurrency_code; } @@ -1201,7 +1201,7 @@ if ($action == 'create') { } else { $cond_reglement_id = $soc->cond_reglement_supplier_id; $mode_reglement_id = $soc->mode_reglement_supplier_id; - if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) { + if (isModEnabled("multicurrency") && !empty($soc->multicurrency_code)) { $currency_code = $soc->multicurrency_code; } } @@ -1334,7 +1334,7 @@ if ($action == 'create') { } // Multicurrency - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; @@ -1381,7 +1381,7 @@ if ($action == 'create') { } print '
'.$langs->trans('AmountTTC').''.price($objectsrc->total_ttc)."
'.$langs->trans('MulticurrencyAmountHT').''.price($objectsrc->multicurrency_total_ht).'
'.$langs->trans('MulticurrencyAmountVAT').''.price($objectsrc->multicurrency_total_tva)."
'.$langs->trans('MulticurrencyAmountTTC').''.price($objectsrc->multicurrency_total_ttc)."
'; @@ -1778,7 +1778,7 @@ if ($action == 'create') { print ''; - if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { + if (isModEnabled("multicurrency") && ($object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''; print ''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 24b45c992eb..276178fa2d8 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -518,7 +518,7 @@ class SupplierProposal extends CommonObject $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } - if (!empty($conf->multicurrency->enabled) && $pu_ht_devise > 0) { + if (isModEnabled("multicurrency") && $pu_ht_devise > 0) { $pu = 0; } @@ -720,7 +720,7 @@ class SupplierProposal extends CommonObject $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } - if (!empty($conf->multicurrency->enabled) && $pu_ht_devise > 0) { + if (isModEnabled("multicurrency") && $pu_ht_devise > 0) { $pu = 0; } @@ -1779,7 +1779,7 @@ class SupplierProposal extends CommonObject if (empty($ref_fourn)) { $ref_fourn = $product->ref_supplier; } - if (!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) { + if (isModEnabled("multicurrency") && !empty($product->multicurrency_code)) { list($fk_multicurrency, $multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $product->multicurrency_code); } $productsupplier->id = $product->fk_product; @@ -1842,7 +1842,7 @@ class SupplierProposal extends CommonObject $product->tva_tx, $user->id ); - if (!empty($conf->multicurrency->enabled)) { + if (isModEnabled("multicurrency")) { if (!empty($product->multicurrency_code)) { include_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; $multicurrency = new MultiCurrency($this->db); //need to fetch because empty fk_multicurrency and rate @@ -1863,7 +1863,7 @@ class SupplierProposal extends CommonObject $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_fournisseur_price '; $sql .= '(datec, fk_product, fk_soc, ref_fourn, price, quantity, unitprice, tva_tx, fk_user'; - if (!empty($conf->multicurrency->enabled) && !empty($product->multicurrency_code)) { + if (isModEnabled("multicurrency") && !empty($product->multicurrency_code)) { $sql .= ',fk_multicurrency, multicurrency_code, multicurrency_unitprice, multicurrency_price, multicurrency_tx'; } $sql .= ') VALUES ('.implode(',', $values).')'; diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 6a8ad41dbd2..3b04695da20 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -180,11 +180,11 @@ $arrayfields = array( 'sp.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'sp.total_tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'sp.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), - 'sp.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'sp.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'sp.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'sp.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), - 'sp.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1)), + 'sp.multicurrency_code'=>array('label'=>'Currency', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'sp.multicurrency_tx'=>array('label'=>'CurrencyRate', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'sp.multicurrency_total_ht'=>array('label'=>'MulticurrencyAmountHT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'sp.multicurrency_total_vat'=>array('label'=>'MulticurrencyAmountVAT', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), + 'sp.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1)), 'u.login'=>array('label'=>$langs->trans("Author"), 'checked'=>1, 'position'=>10), 'sp.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'sp.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 1e82580fac9..30d541f33af 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -74,7 +74,7 @@ class Target extends CommonObject * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...) + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...) * 'position' is the sort order of field. * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) From 013bdc5c5f6a9ca59ca8d9d2717c4130f3e66581 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2022 11:51:28 +0200 Subject: [PATCH 200/453] Update 16.0.0-17.0.0.sql --- htdocs/install/mysql/migration/16.0.0-17.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 016dc7283df..f1b18c740c5 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -143,4 +143,4 @@ CREATE TABLE llx_bank_extrafields ALTER TABLE llx_bank_extrafields ADD INDEX idx_bank_extrafields (fk_object); -ALTER TABLE llx_user RENAME COLUMN note TO note_private; +ALTER TABLE llx_user CHANGE COLUMN note note_private text; From cacad721234e0450cada25709628a257d817c94a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2022 11:53:14 +0200 Subject: [PATCH 201/453] Update note.php --- htdocs/user/note.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/note.php b/htdocs/user/note.php index 2b9e8388063..2b5a05dcd68 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -64,7 +64,7 @@ $hookmanager->initHooks(array('usercard', 'usernote', 'globalcard')); * Actions */ $parameters = array('id'=>$socid); -$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } From b2131f80dbebb4c0a7e95b20c53b301978af7ebc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2022 12:42:52 +0200 Subject: [PATCH 202/453] Doc --- htdocs/main.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index bb82b0ac7e3..f189c90da72 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -504,6 +504,8 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) { $token = dol_hash(uniqid(mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value. $_SESSION['newtoken'] = $token; dol_syslog("NEW TOKEN generated by : ".$_SERVER['PHP_SELF'], LOG_DEBUG); + // TODO Warning, if a user succeed in entering a data from a public page, he can enter a link that make a token regeneration making + // the use of the backoffice no more possible ! } } } From 7fe9784ddb184d8c7a4438fe5e2291ca5ded2273 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 3 Sep 2022 12:55:54 +0200 Subject: [PATCH 203/453] fix: better global declaration --- htdocs/bookmarks/bookmarks.lib.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 8eef3396eaa..696545f324c 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -29,9 +29,9 @@ */ function printDropdownBookmarksList() { - global $conf, $user, $db, $langs; + global $conf, $user, $db, $langs, $sortfield, $sortorder; - require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; + require_once DOL_DOCUMENT_ROOT.'/boo, kmarks/class/bookmark.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; $langs->load("bookmarks"); @@ -48,7 +48,6 @@ function printDropdownBookmarksList() } } } - global $sortfield, $sortorder; $tmpurl = ''; // No urlencode, all param $url will be urlencoded later if ($sortfield) { From d5665e220e3ed88874fce45921513ba2e57c8112 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 3 Sep 2022 13:00:24 +0200 Subject: [PATCH 204/453] fix: better global declaration --- htdocs/bookmarks/bookmarks.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 696545f324c..f983e25f1da 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -31,7 +31,7 @@ function printDropdownBookmarksList() { global $conf, $user, $db, $langs, $sortfield, $sortorder; - require_once DOL_DOCUMENT_ROOT.'/boo, kmarks/class/bookmark.class.php'; + require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; $langs->load("bookmarks"); From db966495b1b9f28a6e7c1710ec18e793106ebe86 Mon Sep 17 00:00:00 2001 From: Eric Seigne Date: Mon, 29 Aug 2022 15:57:13 +0200 Subject: [PATCH 205/453] fix #21941 call_trigger better fix #21941 : trigger nearest the code that justify its execution --- htdocs/core/ajax/onlineSign.php | 9 +++++++++ htdocs/public/onlinesign/newonlinesign.php | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 67c3c989a3a..3ec4cfa0f20 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -212,6 +212,15 @@ if ($action == "importSignature") { $db->commit(); $response = "success"; setEventMessages("PropalSigned", null, 'warnings'); + if (method_exists($object, 'call_trigger')) { + //customer is not a user !?! so could we use same user as validation ? + $user = new User($db); + $user->fetch($object->user_valid_id); + $result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user); + if ($result < 0) { + $error++; + } + } } else { $db->rollback(); $error++; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index a3ad1eaf645..1d90339a0ac 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -168,6 +168,15 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') { $message = 'refused'; setEventMessages("PropalRefused", null, 'warnings'); + if (method_exists($object, 'call_trigger')) { + //customer is not a user !?! so could we use same user as validation ? + $user = new User($db); + $user->fetch($object->user_valid_id); + $result = $object->call_trigger('PROPAL_CLOSE_REFUSED', $user); + if ($result < 0) { + $error++; + } + } } else { $db->rollback(); } @@ -459,6 +468,7 @@ if ($action == "dosign" && empty($cancel)) { print '
'; if ($message == 'refused') { print ''.$langs->trans("PropalRefused").''; + } else { print ''.$langs->trans("PropalAlreadyRefused").''; } From 8e06c988878aa83d10f8f1ad0b47f7afa3cedffc Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 3 Sep 2022 12:02:29 +0000 Subject: [PATCH 206/453] Fixing style errors. --- htdocs/public/onlinesign/newonlinesign.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 1d90339a0ac..e379853ed91 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -468,7 +468,6 @@ if ($action == "dosign" && empty($cancel)) { print '
'; if ($message == 'refused') { print ''.$langs->trans("PropalRefused").''; - } else { print ''.$langs->trans("PropalAlreadyRefused").''; } From 6c947c9f9e3bacb796edcb1a0cf77d609303366e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2022 18:00:31 +0200 Subject: [PATCH 207/453] Doc --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f189c90da72..06ff00e474f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -500,12 +500,12 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) { } if (!isset($_SESSION['newtoken']) || getDolGlobalInt('MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL')) { + // Note: Using MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL is not recommended: if a user succeed in entering a data from + // a public page with a link that make a token regeneration, it can make use of the backoffice no more possible ! // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken'] $token = dol_hash(uniqid(mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value. $_SESSION['newtoken'] = $token; dol_syslog("NEW TOKEN generated by : ".$_SERVER['PHP_SELF'], LOG_DEBUG); - // TODO Warning, if a user succeed in entering a data from a public page, he can enter a link that make a token regeneration making - // the use of the backoffice no more possible ! } } } From 6406fbdc7ebe9c310eff0229b973bc6f3680febf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2022 19:02:42 +0200 Subject: [PATCH 208/453] NEW Add a way to enter LICENSE file content in property of website --- htdocs/core/lib/website2.lib.php | 21 ++++++++ htdocs/langs/en_US/website.lang | 4 +- htdocs/website/class/website.class.php | 3 ++ htdocs/website/index.php | 70 +++++++++++++++++++++++++- 4 files changed, 94 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 58a0c6a64dd..6f532e078b3 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -533,6 +533,27 @@ function dolSaveReadme($file, $content) return $result; } +/** + * Save content of a page on disk + * + * @param string $file Full path of filename to generate + * @param string $content Content of file + * @return boolean True if OK + */ +function dolSaveLicense($file, $content) +{ + global $conf, $pathofwebsite; + + dol_syslog("Save LICENSE file into ".$file); + + dol_mkdir($pathofwebsite); + $result = file_put_contents($file, $content); + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($file, octdec($conf->global->MAIN_UMASK)); + } + + return $result; +} /** * Show list of themes. Show all thumbs of themes/skins diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 3d5a57e91d3..379eadef08f 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -16,9 +16,9 @@ WEBSITE_HTML_HEADER=Addition at bottom of HTML Header (common to all pages) WEBSITE_ROBOT=Robot file (robots.txt) WEBSITE_HTACCESS=Website .htaccess file WEBSITE_MANIFEST_JSON=Website manifest.json file -WEBSITE_README=README.md file WEBSITE_KEYWORDSDesc=Use a comma to separate values -EnterHereLicenseInformation=Enter here meta data or license information to fille a README.md file. if you distribute your website as a template, the file will be included into the temptate package. +EnterHereReadmeInformation=Enter here a description of the website. If you distribute your website as a template, the file will be included into the temptate package. +EnterHereLicenseInformation=Enter here the LICENSE of the code of the website. If you distribute your website as a template, the file will be included into the temptate package. HtmlHeaderPage=HTML header (specific to this page only) PageNameAliasHelp=Name or alias of the page.
This alias is also used to forge a SEO URL when website is ran from a Virtual host of a Web server (like Apacke, Nginx, ...). Use the button "%s" to edit this alias. EditTheWebSiteForACommonHeader=Note: If you want to define a personalized header for all pages, edit the header on the site level instead of on the page/container. diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 811c0e9c7cc..b18daba1031 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -979,6 +979,9 @@ class Website extends CommonObject dol_syslog("Copy pages from ".$srcdir." into ".$destdir); dolCopyDir($srcdir, $destdir, 0, 1, $arrayreplacementinfilename, 2, array('old', 'back')); + // Copy file README.md from containers to root + dol_copy($conf->website->dir_temp.'/'.$website->ref.'/containers/README.md', $conf->website->dir_temp.'/'.$website->ref.'/README.md'); + // Copy files into medias/image $srcdir = DOL_DATA_ROOT.'/medias/image/'.$website->ref; $destdir = $conf->website->dir_temp.'/'.$website->ref.'/medias/image/websitekey'; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index f92642556d0..ac92d6166e7 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -243,6 +243,7 @@ $fileindex = $pathofwebsite.'/index.php'; $filewrapper = $pathofwebsite.'/wrapper.php'; $filemanifestjson = $pathofwebsite.'/manifest.json.php'; $filereadme = $pathofwebsite.'/README.md'; +$filelicense = $pathofwebsite.'/LICENSE'; $filemaster = $pathofwebsite.'/master.inc.php'; // Define $urlwithroot @@ -1191,6 +1192,11 @@ if ($action == 'addcontainer' && $usercanedit) { $result = dolSaveReadme($filereadme, $readmecontent); } + if (!dol_is_file($filelicense)) { + $licensecontent = "MIT License"; + $result = dolSaveLicense($filelicense, $licensecontent); + } + $action = 'preview'; } } @@ -1669,6 +1675,43 @@ if ($action == 'updatecss' && $usercanedit) { $error++; } + $dataposted = trim(GETPOST('WEBSITE_LICENSE', 'restricthtml')); + $dataposted = str_replace('\n";*/ + + $licensecontent .= $dataposted."\n"; + + /*$readmecontent.= '"."\n";*/ + + $result = dolSaveLicense($filelicense, $licensecontent); + if (!$result) { + $error++; + setEventMessages('Failed to write file '.$filelicense, null, 'errors'); + } + } else { + $error++; + } // Save wrapper.php $result = dolSaveIndexPage($pathofwebsite, '', '', $filewrapper, $object); @@ -3365,6 +3408,17 @@ if ($action == 'editcss') { //$readmecontent.=""; } + if (!GETPOSTISSET('WEBSITE_LICENSE')) { + $licensecontent = @file_get_contents($filelicense); + // Clean the readme file to remove php code and get only html part + $licensecontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $licensecontent); + } else { + $licensecontent = GETPOST('WEBSITE_LICENSE', 'none'); + } + if (!trim($licensecontent)) { + //$readmecontent.=""; + } + print dol_get_fiche_head(); print ''."\n"; @@ -3507,8 +3561,8 @@ if ($action == 'editcss') { // README.md print '
'; + // LICENSE + print ''; + // RSS print ''; + print ''; } // Type @@ -143,7 +143,7 @@ if ($id) { print ''; // Company - print ''; + print ''; // Civility print ''; From cfd3eeb2451af364035645c15091cd21fd15f51c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2022 20:08:13 +0200 Subject: [PATCH 211/453] NEW All ajax pages have now a top_httphead() --- htdocs/adherents/note.php | 2 +- htdocs/admin/dolistore/ajax/image.php | 17 +- htdocs/blockedlog/ajax/authority.php | 7 + htdocs/blockedlog/ajax/block-add.php | 7 + htdocs/blockedlog/ajax/block-info.php | 2 + htdocs/blockedlog/ajax/check_signature.php | 6 + htdocs/comm/action/rapport/index.php | 2 +- htdocs/core/ajax/fetchKnowledgeRecord.php | 2 + htdocs/core/ajax/fileupload.php | 7 + htdocs/core/ajax/onlineSign.php | 2 + htdocs/core/ajax/selectsearchbox.php | 2 + htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formfile.class.php | 36 +---- .../{rapport.pdf.php => rapport.class.php} | 2 +- htdocs/core/tpl/ajax/fileupload_main.tpl.php | 96 ------------ htdocs/core/tpl/ajax/fileupload_view.tpl.php | 147 ------------------ .../objectlinked_lineimport.tpl.php | 0 htdocs/mrp/ajax/ajax_bom.php | 4 +- htdocs/product/ajax/products.php | 2 + .../inventory/ajax/searchfrombarcode.php | 7 + htdocs/salaries/ajax/ajaxsalaries.php | 2 + htdocs/stripe/ajax/ajax.php | 2 + test/phpunit/CodingPhpTest.php | 18 ++- 23 files changed, 84 insertions(+), 290 deletions(-) rename htdocs/core/modules/action/{rapport.pdf.php => rapport.class.php} (99%) delete mode 100644 htdocs/core/tpl/ajax/fileupload_main.tpl.php delete mode 100644 htdocs/core/tpl/ajax/fileupload_view.tpl.php rename htdocs/core/tpl/{ajax => }/objectlinked_lineimport.tpl.php (100%) diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 532dd6e4c59..7e445e41a37 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -146,7 +146,7 @@ if ($id) { print ''; // Civility - print ''; + print ''; print ''; print "
'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'
'; - $htmlhelp = $langs->trans("EnterHereLicenseInformation"); - print $form->textwithpicto($langs->trans('WEBSITE_README'), $htmlhelp, 1, 'help', '', 0, 2, 'readmetooltip'); + $htmlhelp = $langs->trans("EnterHereReadmeInformation"); + print $form->textwithpicto($langs->trans("File").' README.md', $htmlhelp, 1, 'help', '', 0, 2, 'readmetooltip'); print ''; $poscursor = array('x'=>GETPOST('WEBSITE_README_x'), 'y'=>GETPOST('WEBSITE_README_y')); @@ -3517,6 +3571,18 @@ if ($action == 'editcss') { print '
'; + $htmlhelp = $langs->trans("EnterHereLicenseInformation"); + print $form->textwithpicto($langs->trans("File").' LICENSE', $htmlhelp, 1, 'help', '', 0, 2, 'licensetooltip'); + print ''; + + $poscursor = array('x'=>GETPOST('WEBSITE_LICENSE_x'), 'y'=>GETPOST('WEBSITE_LICENSE_y')); + $doleditor = new DolEditor('WEBSITE_LICENSE', $licensecontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', '', $poscursor); + print $doleditor->Create(1, '', true, $langs->trans("File").' LICENSE', 'text'); + + print '
'; $htmlhelp = $langs->trans('RSSFeedDesc'); From 6b38b89c3b568bb4d77efb3850e4793cf747853f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2022 19:05:25 +0200 Subject: [PATCH 209/453] NEW Add a way to enter LICENSE file content in property of website --- htdocs/website/class/website.class.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index b18daba1031..bddb8b43c24 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -979,8 +979,13 @@ class Website extends CommonObject dol_syslog("Copy pages from ".$srcdir." into ".$destdir); dolCopyDir($srcdir, $destdir, 0, 1, $arrayreplacementinfilename, 2, array('old', 'back')); - // Copy file README.md from containers to root - dol_copy($conf->website->dir_temp.'/'.$website->ref.'/containers/README.md', $conf->website->dir_temp.'/'.$website->ref.'/README.md'); + // Copy file README.md and LICENSE from directory containers into directory root + if (dol_is_file($conf->website->dir_temp.'/'.$website->ref.'/containers/README.md')) { + dol_copy($conf->website->dir_temp.'/'.$website->ref.'/containers/README.md', $conf->website->dir_temp.'/'.$website->ref.'/README.md'); + } + if (dol_is_file($conf->website->dir_temp.'/'.$website->ref.'/containers/LICENSE')) { + dol_copy($conf->website->dir_temp.'/'.$website->ref.'/containers/LICENSE', $conf->website->dir_temp.'/'.$website->ref.'/LICENSE'); + } // Copy files into medias/image $srcdir = DOL_DATA_ROOT.'/medias/image/'.$website->ref; From a7c17f59b9a280976538c380f1f9123843637e71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2022 19:16:28 +0200 Subject: [PATCH 210/453] Clean code --- htdocs/adherents/note.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 0d05bb85523..532dd6e4c59 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -129,7 +129,7 @@ if ($id) { // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'.$langs->trans("Login").' / '.$langs->trans("Id").''.dol_escape_htmltag($object->login).'
'.$langs->trans("Company").''.$object->company.'
'.$langs->trans("Company").''.dol_escape_htmltag($object->company).'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("Company").''.dol_escape_htmltag($object->company).'
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().' 
'.$langs->trans("UserTitle").''.$object->getCivilityLabel().'
"; diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php index e601da43e06..6beb96a9e66 100644 --- a/htdocs/admin/dolistore/ajax/image.php +++ b/htdocs/admin/dolistore/ajax/image.php @@ -27,14 +27,17 @@ if (!defined('NOTOKENRENEWAL')) { * \ingroup admin * \brief Page des informations dolistore */ + require "../../../main.inc.php"; - -// CORE - -global $lang, $user, $conf; - - require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php'; + + +/* + * View + */ + +top_httphead('image'); + $dolistore = new Dolistore(); $id_product = GETPOST('id_product', 'int'); @@ -51,7 +54,7 @@ try { ); //echo $url; $request = $api->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); - header('Content-type:image'); + print $request['response']; } catch (PrestaShopWebserviceException $e) { // Here we are dealing with errors diff --git a/htdocs/blockedlog/ajax/authority.php b/htdocs/blockedlog/ajax/authority.php index 78f944f692a..2da0544e0a7 100644 --- a/htdocs/blockedlog/ajax/authority.php +++ b/htdocs/blockedlog/ajax/authority.php @@ -44,6 +44,13 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/authority.class.php'; $user = new User($db); $user->fetch(1); //TODO conf user authority + +/* + * View + */ + +top_httphead(); + $auth = new BlockedLogAuthority($db); $signature = GETPOST('s'); diff --git a/htdocs/blockedlog/ajax/block-add.php b/htdocs/blockedlog/ajax/block-add.php index 53093f02d18..e2009a01da1 100644 --- a/htdocs/blockedlog/ajax/block-add.php +++ b/htdocs/blockedlog/ajax/block-add.php @@ -42,6 +42,13 @@ $id = GETPOST('id', 'int'); $element = GETPOST('element', 'alpha'); $action = GETPOST('action', 'aZ09'); + +/* + * View + */ + +top_httphead(); + if ($element === 'facture') { require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; diff --git a/htdocs/blockedlog/ajax/block-info.php b/htdocs/blockedlog/ajax/block-info.php index e6f9ea0de15..da27b8fc50e 100644 --- a/htdocs/blockedlog/ajax/block-info.php +++ b/htdocs/blockedlog/ajax/block-info.php @@ -54,6 +54,8 @@ $langs->loadLangs(array("admin")); * View */ +top_httphead(); + print '
'; print ''; diff --git a/htdocs/blockedlog/ajax/check_signature.php b/htdocs/blockedlog/ajax/check_signature.php index 4d59b56a981..60a763635c0 100644 --- a/htdocs/blockedlog/ajax/check_signature.php +++ b/htdocs/blockedlog/ajax/check_signature.php @@ -48,6 +48,12 @@ if (empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { } +/* + * View + */ + +top_httphead(); + $auth = new BlockedLogAuthority($db); $auth->syncSignatureWithAuthority(); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 9b3f9a27140..4414981b6fb 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/modules/action/rapport.pdf.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/action/rapport.class.php'; // Load translation files required by the page $langs->loadLangs(array("agenda", "commercial")); diff --git a/htdocs/core/ajax/fetchKnowledgeRecord.php b/htdocs/core/ajax/fetchKnowledgeRecord.php index 0182887c225..179d8169465 100644 --- a/htdocs/core/ajax/fetchKnowledgeRecord.php +++ b/htdocs/core/ajax/fetchKnowledgeRecord.php @@ -66,6 +66,8 @@ $lang = GETPOST('lang', 'aZ09'); * View */ +top_httphead('application/json'); + if ($action == "getKnowledgeRecord") { $response = ''; $sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,kr.url,ctc.code"; diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index 0e05036de02..53d65e4ab75 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -50,6 +50,13 @@ $element = GETPOST('element', 'alpha'); $upload_handler = new FileUpload(null, $fk_element, $element); + +/* + * View + */ + +top_httphead(); + header('Pragma: no-cache'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Content-Disposition: inline; filename="files.json"'); diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 5f59abea0b5..8f3cb23b396 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -91,6 +91,8 @@ if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnable * View */ +top_httphead(); + if ($action == "importSignature") { if (!empty($signature) && $signature[0] == "image/png;base64") { $signature = $signature[1]; diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 54e3e1e4470..201a4b89991 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -25,6 +25,8 @@ // This script is called with a POST method or as an include. if (!isset($usedbyinclude) || empty($usedbyinclude)) { + top_httphead('application/json'); + if (!defined('NOTOKENRENEWAL')) { define('NOTOKENRENEWAL', 1); // Disables token renewal } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 838aea25f53..a738bce9004 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8635,7 +8635,7 @@ class Form print '
'.$langs->trans('Field').''.$langs->trans('Value').'
'; if (!empty($compatibleImportElementsList)) { - $res = @include dol_buildpath('core/tpl/ajax/objectlinked_lineimport.tpl.php'); + $res = @include dol_buildpath('core/tpl/objectlinked_lineimport.tpl.php'); } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 612e555a6b0..441ddb60255 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -71,7 +71,7 @@ class FormFile * @param Object $object Object to use (when attachment is done on an element) * @param string $options Add an option column * @param integer $useajax Use fileupload ajax (0=never, 1=if enabled, 2=always whatever is option). - * Deprecated 2 should never be used and if 1 is used, option should no be enabled. + * Deprecated 2 should never be used and if 1 is used, option should not be enabled. * @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__' * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) @@ -104,7 +104,8 @@ class FormFile // TODO: This does not support option savingdocmask // TODO: This break feature to upload links too // TODO: Thisdoes not work when param nooutput=1 - return $this->_formAjaxFileUpload($object); + //return $this->_formAjaxFileUpload($object); + return 'Feature too bugged so removed'; } else { //If there is no permission and the option to hide unauthorized actions is enabled, then nothing is printed if (!$perm && !empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { @@ -1919,37 +1920,6 @@ class FormFile // Fin de zone } - /** - * Show form to upload a new file with jquery fileupload. - * This form use the fileupload.php file. - * - * @param Object $object Object to use - * @return void - */ - private function _formAjaxFileUpload($object) - { - global $langs, $conf; - - // PHP post_max_size - $post_max_size = ini_get('post_max_size'); - $mul_post_max_size = substr($post_max_size, -1); - $mul_post_max_size = ($mul_post_max_size == 'M' ? 1048576 : ($mul_post_max_size == 'K' ? 1024 : ($mul_post_max_size == 'G' ? 1073741824 : 1))); - $post_max_size = $mul_post_max_size * (int) $post_max_size; - // PHP upload_max_filesize - $upload_max_filesize = ini_get('upload_max_filesize'); - $mul_upload_max_filesize = substr($upload_max_filesize, -1); - $mul_upload_max_filesize = ($mul_upload_max_filesize == 'M' ? 1048576 : ($mul_upload_max_filesize == 'K' ? 1024 : ($mul_upload_max_filesize == 'G' ? 1073741824 : 1))); - $upload_max_filesize = $mul_upload_max_filesize * (int) $upload_max_filesize; - // Max file size - $max_file_size = (($post_max_size < $upload_max_filesize) ? $post_max_size : $upload_max_filesize); - - // Include main - include DOL_DOCUMENT_ROOT.'/core/tpl/ajax/fileupload_main.tpl.php'; - - // Include template - include DOL_DOCUMENT_ROOT.'/core/tpl/ajax/fileupload_view.tpl.php'; - } - /** * Show array with linked files * diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.class.php similarity index 99% rename from htdocs/core/modules/action/rapport.pdf.php rename to htdocs/core/modules/action/rapport.class.php index 2b4ec29c880..61579399247 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.class.php @@ -19,7 +19,7 @@ */ /** - * \file htdocs/core/modules/action/rapport.pdf.php + * \file htdocs/core/modules/action/rapport.class.php * \ingroup commercial * \brief File to build PDF with events */ diff --git a/htdocs/core/tpl/ajax/fileupload_main.tpl.php b/htdocs/core/tpl/ajax/fileupload_main.tpl.php deleted file mode 100644 index 8be24f7450f..00000000000 --- a/htdocs/core/tpl/ajax/fileupload_main.tpl.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * 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 . - */ - -// Protection to avoid direct call of template -if (empty($conf) || !is_object($conf)) { - print "Error, template page can't be called as URL"; - exit; -} - -?> - - - - diff --git a/htdocs/core/tpl/ajax/fileupload_view.tpl.php b/htdocs/core/tpl/ajax/fileupload_view.tpl.php deleted file mode 100644 index 22f8d687db0..00000000000 --- a/htdocs/core/tpl/ajax/fileupload_view.tpl.php +++ /dev/null @@ -1,147 +0,0 @@ - - * - * 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 . - */ - -// Protection to avoid direct call of template -if (empty($conf) || !is_object($conf)) { - print "Error, template page can't be called as URL"; - exit; -} - -?> - - - - -
- - - - -
-
- - - - trans('AddFiles'); ?> - 0) { - print ''; // MAX_FILE_SIZE must precede the field type=file - } - ?> - - - - - -
- -
- - - -
 
-
-
- -
-
- - -
- - - - - - - -
- diff --git a/htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php b/htdocs/core/tpl/objectlinked_lineimport.tpl.php similarity index 100% rename from htdocs/core/tpl/ajax/objectlinked_lineimport.tpl.php rename to htdocs/core/tpl/objectlinked_lineimport.tpl.php diff --git a/htdocs/mrp/ajax/ajax_bom.php b/htdocs/mrp/ajax/ajax_bom.php index 280a0c98cdd..54bfaf893ab 100644 --- a/htdocs/mrp/ajax/ajax_bom.php +++ b/htdocs/mrp/ajax/ajax_bom.php @@ -46,13 +46,15 @@ require '../../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; $idbom = GETPOST('idbom', 'alpha'); -$action = GETPOST('action', 'aZ09'); +//$action = GETPOST('action', 'aZ09'); /* * View */ +top_httphead('application/json'); + $object = new BOM($db); $result = $object->fetch($idbom); if ($result > 0) { diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 74fa53dccb8..0e606932ce2 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -79,6 +79,8 @@ if ($action == 'fetch' && !empty($id)) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + top_httphead('application/json'); + $outjson = array(); $object = new Product($db); diff --git a/htdocs/product/inventory/ajax/searchfrombarcode.php b/htdocs/product/inventory/ajax/searchfrombarcode.php index 68ffee43c23..2d29e1d9d2e 100644 --- a/htdocs/product/inventory/ajax/searchfrombarcode.php +++ b/htdocs/product/inventory/ajax/searchfrombarcode.php @@ -58,6 +58,13 @@ $warehousefound = 0; $warehouseid = 0; $objectreturn = array(); + +/* + * View + */ + +top_httphead('application/json'); + if ($action == "existbarcode" && !empty($barcode)) { if (!empty($mode) && $mode == "lotserial") { $sql = "SELECT ps.fk_entrepot, ps.fk_product, p.barcode, ps.reel, pb.batch"; diff --git a/htdocs/salaries/ajax/ajaxsalaries.php b/htdocs/salaries/ajax/ajaxsalaries.php index adea28ee8ce..0e0428b9074 100644 --- a/htdocs/salaries/ajax/ajaxsalaries.php +++ b/htdocs/salaries/ajax/ajaxsalaries.php @@ -52,6 +52,8 @@ restrictedArea($user, 'salaries'); * View */ +top_httphead('application/json'); + $fk_user = GETPOST('fk_user', 'int'); $return_arr = array(); diff --git a/htdocs/stripe/ajax/ajax.php b/htdocs/stripe/ajax/ajax.php index cf6ec53d580..fa5392349eb 100644 --- a/htdocs/stripe/ajax/ajax.php +++ b/htdocs/stripe/ajax/ajax.php @@ -59,6 +59,8 @@ if (empty($user->rights->takepos->run)) { * View */ +top_httphead('application/json'); + if ($action == 'getConnexionToken') { try { // Be sure to authenticate the endpoint for creating connection tokens. diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index dd0e6827ec1..e8631c5b28b 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -198,7 +198,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase || preg_match('/boxes\/box_/', $file['relativename']) || preg_match('/modules\/.*\/doc\/(doc|pdf)_/', $file['relativename']) || preg_match('/modules\/(import|mailings|printing)\//', $file['relativename']) - || in_array($file['name'], array('modules_boxes.php', 'rapport.pdf.php', 'TraceableDB.php'))) { + || in_array($file['name'], array('modules_boxes.php', 'TraceableDB.php'))) { // Check into Class files if (! in_array($file['name'], array( 'api.class.php', @@ -247,6 +247,20 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase } } + // Check we don't miss top_httphead() into any ajax pages + if (preg_match('/ajax\//', $file['relativename'])) { + print "Analyze ajax page ".$file['relativename']."\n"; + $ok=true; + $matches=array(); + preg_match_all('/top_httphead/', $filecontent, $matches, PREG_SET_ORDER); + if (count($matches) == 0) { + $ok=false; + } + //print __METHOD__." Result for checking we don't have non escaped string in sql requests for file ".$file."\n"; + $this->assertTrue($ok, 'Did not find top_httphead into the ajax page '.$file['relativename']); + //exit; + } + // Check if a var_dump has been forgotten if (!preg_match('/test\/phpunit/', $file['fullname'])) { $ok=true; @@ -463,7 +477,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase foreach ($matches as $key => $val) { //var_dump($val); if (!in_array($val[1], array( - "'replacestring'", "'htmlheader'", "'WEBSITE_HTML_HEADER'", "'WEBSITE_CSS_INLINE'", "'WEBSITE_JS_INLINE'", "'WEBSITE_MANIFEST_JSON'", "'PAGE_CONTENT'", "'WEBSITE_README'", + "'replacestring'", "'htmlheader'", "'WEBSITE_HTML_HEADER'", "'WEBSITE_CSS_INLINE'", "'WEBSITE_JS_INLINE'", "'WEBSITE_MANIFEST_JSON'", "'PAGE_CONTENT'", "'WEBSITE_README'", "'WEBSITE_LICENSE'", '"mysqldump"', '"postgresqldump"', "'db_pass_root'", "'db_pass'", '"pass"', '"pass1"', '"pass2"', '"password"', "'password'", '"MAIN_MAIL_SMTPS_PW"', '"MAIN_MAIL_SMTPS_PW_EMAILING"', '"MAIN_MAIL_SMTPS_PW_TICKET"'))) { From b81bde20f3027afd2f15faf2cf7fe6358b82b9d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Sep 2022 20:20:39 +0200 Subject: [PATCH 212/453] css --- htdocs/blockedlog/admin/blockedlog_list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 934ef9fba7b..9bb4456e840 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -527,7 +527,7 @@ if (is_array($blocks)) { print '
'.$block->id.''.dol_escape_htmltag($block->id).''.dol_print_date($block->date_creation, 'dayhour').''; //print $block->getUser() - print $block->user_fullname; + print dol_escape_htmltag($block->user_fullname); print ''.$langs->trans('log'.$block->action).''.$langs->trans('log'.$block->action).''; From c5b3df23baa79aeae32831ae2adb7446b9666aab Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 4 Sep 2022 04:49:09 +0200 Subject: [PATCH 213/453] FIX Dictionary - Display error on >cache_vatrates --- htdocs/admin/dict.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index eab0942ee4e..8ea30ef3b93 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1963,7 +1963,7 @@ if ($id) { } elseif ($value == 'fk_tva') { foreach ($form->cache_vatrates as $key => $Tab) { if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow) { - $valuetoshow = $form->cache_vatrates[$key]['libtva']; + $valuetoshow = $form->cache_vatrates[$key]['label']; break; } } From a542c86bcda2af394670e3bca49b3f0d9f1b8fe2 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 4 Sep 2022 04:59:31 +0200 Subject: [PATCH 214/453] FIX Project - on global view, missing display of ref customer --- htdocs/compta/facture/class/facture.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b1eb8656645..d646da3b413 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -15,7 +15,7 @@ * Copyright (C) 2013 Cedric Gross * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018-2022 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2022 Sylvain Legrand * @@ -1671,8 +1671,9 @@ class Facture extends CommonInvoice $this->id = $obj->rowid; $this->entity = $obj->entity; - $this->ref = $obj->ref; - $this->ref_client = $obj->ref_client; + $this->ref = $obj->ref; + $this->ref_client = $obj->ref_client; + $this->ref_customer = $obj->ref_client; $this->ref_ext = $obj->ref_ext; $this->type = $obj->type; $this->date = $this->db->jdate($obj->df); From 975d3ecf99f4330b31855b7efee87f99a9ac2291 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 4 Sep 2022 12:11:45 +0200 Subject: [PATCH 215/453] update code --- htdocs/admin/fckeditor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 3c3cd731a7d..60d0f52b036 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -65,7 +65,7 @@ $conditions = array( 'PRODUCTDESC' => (isModEnabled("product") || isModEnabled("service")), 'DETAILS' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande') || isModEnabled('supplier_proposal') || (isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")), 'USERSIGN' => 1, - 'MAILING' => !empty($conf->mailing->enabled), + 'MAILING' => isModEnabled('mailing'), 'MAIL' => (isModEnabled('facture') || isModEnabled("propal") || isModEnabled('commande')), 'TICKET' => !empty($conf->ticket->enabled), ); From 34b4ba7f33dd52c139461f4f237b0f799afe3b85 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sun, 4 Sep 2022 13:24:12 +0200 Subject: [PATCH 216/453] update code --- .../canvas/actions_contactcard_common.class.php | 2 +- htdocs/contact/card.php | 16 ++++++++-------- htdocs/contact/list.php | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index d1cc70b4927..4a3fc28c9de 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -180,7 +180,7 @@ abstract class ActionsContactCardCommon if ($action == 'view' || $action == 'edit' || $action == 'delete') { // Emailing - if (!empty($conf->mailing->enabled)) { + if (isModEnabled('mailing')) { $langs->load("mails"); $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings(); } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 4712b673ad1..d751cbef511 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -249,7 +249,7 @@ if (empty($reshook)) { $action = 'create'; } - if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && $object->no_email == -1 && !empty($object->email)) { + if (isModEnabled('mailing') && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && $object->no_email == -1 && !empty($object->email)) { $error++; $errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")); $action = 'create'; @@ -290,7 +290,7 @@ if (empty($reshook)) { } } - if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) { + if (empty($error) && isModEnabled('mailing') && !empty($object->email)) { // Add mass emailing flag into table mailing_unsubscribe $result = $object->setNoEmail($object->no_email); if ($result < 0) { @@ -342,7 +342,7 @@ if (empty($reshook)) { $action = 'edit'; } - if (!empty($conf->mailing->enabled) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { + if (isModEnabled('mailing') && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2 && GETPOST("no_email", "int") == -1 && !empty(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL))) { $error++; $errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("No_Email")); $action = 'edit'; @@ -830,7 +830,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'; @@ -3648,7 +3650,7 @@ if ($action == 'create') { || ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE && empty($discount->id)) || ($object->type == FactureFournisseur::TYPE_DEPOSIT && empty($discount->id))) && ($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED)) { // A paid invoice (partially or completely) - if (!$facidnext && $object->close_code != 'replaced' && $usercancreate) { // Not replaced by another invoice + if (!$objectidnext && $object->close_code != 'replaced' && $usercancreate) { // Not replaced by another invoice print ''.$langs->trans('ReOpen').''; } else { if ($usercancreate) { From e1a1ce55517ce522e1749d76ce5764543ea3b829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Mon, 5 Sep 2022 17:31:30 +0200 Subject: [PATCH 239/453] php V8 warning --- htdocs/fourn/facture/note.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 682d92b4515..eebd40e5b95 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -179,11 +179,13 @@ if ($object->id > 0) { } print ' ('.$langs->transnoentities("InvoiceHasAvoir") . implode(',', $invoicecredits) . ')'; } + /* if ($facidnext > 0) { $facthatreplace = new FactureFournisseur($db); $facthatreplace->fetch($facidnext); print ' ('.$langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)).')'; } + */ print '
'.$langs->transcountry("AmountLT1", $societe->country_code).'
'.$langs->transcountry("AmountLT1", $mysoc->country_code).''.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).'
'.$langs->transcountry("AmountLT2", $societe->country_code).'
'.$langs->transcountry("AmountLT2", $mysoc->country_code).''.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).'
'; if ($i > 0) { - print 'id.'">'.img_up('default', 0, 'imgupforline').''; + print 'id.'">'.img_up('default', 0, 'imgupforline').''; } if ($i < ($nboffiles - 1)) { - print 'id.'">'.img_down('default', 0, 'imgdownforline').''; + print 'id.'">'.img_down('default', 0, 'imgdownforline').''; } print '
'; $validator = new UserGroup($db); $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index cbbd66cec47..e8554c9da3d 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -270,7 +270,7 @@ if (isModEnabled('holiday') && $user->rights->holiday->read) { // Latest expense report -if (isModEnabled('expensereport') && $user->rights->expensereport->lire) { +if (isModEnabled('expensereport') && $user->hasRight('expensereport', 'read')) { $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.statut as user_status, u.photo,"; $sql .= " x.rowid, x.ref, x.date_debut as date, x.tms as dm, x.total_ttc, x.fk_statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as x, ".MAIN_DB_PREFIX."user as u"; @@ -342,7 +342,7 @@ if (isModEnabled('expensereport') && $user->rights->expensereport->lire) { // Last modified job position -if (isModEnabled('recruitment') && $user->rights->recruitment->recruitmentjobposition->read) { +if (isModEnabled('recruitment') && $user->hasRight('recruitment', 'recruitmentjobposition', 'read')) { $staticrecruitmentcandidature = new RecruitmentCandidature($db); $staticrecruitmentjobposition = new RecruitmentJobPosition($db); $sql = "SELECT rc.rowid, rc.ref, rc.email, rc.lastname, rc.firstname, rc.date_creation, rc.tms, rc.status,"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a521be145ef..54f1cbe4fc9 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2703,7 +2703,7 @@ class User extends CommonObject global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; - if (!$user->rights->user->user->lire && $user->id != $this->id) { + if (!$user->hasRight('user', 'user', 'read') && $user->id != $this->id) { $option = 'nolink'; } From eccd46c5c54602e4a48620a9b5cff9de5d613cb3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 6 Sep 2022 16:35:35 +0200 Subject: [PATCH 253/453] update code --- htdocs/accountancy/admin/accountmodel.php | 2 +- htdocs/accountancy/admin/categories_list.php | 2 +- htdocs/accountancy/index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index c1bc435145f..7f90ae4594c 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -78,7 +78,7 @@ $search_country_id = GETPOST('search_country_id', 'int'); if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index ea613ea38cd..a32c7a28682 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -42,7 +42,7 @@ $rowid = GETPOST('rowid', 'alpha'); $code = GETPOST('code', 'alpha'); // Security access -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 2745ab4784a..21c736900aa 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -44,7 +44,7 @@ if ($user->socid > 0) { if (!isModEnabled('accounting')) { accessforbidden(); } -if (empty($user->rights->accounting->mouvements->lire)) { +if (!$user->hasRight('accounting', 'mouvements', 'lire')) { accessforbidden(); } */ From e04b7333b1f68c3358beb233fdb78556d6fd892c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 6 Sep 2022 16:37:06 +0200 Subject: [PATCH 254/453] update code --- htdocs/accountancy/admin/account.php | 2 +- htdocs/accountancy/admin/card.php | 2 +- htdocs/accountancy/admin/categories.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 423a32cf9c1..2e0c4ad8930 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -59,7 +59,7 @@ $permissiontodelete = $user->hasRight('accounting', 'chartofaccount'); if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 7876712fe51..0764bcd78d1 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -48,7 +48,7 @@ $label = GETPOST('label', 'alpha'); if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index e65572eafd3..c2f4d604061 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -44,7 +44,7 @@ if ($cat_id == 0) { } // Security check -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } From 644a23a0acceb0d5562a0fdaf740ff9f7390dd61 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 6 Sep 2022 16:38:08 +0200 Subject: [PATCH 255/453] update code --- htdocs/accountancy/admin/closure.php | 2 +- htdocs/accountancy/admin/defaultaccounts.php | 2 +- htdocs/accountancy/admin/export.php | 2 +- htdocs/accountancy/admin/index.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php index 437ff1b7116..be2699223fd 100644 --- a/htdocs/accountancy/admin/closure.php +++ b/htdocs/accountancy/admin/closure.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; $langs->loadLangs(array("compta", "admin", "accountancy")); // Security check -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index bfc1fd29316..9a3b63adcc3 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "loan")); // Security check -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index d0a0ab671d4..23a16340c0b 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; $langs->loadLangs(array("compta", "bills", "admin", "accountancy")); // Security access -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index af569e08ae3..605b5d2d396 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other")); // Security access -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } From 3a5abf12bc2d88c00e74888c90d47c4feba888fc Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 6 Sep 2022 16:40:07 +0200 Subject: [PATCH 256/453] update code --- htdocs/accountancy/admin/journals_list.php | 2 +- htdocs/accountancy/admin/subaccount.php | 2 +- htdocs/admin/dict.php | 6 +++--- htdocs/compta/bank/list.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 3ea90e283ce..e9a6e222686 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -45,7 +45,7 @@ $rowid = GETPOST('rowid', 'alpha'); $code = GETPOST('code', 'alpha'); // Security access -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index cc0d4de9f31..d42de7990f7 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -47,7 +47,7 @@ $search_type = GETPOST('search_type', 'int'); if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index ff74273d744..5363bbf3062 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -54,13 +54,13 @@ $entity = GETPOST('entity', 'int'); $code = GETPOST('code', 'alpha'); $allowed = $user->admin; -if ($id == 7 && !empty($user->rights->accounting->chartofaccount)) { +if ($id == 7 && $user->hasRight('accounting', 'chartofaccount')) { $allowed = 1; // Tax page allowed to manager of chart account } -if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) { +if ($id == 10 && $user->hasRight('accounting', 'chartofaccount')) { $allowed = 1; // Vat page allowed to manager of chart account } -if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) { +if ($id == 17 && $user->hasRight('accounting', 'chartofaccount')) { $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account } if (!$allowed) { diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 362ca3d488f..065786d7402 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -69,7 +69,7 @@ if ($user->socid) { } $allowed = 0; -if (!empty($user->rights->accounting->chartofaccount)) { +if ($user->hasRight('accounting', 'chartofaccount')) { $allowed = 1; // Dictionary with list of banks accounting account allowed to manager of chart account } if (!$allowed) { From f41f1199343acb9411a595524fe375be25502c3a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 17:51:04 +0200 Subject: [PATCH 257/453] Update conferenceorbooth_card.php --- .../conferenceorbooth_card.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 368da1c889a..1e71af81492 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -17,27 +17,29 @@ */ /** - * \file htdocs/eventorganization/conferenceorbooth_card.php - * \ingroup eventorganization - * \brief Page to create/edit/view conferenceorbooth + * \file htdocs/eventorganization/conferenceorbooth_card.php + * \ingroup eventorganization + * \brief Page to create/edit/view conferenceorbooth */ -require '../main.inc.php'; +// Load Dolibarr environment +require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; global $dolibarr_main_url_root; // Load translation files required by the page -$langs->loadLangs(array("eventorganization", "projects")); +$langs->loadLangs(array('eventorganization', 'projects')); +// Get parameters $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); @@ -45,7 +47,6 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'co $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -// Get parameters $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $withproject = GETPOST('withproject', 'int'); @@ -79,6 +80,7 @@ if (empty($action) && empty($id) && empty($ref)) { // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +// Permissions $permissiontoread = $user->rights->eventorganization->read; $permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); From a3e56e38db141d8951aaa5a64341e5e53aed57cb Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 17:53:54 +0200 Subject: [PATCH 258/453] Update conferenceorbooth_contact.php // Load Dolibarr environment - clean double entries --- .../eventorganization/conferenceorbooth_contact.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 62bd64441b5..2c304bd8562 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -22,17 +22,18 @@ * \brief Tab for contacts linked to ConferenceOrBooth */ + +// Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + // Load translation files required by the page $langs->loadLangs(array('companies', 'eventorganization', 'mails', 'others', 'projects')); From 635142020efde50913796d009b356dcb18dea309 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 17:55:58 +0200 Subject: [PATCH 259/453] Update conferenceorbooth_document.php --- .../conferenceorbooth_document.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index d056a5b900c..56b34f68b03 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -22,21 +22,25 @@ * \brief Tab for documents linked to ConferenceOrBooth */ +// Load Dolibarr environment require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; + +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + // Load translation files required by the page $langs->loadLangs(array("eventorganization", "projects", "companies", "other", "mails")); +// Get Parameters $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm'); $cancel = GETPOST('cancel', 'aZ09'); @@ -49,8 +53,6 @@ $ref = GETPOST('ref', 'alpha'); $withproject = GETPOST('withproject', 'int'); $project_ref = GETPOST('project_ref', 'alpha'); - -// Get parameters $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); @@ -88,6 +90,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->eventorganization->multidir_output[$object->entity ? $object->entity : $conf->entity]."/conferenceorbooth/".get_exdir(0, 0, 0, 1, $object); } +// Permissions $permissiontoread = $user->rights->eventorganization->read; $permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); From 700da1492f8bfe437ba89e24e71624c9f2f03d64 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:02:11 +0200 Subject: [PATCH 260/453] Update conferenceorbooth_list.php --- .../conferenceorbooth_list.php | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 7866a83a024..520435c9cdc 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -17,21 +17,26 @@ */ /** - * \file conferenceorbooth_list.php - * \ingroup eventorganization - * \brief List page for conferenceorbooth + * \file htdocs/eventorganization/conferenceorbooth_list.php + * \ingroup eventorganization + * \brief List page for conferenceorbooth */ + +// Load Dolibarr environment require '../main.inc.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; +require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; +require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; + +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; global $dolibarr_main_url_root; @@ -41,6 +46,7 @@ global $dolibarr_main_url_root; // Load translation files required by the page $langs->loadLangs(array("eventorganization", "other", "projects", "companies")); +// Get Parameters $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) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? From 9392e889b4ef1bc22af60fc5e10067d3e978c67a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:07:40 +0200 Subject: [PATCH 261/453] Update conferenceorboothattendee_card.php --- .../conferenceorboothattendee_card.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 79b7b1aaa55..14a8c871232 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -16,20 +16,23 @@ */ /** - * \file conferenceorboothattendee_card.php - * \ingroup eventorganization - * \brief Page to create/edit/view conferenceorboothattendee + * \file htdocs/eventorganization/conferenceorboothattendee_card.php + * \ingroup eventorganization + * \brief Page to create/edit/view conferenceorboothattendee */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page @@ -108,6 +111,7 @@ if ($object->fk_project > 0) { $fk_project = $object->fk_project; } +// Permissions $permissiontoread = $user->rights->eventorganization->read; $permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); From 98b7cf13dda5738516c0371f5a766ab59eadc25d Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:11:43 +0200 Subject: [PATCH 262/453] Update conferenceorboothattendee_list.php --- .../conferenceorboothattendee_list.php | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 7b8b6258e5e..1ec6a9efe96 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -17,21 +17,24 @@ */ /** - * \file conferenceorboothattendee_list.php - * \ingroup eventorganization - * \brief List page for conferenceorboothattendee + * \file htdocs/eventorganization/conferenceorboothattendee_list.php + * \ingroup eventorganization + * \brief List page for conferenceorboothattendee */ + +// Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php'; -require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php'; +require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (isModEnabled('categorie')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; } @@ -44,15 +47,16 @@ global $dolibarr_main_url_root; // Load translation files required by the page $langs->loadLangs(array("eventorganization", "other", "projects")); -$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) -$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? -$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation -$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothattendeelist'; // To manage different context of search -$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +// Get Paramters +$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) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'conferenceorboothattendeelist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id', 'int'); $conf_or_booth_id = GETPOST('conforboothid', 'int'); @@ -139,6 +143,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +// Permissions $permissiontoread = $user->rights->eventorganization->read; $permissiontoadd = $user->rights->eventorganization->write; $permissiontodelete = $user->rights->eventorganization->delete; From a3d7627bb6725f4d4d71bd376b8876a519bdf337 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:15:41 +0200 Subject: [PATCH 263/453] Update conferenceorboothattendee_note.php --- .../conferenceorboothattendee_note.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_note.php b/htdocs/eventorganization/conferenceorboothattendee_note.php index 5739e19f0cc..b6e343e4496 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_note.php +++ b/htdocs/eventorganization/conferenceorboothattendee_note.php @@ -17,9 +17,9 @@ */ /** - * \file conferenceorboothattendee_note.php - * \ingroup eventorganization - * \brief Tab for notes on ConferenceOrBoothAttendee + * \file htdocs/eventorganization/conferenceorboothattendee_note.php + * \ingroup eventorganization + * \brief Tab for notes on ConferenceOrBoothAttendee */ //if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Do not create database handler $db @@ -42,6 +42,7 @@ //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification + // Load Dolibarr environment $res = 0; // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) @@ -77,7 +78,7 @@ dol_include_once('/eventorganization/class/conferenceorboothattendee.class.php') dol_include_once('/eventorganization/lib/eventorganization_conferenceorboothattendee.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("eventorganization@eventorganization", "companies")); +$langs->loadLangs(array('eventorganization', 'companies')); // Get parameters $id = GETPOST('id', 'int'); @@ -105,6 +106,7 @@ if ($id > 0 || !empty($ref)) { $upload_dir = $conf->eventorganization->multidir_output[$object->entity]."/".$object->id; } +// Permissions $permissionnote = $user->rights->eventorganization->conferenceorboothattendee->write; // Used by the include of actions_setnotes.inc.php $permissiontoadd = $user->rights->eventorganization->conferenceorboothattendee->write; // Used by the include of actions_addupdatedelete.inc.php From c4322c5edcc195a4e9d475ec4eaab5b760651032 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 6 Sep 2022 16:17:03 +0000 Subject: [PATCH 264/453] Fixing style errors. --- htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 1ec6a9efe96..167a79959f5 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -143,7 +143,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); -// Permissions +// Permissions $permissiontoread = $user->rights->eventorganization->read; $permissiontoadd = $user->rights->eventorganization->write; $permissiontodelete = $user->rights->eventorganization->delete; From 3cebf6767ed741469d0b7227ec42b9c8ed69b2aa Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:24:26 +0200 Subject: [PATCH 265/453] Update info.php --- htdocs/compta/bank/info.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/info.php b/htdocs/compta/bank/info.php index 1bbab933e7b..729ccc53fdc 100644 --- a/htdocs/compta/bank/info.php +++ b/htdocs/compta/bank/info.php @@ -16,23 +16,29 @@ */ /** - * \file htdocs/compta/bank/info.php - * \ingroup banque - * \brief Onglet info d'une ecriture bancaire + * \file htdocs/compta/bank/info.php + * \ingroup compta/bank + * \brief Info tab of bank statement */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; + // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'companies')); + +// Get Parameters $id = GETPOST("rowid", 'int'); $accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int')); $ref = GETPOST('ref', 'alpha'); + // Security check $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : '')); From ee799693b144a7c8b31a76fdcff05111f0dd450a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:27:07 +0200 Subject: [PATCH 266/453] Update bilan.php --- htdocs/compta/bank/bilan.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/bank/bilan.php b/htdocs/compta/bank/bilan.php index 6edee79f86b..c2e93b27e59 100644 --- a/htdocs/compta/bank/bilan.php +++ b/htdocs/compta/bank/bilan.php @@ -17,17 +17,20 @@ */ /** - * \file htdocs/compta/bank/bilan.php - * \ingroup banque - * \brief Page de bilan + * \file htdocs/compta/bank/bilan.php + * \ingroup compta/bank + * \brief Page of Balance sheet */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories')); +// Security Check Access Control if (empty($user->rights->banque->lire)) { accessforbidden(); } From 86377a337e0fc6a9689a19717b70efe385505268 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:30:10 +0200 Subject: [PATCH 267/453] Update categ.php --- htdocs/compta/bank/categ.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index aa60c1ddf41..fbb52fe4a58 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -21,29 +21,38 @@ */ /** - * \file htdocs/compta/bank/categ.php - * \ingroup compta - * \brief Page ajout de categories bancaires + * \file htdocs/compta/bank/categ.php + * \ingroup compta/bank + * \brief Page to manage Bank Categories */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php'; + // Load translation files required by the page $langs->loadLangs(array('banks', 'categories')); + +// Get Parameters $action = GETPOST('action', 'aZ09'); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$categid = GETPOST('categid'); +$label = GETPOST("label"); + +// Initialize technical objects +$bankcateg = new BankCateg($db); + + +// Security Check Access Control if (!$user->rights->banque->configurer) { accessforbidden(); } -$bankcateg = new BankCateg($db); -$categid = GETPOST('categid'); -$label = GETPOST("label"); - /* From 079dab3a2cc6199feb0feb5aaab6677c94317ba2 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:37:03 +0200 Subject: [PATCH 268/453] Update supplier_turnover_by_thirdparty.php --- .../stats/supplier_turnover_by_thirdparty.php | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 28e932dcb4a..494ad591766 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -16,17 +16,19 @@ */ /** - * \file htdocs/compta/stats/supplier_turnover_by_thirdparty.php - * \brief Page reporting purchase turnover by thirdparty + * \file htdocs/compta/stats/supplier_turnover_by_thirdparty.php + * \brief Page reporting purchase turnover by thirdparty */ + +// Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page @@ -38,6 +40,7 @@ if (GETPOST("modecompta")) { $modecompta = GETPOST("modecompta"); } +// Sort Order $sortorder = GETPOST("sortorder", 'aZ09comma'); $sortfield = GETPOST("sortfield", 'aZ09comma'); if (!$sortorder) { @@ -47,6 +50,7 @@ if (!$sortfield) { $sortfield = "nom"; } + $socid = GETPOST('socid', 'int'); // Category @@ -59,13 +63,17 @@ if (GETPOST('subcat', 'alpha') === 'yes') { // Hook $hookmanager->initHooks(array('supplierturnoverbythirdpartylist')); -// Date range -$year = GETPOST("year", 'int'); -$month = GETPOST("month", 'int'); + +// Search Parameters $search_societe = GETPOST("search_societe", 'alpha'); $search_zip = GETPOST("search_zip", 'alpha'); $search_town = GETPOST("search_town", 'alpha'); $search_country = GETPOST("search_country", 'alpha'); + + +// Date range +$year = GETPOST("year", 'int'); +$month = GETPOST("month", 'int'); $date_startyear = GETPOST("date_startyear", 'alpha'); $date_startmonth = GETPOST("date_startmonth", 'alpha'); $date_startday = GETPOST("date_startday", 'alpha'); From fb4620baf3d6b07b7fcb110b98e64ce13f258d18 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:55:42 +0200 Subject: [PATCH 269/453] Update ChangeLog --- ChangeLog | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a127d4fcee..9a5513031e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -103,32 +103,33 @@ NEW: Module BOM - Add tabs for nets Bom NEW: Module BOM - Add the possibility to add sub-BOMs to BOM NEW: Module Recruitment - Add a public page with all list of open job positions. NEW: Module Recruitment - Add a tab with list of application on the jobposition file. -NEW: Module website now supports the multicompany module +NEW: Module Website - supports now the multicompany module NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...) NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens) NEW: on redirect of page in website module, GET parameters are kept. NEW: optional display warning icons on ticket list -NEW: option to default check "notify tier at creation" in ticket module -NEW: option update prices on proposal cloning NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439) NEW: possibility to consume multiple batch NEW: Reverse movement product consumption NEW: Send email to the supplier order contact NEW: add permission to report time on timesheet NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level -NEW: Show number of votes into the label of tab "Results" of a survey NEW: Some core tables are created only at module activation NEW: MRP - split consumption line on MO +NEW: Proposals - option update prices on proposal cloning NEW: stock filter in reassort lists NEW: stock limit in stock export CSV NEW: Supplier order - Show ref supplier of reception in linked object block NEW: support user_modif in order +NEW: Surveys - Show number of votes into the label of tab "Results" of a survey NEW: TakePOS - barcode rule to insert product in TakePOS NEW: TakePOS - pagination on search results NEW: TakePOS - show product reference NEW: TakePOS - add constant to hide categories NEW: TakePOS - add constant to show category description NEW: TakePOS - add constant to show only the products in stock +NEW: Tickets - option to default check "notify tier at creation" +NEW: Tickets - Trigger: allow to automatically send messages on new tickets NEW: The backup tools has an "lowmemory" option for mysqldump on large database NEW: The 'reposition' class works on ajax constantonoff that make redirects NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice @@ -136,7 +137,6 @@ NEW: thumbnail field in product list NEW: total mark rate in list NEW: uncheck "send message" by default on a ticket when private messages has been checked NEW: VAT Report by month - Show detail by rate and also by code -NEW: Ticket triggers: allow to automatically send messages on new tickets NEW: Can store the session into database (instead of beeing managed by PHP) NEW: Added MMK currency (Myanmar Kyat) NEW: On a form to send an email, we show all emails of contacts of object @@ -161,20 +161,17 @@ NEW: Identification of tr is possible with by attribute data-id on some pages NEW: Import with select boxes V2 NEW: Can use current entity filter on 'chkbxlst' NEW: Creation of the function select_bom() used to display bom select list - NEW: Add trigger and event on completely received status change NEW: Add utility function send backup by mail NEW: add WordPress OAuth to save a token (not SSO) NEW: A module can embed a sql script run at each Dolibarr upgrade -NEW: Add option INVOICEREC_SET_AUTOFILL_DATE_START/END NEW: Add param to keep the robot=index meta tag on public pages NEW: Add method hintindex() in database handlers. NEW: add modifications for new function "$db->prefix()" NEW: addMoreActionsButtonsList hook for button in list NEW: Standardize a lot of code. NEW: Add a protection into PHPunit to avoid to forget a var_dump -NEW: Add hidden option on contract PDF line to hide qty and price -NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action + API: NEW: API Proposals - Add POST lines @@ -191,7 +188,6 @@ Hooks: NEW: Hook getNomUrl available everywhere in tooltip of ref links NEW: Add hooks: selectContactListWhere hook, selectThirdpartyListWhere hook NEW: Add hook before the public ticket list -NEW: Add hook doaction in takepos invoice NEW: Add hook for Notif NEW: Add hook for more buttons NEW: add hook printFieldListWhere in product ressort card @@ -209,6 +205,12 @@ NEW: Add hook to getSellPrice function NEW: TakePos - add hooks complete product display NEW: TakePos - add hooks for cart display NEW: TakePos - add hooks to complete ajax return array +NEW: TakePOS - add hook doaction in TakePOS invoice + +Config Options: +NEW: Add hidden option on contract PDF line to hide qty and price +NEW: Option INVOICEREC_SET_AUTOFILL_DATE_START/END +NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action WARNING: From 8ee927f593b30dc3274fa5d01a40fbb34e1c1505 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Sep 2022 20:53:51 +0200 Subject: [PATCH 270/453] Fix search --- htdocs/user/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 858a46887ba..3a0714ab540 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -110,7 +110,8 @@ $fieldstosearchall = array( 'u.office_phone'=>"PhonePro", 'u.user_mobile'=>"PhoneMobile", 'u.email'=>"EMail", - 'u.note'=>"Note", + 'u.note_public'=>"PublicNote", + 'u.note_private'=>"PrivateNote" ); if (!empty($conf->api->enabled)) { $fieldstosearchall['u.api_key'] = "ApiKey"; From 17a4e20abb96a48b86f1cbb6ac8989d84196513c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 21:22:52 +0200 Subject: [PATCH 271/453] Update list.php --- htdocs/fourn/product/list.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index a89b25c2201..4bd64a60fc8 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -21,18 +21,24 @@ */ /** - * \file htdocs/fourn/product/list.php - * \ingroup produit - * \brief Page to list supplier products and services + * \file htdocs/fourn/product/list.php + * \ingroup product + * \brief Page to list supplier products and services */ + +// Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; +require_once DOL_DOCUMENT_ROOT .'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.class.php'; -$langs->loadLangs(array("products", "suppliers")); +// Load translation files required by the page +$langs->loadLangs(array('products', 'suppliers')); + + +// Get Parameters $sref = GETPOST('sref', 'alphanohtml'); $sRefSupplier = GETPOST('srefsupplier'); $snom = GETPOST('snom', 'alphanohtml'); @@ -72,6 +78,7 @@ if (empty($user->rights->produit->lire) && empty($user->rights->service->lire)) accessforbidden(); } +// Permissions $permissiontoadd = ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')); @@ -111,6 +118,7 @@ if (empty($reshook)) { } } + /* * View */ From 8973d7b2b51fe4abc077b12493a7e6355ed42e84 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 21:27:14 +0200 Subject: [PATCH 272/453] Update card.php --- htdocs/fourn/paiement/card.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index d9144b3a83f..c7c1297e0e8 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -19,26 +19,34 @@ */ /** - * \file htdocs/fourn/paiement/card.php - * \ingroup facture, fournisseur - * \brief Tab to show a payment of a supplier invoice - * \remarks Fichier presque identique a compta/paiement/card.php + * \file htdocs/fourn/paiement/card.php + * \ingroup facture, fournisseur + * \brief Tab to show a payment of a supplier invoice + * \remarks Fichier presque identique a compta/paiement/card.php */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; -$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers')); -$id = GETPOST('id', 'int'); +// Load translation files required by the page +$langs->loadLangs(array('banks', 'bills', 'companies', 'suppliers')); + + +// Get Parameters +$id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); -$confirm = GETPOST('confirm', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +// Initialize objects $object = new PaiementFourn($db); + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('supplierpaymentcard', 'globalcard')); From b4034c0a210b1f20ce26a0abe7eca4a4a6880b70 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 21:30:09 +0200 Subject: [PATCH 273/453] Update document.php --- htdocs/fourn/paiement/document.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/fourn/paiement/document.php b/htdocs/fourn/paiement/document.php index b69e081cf16..e26734ed9c6 100644 --- a/htdocs/fourn/paiement/document.php +++ b/htdocs/fourn/paiement/document.php @@ -23,30 +23,36 @@ */ /** - * \file htdocs/fourn/paiement/document.php - * \ingroup facture, fournisseur - * \brief Management page of attached documents to a payment + * \file htdocs/fourn/paiement/document.php + * \ingroup facture, fournisseur + * \brief Management page of attached documents to a payment */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; if (isModEnabled('project')) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -// Load translation files required by the page -$langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers', 'other')); +// Load translation files required by the page +$langs->loadLangs(array('banks', 'bills', 'companies', 'suppliers', 'other')); + + +// Get Parameters $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); + // Security check if ($user->socid) { $socid = $user->socid; From da61cb5b868b8f8b608946fefe0dd99ae2773d30 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Tue, 6 Sep 2022 21:34:30 +0200 Subject: [PATCH 274/453] Update info.php --- htdocs/fourn/paiement/info.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/fourn/paiement/info.php b/htdocs/fourn/paiement/info.php index 8032b2b418f..5979c2ff1ee 100644 --- a/htdocs/fourn/paiement/info.php +++ b/htdocs/fourn/paiement/info.php @@ -18,20 +18,26 @@ */ /** - * \file htdocs/fourn/paiement/info.php - * \ingroup facture - * \brief Onglet info d'un paiement fournisseur + * \file htdocs/fourn/paiement/info.php + * \ingroup facture, fournisseur + * \brief Tab for Supplier Payment Information */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; + +// Load translation files required by the page $langs->loadLangs(array("bills", "suppliers", "companies")); +// Get Parameters $id = GETPOST('id', 'int'); +// Initialize Objects $object = new PaiementFourn($db); // Load object From cdf90a0004a32580b09f1d8eb1ce5e1f673a4614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Sep 2022 22:31:20 +0200 Subject: [PATCH 275/453] Fix missign error message --- htdocs/core/actions_massactions.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index c2d1f7344c4..ddee2ad5fb4 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -815,6 +815,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $lineid = $result; } else { $lineid = 0; + $errors[] = $objecttmp->error; $error++; break; } @@ -959,7 +960,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders. $action = 'create'; $_GET["origin"] = $_POST["origin"]; $_GET["originid"] = $_POST["originid"]; - setEventMessages("Error", null, 'errors'); + setEventMessages("Error", $errors, 'errors'); $error++; } } From 8666e193a2bc7172a87e28e94ccc7694f8dcf854 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Sep 2022 22:56:09 +0200 Subject: [PATCH 276/453] Fix td balance --- htdocs/product/stock/stockatdate.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index d4f1bbf4861..0b7baf643ff 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -476,6 +476,8 @@ print $hookmanager->resPrint; print "
'.$currentstock.''.$virtualstock.''.($stock ? $stock : ''.$stock.'').''.($currentstock ? $currentstock : '0').'
'.$langs->trans("EnterADateCriteria").'
'.$langs->trans("Totalforthispage").''.price(price2num($totalbuyingprice, 'MT')).'
'.$langs->trans("Totalforthispage").''.price(price2num($totalcurrentstock, 'MS')).''.price(price2num($totalvirtualstock, 'MS')).''.price(price2num($totalbuyingprice, 'MT')).''.($productid > 0 ? price(price2num($totalcurrentstock, 'MS')) : '').'
'; From bfb93609dd0a1d5ce7546db1bcb0da8efe1a18a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Wed, 7 Sep 2022 08:56:02 +0200 Subject: [PATCH 277/453] php V8 Warning --- htdocs/compta/facture/card.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d8db9191c32..27ad83d35d4 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2237,8 +2237,9 @@ if (empty($reshook)) { $desc = $product_desc; $type = GETPOST('type'); $fk_unit = GETPOST('units', 'alpha'); - $pu_ht_devise = price2num($price_ht_devise, 'MU'); } + + $pu_ht_devise = price2num($price_ht_devise, 'MU'); // Margin $fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : ''); @@ -2286,10 +2287,10 @@ if (empty($reshook)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (!empty-$conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { From 0886f8557967071952693d7c3fe1067032d66cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Wed, 7 Sep 2022 08:57:51 +0200 Subject: [PATCH 278/453] Update card.php --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 27ad83d35d4..f60f1da089d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -659,10 +659,10 @@ if (empty($reshook)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { From 3144362c6ca337528bdff4ddcb5c4a8d30b98318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Wed, 7 Sep 2022 09:38:20 +0200 Subject: [PATCH 279/453] php V8 warning --- htdocs/fourn/facture/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 305c50b29d5..09dbd4c84ac 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -10,7 +10,7 @@ * Copyright (C) 2015 Abbes Bahfir * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador - * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2018-2022 Charlene Benke * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2019-2021 Alexandre Spangaro * @@ -649,7 +649,7 @@ if (!$search_all) { } } // Add GroupBy from hooks - $parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall); + $parameters = array('all' => $search_all, 'fieldstosearchall' => $fieldstosearchall); $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; } else { @@ -682,7 +682,7 @@ if ($resql) { $arrayofselected = is_array($toselect) ? $toselect : array(); - if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { + if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { $obj = $db->fetch_object($resql); $id = $obj->facid; From 7a3b94a1e90243b4af1b1c91b21fb6e174d29ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?This=20Charl=C3=A8ne?= <1179011+defrance@users.noreply.github.com> Date: Wed, 7 Sep 2022 09:53:43 +0200 Subject: [PATCH 280/453] Update list.php --- htdocs/fourn/facture/list.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 09dbd4c84ac..4c5b84ea4ee 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1291,6 +1291,14 @@ if ($resql) { if ($num > 0) { $i = 0; $totalarray = array(); + $totalarray['nbfield']=0; + $totalarray['val'] = array(); + $totalarray['val']['f.total_ht']=0; + $totalarray['val']['f.total_vat']=0; + $totalarray['val']['f.total_localtax1']=0; + $totalarray['val']['f.total_localtax1']=0; + $totalarray['val']['f.total_ttc']=0; + while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); From fbbdcd1d4c2b37afc5b25025212e3590041c3844 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 7 Sep 2022 10:28:23 +0200 Subject: [PATCH 281/453] fix php8 warnings --- htdocs/comm/propal/card.php | 2 +- .../core/modules/propale/doc/pdf_azur.modules.php | 2 +- .../core/modules/propale/doc/pdf_cyan.modules.php | 2 +- htdocs/datapolicy/admin/setupmail.php | 2 +- .../product/class/propalmergepdfproduct.class.php | 8 ++++---- htdocs/product/document.php | 14 +++++++------- htdocs/societe/paymentmodes.php | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 53ba07ba441..388a4f97d4b 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -722,7 +722,7 @@ if (empty($reshook)) { $ret = $deposit->fetch($deposit->id); // Reload to get new records $outputlangs = $langs; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang($deposit->thirdparty->default_lang); $outputlangs->load('products'); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 86d6306a576..c2971c9344e 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -793,7 +793,7 @@ class pdf_azur extends ModelePDFPropales // Find the desire PDF $filetomerge = new Propalmergepdfproduct($this->db); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $filetomerge->fetch_by_product($line->fk_product, $outputlangs->defaultlang); } else { $filetomerge->fetch_by_product($line->fk_product); diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index ec04a8e8906..9d52132db56 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -918,7 +918,7 @@ class pdf_cyan extends ModelePDFPropales // Find the desire PDF $filetomerge = new Propalmergepdfproduct($this->db); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $filetomerge->fetch_by_product($line->fk_product, $outputlangs->defaultlang); } else { $filetomerge->fetch_by_product($line->fk_product); diff --git a/htdocs/datapolicy/admin/setupmail.php b/htdocs/datapolicy/admin/setupmail.php index e2f562ee79b..825bd13b142 100644 --- a/htdocs/datapolicy/admin/setupmail.php +++ b/htdocs/datapolicy/admin/setupmail.php @@ -106,7 +106,7 @@ print '
'; print ''; print ''; print ''; -if ($conf->global->MAIN_MULTILANGS) { +if (!empty($conf->global->MAIN_MULTILANGS)) { print ''; diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index e69c75c7336..b4b85c3852a 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -107,7 +107,7 @@ class Propalmergepdfproduct extends CommonObject $sql = "INSERT INTO ".$this->db->prefix()."propal_merge_pdf_product("; $sql .= "fk_product,"; $sql .= "file_name,"; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $sql .= "lang,"; } $sql .= "fk_user_author,"; @@ -116,7 +116,7 @@ class Propalmergepdfproduct extends CommonObject $sql .= ") VALUES ("; $sql .= " ".(!isset($this->fk_product) ? 'NULL' : ((int) $this->fk_product)).","; $sql .= " ".(!isset($this->file_name) ? 'NULL' : "'".$this->db->escape($this->file_name)."'").","; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $sql .= " ".(!isset($this->lang) ? 'NULL' : "'".$this->db->escape($this->lang)."'").","; } $sql .= " ".((int) $user->id).","; @@ -186,7 +186,7 @@ class Propalmergepdfproduct extends CommonObject $this->fk_product = $obj->fk_product; $this->file_name = $obj->file_name; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $this->lang = $obj->lang; } $this->fk_user_author = $obj->fk_user_author; @@ -311,7 +311,7 @@ class Propalmergepdfproduct extends CommonObject $sql .= " fk_product=".(isset($this->fk_product) ? $this->fk_product : "null").","; $sql .= " file_name=".(isset($this->file_name) ? "'".$this->db->escape($this->file_name)."'" : "null").","; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $sql .= " lang=".(isset($this->lang) ? "'".$this->db->escape($this->lang)."'" : "null").","; } $sql .= " fk_user_mod=".$user->id; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index 2aaa2356879..ee5ba79a284 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -154,14 +154,14 @@ if ($action == 'filemerge' && $permissiontoadd) { $filetomerge_file_array = GETPOST('filetoadd'); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $lang_id = GETPOST('lang_id', 'aZ09'); } // Delete all file already associated $filetomerge = new Propalmergepdfproduct($db); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $result = $filetomerge->delete_by_product($user, $object->id, $lang_id); } else { $result = $filetomerge->delete_by_product($user, $object->id); @@ -176,7 +176,7 @@ if ($action == 'filemerge' && $permissiontoadd) { $filetomerge->fk_product = $object->id; $filetomerge->file_name = $filetomerge_file; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $filetomerge->lang = $lang_id; } @@ -271,7 +271,7 @@ if ($object->id) { if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) { $filetomerge = new Propalmergepdfproduct($db); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $lang_id = GETPOST('lang_id', 'aZ09'); $result = $filetomerge->fetch_by_product($object->id, $lang_id); } else { @@ -305,7 +305,7 @@ if ($object->id) { print '
'.$form->editfieldkey('DefaultLang', 'default_lang', '', null, 0).''."\n"; print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); print '
'; // Get language - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { $langs->load("languages"); print ''; print ''; - print ''; + print ''; + print ajax_combobox('menuuser'); + print ''; print ''; // Type @@ -392,7 +394,7 @@ if ($action == 'create') { print ''; // Module - print ''; + print ''; // Handler if ($menu->menu_handler == 'all') { @@ -403,14 +405,17 @@ if ($action == 'create') { print ''; // User - print ''; + print ''; + print ajax_combobox('menuuser'); + print ''; // Type - print ''; + print ''; print ''; // Mainmenu code @@ -463,12 +468,6 @@ if ($action == 'create') { print ''; print ''; - // Target - print ''; - // Enabled print ''; print ''; + // Target + print ''; + print '
'; @@ -316,7 +316,7 @@ if ($object->id) { print Form::selectarray('lang_id', $langs_available, $default_lang, 0, 0, 0, '', 0, 0, 0, 'ASC'); - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { print ''; } @@ -328,7 +328,7 @@ if ($object->id) { $checked = ''; $filename = $filetoadd['name']; - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { if (array_key_exists($filetoadd['name'].'_'.$default_lang, $filetomerge->lines)) { $filename = $filetoadd['name'].' - '.$langs->trans('Language_'.$default_lang); $checked = ' checked '; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 20cce294586..e7899db813e 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1467,7 +1467,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $allowgenifempty = 0; // Language code (if multilang) - if ($conf->global->MAIN_MULTILANGS) { + if (!empty($conf->global->MAIN_MULTILANGS)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; $formadmin = new FormAdmin($db); $defaultlang = $langs->getDefaultLang(); From f27a49d30c3aa56663fb99233c8bca82292ae4b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 12:45:43 +0200 Subject: [PATCH 282/453] Fix missing var --- htdocs/compta/facture/class/facture.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d646da3b413..f6ed3468f9c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -137,7 +137,8 @@ class Facture extends CommonInvoice /** * @var string customer ref */ - public $ref_client; + public $ref_client; // deprecated; use ref_customer instead + public $ref_customer; /** * @var int Ref Int From 445da580c6d3fd533a4d123cc50bfe473aaabd04 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 13:42:31 +0200 Subject: [PATCH 283/453] Fix regression --- htdocs/core/menus/standard/eldy.lib.php | 76 ++++++++++++------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 01bc426458e..66f85c3739c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -95,8 +95,8 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Members $tmpentry = array( - 'enabled' => (isModEnabled('adherent')), - 'perms' => (!empty($user->hasRight('adherent', 'lire'))), + 'enabled' => isModEnabled('adherent'), + 'perms' => $user->hasRight('adherent', 'lire'), 'module' => 'adherent' ); $menu_arr[] = array( @@ -125,7 +125,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ) || ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_order') || isModEnabled('supplier_invoice')) ), - 'perms'=> (!empty($user->hasRight('societe', 'lire')) || !empty($user->hasRight('fournisseur', 'lire')) || !empty($user->hasRight('supplier_order', 'lire')) || !empty($user->hasRight('supplier_invoice', 'lire')) || !empty($user->hasRight('supplier_proposal', 'lire'))), + 'perms'=> ($user->hasRight('societe', 'lire') || $user->hasRight('fournisseur', 'lire') || $user->hasRight('supplier_order', 'lire') || $user->hasRight('supplier_invoice', 'lire') || $user->hasRight('supplier_proposal', 'lire')), 'module'=>'societe|fournisseur' ); $menu_arr[] = array( @@ -150,7 +150,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Products-Services $tmpentry = array( 'enabled'=> (isModEnabled('product') || isModEnabled('service') || isModEnabled('expedition')), - 'perms'=> (!empty($user->hasRight('produit', 'lire')) || !empty($user->hasRight('service', 'lire')) || !empty($user->hasRight('expedition', 'lire'))), + 'perms'=> ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire') || $user->hasRight('expedition', 'lire')), 'module'=>'product|service' ); $menu_arr[] = array( @@ -177,7 +177,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // MRP - GPAO $tmpentry = array( 'enabled'=>(isModEnabled('bom') || isModEnabled('mrp')), - 'perms'=>(!empty($user->hasRight('bom', 'read')) || !empty($user->hasRight('mrp', 'read'))), + 'perms'=>($user->hasRight('bom', 'read') || $user->hasRight('mrp', 'read')), 'module'=>'bom|mrp' ); $menu_arr[] = array( @@ -202,7 +202,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Projects $tmpentry = array( 'enabled'=> (isModEnabled('projet') ? 1 : 0), - 'perms'=> (!empty($user->hasRight('projet', 'lire')) ? 1 : 0), + 'perms'=> ($user->hasRight('projet', 'lire') ? 1 : 0), 'module'=>'projet' ); $menu_arr[] = array( @@ -234,25 +234,25 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = || isModEnabled('contrat') || isModEnabled('ficheinter') ) ? 1 : 0, - 'perms'=>(!empty($user->hasRight('propal', 'lire')) - || !empty($user->hasRight('commande', 'lire')) - || !empty($user->hasRight('supplier_proposal', 'lire')) - || !empty($user->hasRight('fournisseur', 'lire')) - || !empty($user->hasRight('fournisseur', 'commande', 'lire')) - || !empty($user->hasRight('supplier_order', 'lire')) - || !empty($user->hasRight('contrat', 'lire')) - || !empty($user->hasRight('ficheinter', 'lire')) + 'perms'=>($user->hasRight('propal', 'lire') + || $user->hasRight('commande', 'lire') + || $user->hasRight('supplier_proposal', 'lire') + || $user->hasRight('fournisseur', 'lire') + || $user->hasRight('fournisseur', 'commande', 'lire') + || $user->hasRight('supplier_order', 'lire') + || $user->hasRight('contrat', 'lire') + || $user->hasRight('ficheinter', 'lire') ), 'module'=>'propal|commande|supplier_proposal|supplier_order|contrat|ficheinter' ); - $onlysupplierorder = !empty($user->hasRight('fournisseur', 'commande', 'lire')) && - empty($user->hasRight('propal', 'lire')) && - empty($user->hasRight('commande', 'lire')) && - empty($user->hasRight('supplier_order', 'lire')) && - empty($user->hasRight('supplier_proposal', 'lire')) && - empty($user->hasRight('contrat', 'lire')) && - empty($user->hasRight('ficheinter', 'lire')); + $onlysupplierorder = $user->hasRight('fournisseur', 'commande', 'lire') && + !$user->hasRight('propal', 'lire') && + !$user->hasRight('commande', 'lire') && + !$user->hasRight('supplier_order', 'lire') && + !$user->hasRight('supplier_proposal', 'lire') && + !$user->hasRight('contrat', 'lire') && + !$user->hasRight('ficheinter', 'lire'); $menu_arr[] = array( 'name' => 'Commercial', @@ -283,9 +283,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = isModEnabled('loan') || isModEnabled('margins') ) ? 1 : 0, - 'perms'=>(!empty($user->hasRight('facture', 'lire')) || !empty($user->hasRight('don', 'contact', 'lire')) - || !empty($user->hasRight('tax', 'charges', 'lire')) || !empty($user->hasRight('salaries', 'read')) - || !empty($user->hasRight('fournisseur', 'facture', 'lire')) || !empty($user->hasRight('loan', 'read')) || !empty($user->hasRight('margins', 'liretous'))), + 'perms'=>($user->hasRight('facture', 'lire') || $user->hasRight('don', 'contact', 'lire') + || $user->hasRight('tax', 'charges', 'lire') || $user->hasRight('salaries', 'read') + || $user->hasRight('fournisseur', 'facture', 'lire') || $user->hasRight('loan', 'read') || $user->hasRight('margins', 'liretous')), 'module'=>'facture|supplier_invoice|don|tax|salaries|loan' ); $menu_arr[] = array( @@ -310,7 +310,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Bank $tmpentry = array( 'enabled'=>(isModEnabled('banque') || isModEnabled('prelevement')), - 'perms'=>(!empty($user->hasRight('banque', 'lire')) || !empty($user->hasRight('prelevement', 'lire')) || !empty($user->hasRight('paymentbybanktransfer', 'read'))), + 'perms'=>($user->hasRight('banque', 'lire') || $user->hasRight('prelevement', 'lire') || $user->hasRight('paymentbybanktransfer', 'read')), 'module'=>'banque|prelevement|paymentbybanktransfer' ); $menu_arr[] = array( @@ -335,7 +335,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Accounting $tmpentry = array( 'enabled'=>(isModEnabled('comptabilite') || isModEnabled('accounting') || isModEnabled('asset') || isModEnabled('intracommreport')), - 'perms'=>(!empty($user->hasRight('compta', 'resultat', 'lire')) || !empty($user->hasRight('accounting', 'comptarapport', 'lire')) || !empty($user->hasRight('accounting', 'mouvements', 'lire')) || !empty($user->hasRight('asset', 'read')) || !empty($user->hasRight('intracommreport', 'read'))), + 'perms'=>($user->hasRight('compta', 'resultat', 'lire') || $user->hasRight('accounting', 'comptarapport', 'lire') || $user->hasRight('accounting', 'mouvements', 'lire') || $user->hasRight('asset', 'read') || $user->hasRight('intracommreport', 'read')), 'module'=>'comptabilite|accounting|asset|intracommreport' ); $menu_arr[] = array( @@ -360,7 +360,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // HRM $tmpentry = array( 'enabled'=>(isModEnabled('hrm') || (isModEnabled('holiday')) || isModEnabled('deplacement') || isModEnabled('expensereport') || isModEnabled('recruitment')), - 'perms'=>(!empty($user->hasRight('user', 'user', 'lire')) || !empty($user->hasRight('holiday', 'read')) || !empty($user->hasRight('deplacement', 'lire')) || !empty($user->hasRight('expensereport', 'lire')) || !empty($user->hasRight('recruitment', 'recruitmentjobposition', 'read'))), + 'perms'=>($user->hasRight('user', 'user', 'lire') || $user->hasRight('holiday', 'read') || $user->hasRight('deplacement', 'lire') || $user->hasRight('expensereport', 'lire') || $user->hasRight('recruitment', 'recruitmentjobposition', 'read')), 'module'=>'hrm|holiday|deplacement|expensereport|recruitment' ); @@ -386,7 +386,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = // Tickets and knowledge base $tmpentry = array( 'enabled'=>(isModEnabled('ticket') || isModEnabled('knowledgemanagement')), - 'perms'=>(!empty($user->hasRight('ticket', 'read')) || !empty($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read'))), + 'perms'=>($user->hasRight('ticket', 'read') || $user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')), 'module'=>'ticket|knowledgemanagement' ); $link = ''; @@ -1658,7 +1658,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef } // Journals - if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->hasRight('accounting', 'comptarapport', 'lire'), '', '', ''); // Multi journal @@ -1759,7 +1759,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef } $modecompta = 'CREANCES-DETTES'; - if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { $modecompta = 'BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED } if ($modecompta) { @@ -1773,7 +1773,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef } $modecompta = 'RECETTES-DEPENSES'; - //if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + //if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED if ($modecompta) { if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/', $leftmenu)) { $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ReportTurnoverCollected"), 2, $user->hasRight('accounting', 'comptarapport', 'lire')); @@ -1785,7 +1785,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef } $modecompta = 'CREANCES-DETTES'; - if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { $modecompta = 'BOOKKEEPING'; // Not yet implemented. } if ($modecompta && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) { @@ -1797,7 +1797,7 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef } $modecompta = 'RECETTES-DEPENSES'; - if (isModEnabled('accounting') && !empty($user->hasRight('accounting', 'comptarapport', 'lire')) && $mainmenu == 'accountancy') { + if (isModEnabled('accounting') && $user->hasRight('accounting', 'comptarapport', 'lire') && $mainmenu == 'accountancy') { $modecompta = 'BOOKKEEPINGCOLLECTED'; // Not yet implemented. } if ($modecompta && ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled('supplier_invoice'))) { @@ -1881,10 +1881,10 @@ function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $lef $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuAssets"), 0, $user->hasRight('asset', 'read'), '', $mainmenu, 'asset', 100, '', '', '', img_picto('', 'payment', 'class="paddingright pictofixedwidth"')); $newmenu->add("/asset/card.php?leftmenu=asset&action=create", $langs->trans("MenuNewAsset"), 1, $user->hasRight('asset', 'write')); $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->hasRight('asset', 'read')); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->hasRight('asset', 'model_advance', 'read'))), '', $mainmenu, 'asset_model'); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuAssetModels"), 1, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'model_advance', 'read')), '', $mainmenu, 'asset_model'); if ($usemenuhider || empty($leftmenu) || preg_match('/asset_model/', $leftmenu)) { - $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->hasRight('asset', 'model_advance', 'write')))); - $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->hasRight('asset', 'model_advance', 'read')))); + $newmenu->add("/asset/model/card.php?leftmenu=asset_model&action=create", $langs->trans("MenuNewAssetModel"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'model_advance', 'write'))); + $newmenu->add("/asset/model/list.php?leftmenu=asset_model", $langs->trans("MenuListAssetModels"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'model_advance', 'read'))); } } } @@ -2165,8 +2165,8 @@ function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftme $search_project_user = GETPOST('search_project_user', 'int'); $tmpentry = array( - 'enabled'=>(isModEnabled('projet')), - 'perms'=>(!empty($user->hasRight('projet', 'lire'))), + 'enabled'=>isModEnabled('projet'), + 'perms'=>$user->hasRight('projet', 'lire'), 'module'=>'projet' ); $listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); From 967e2033193105c54297a4fcb31a6740b0aea6c4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 13:55:02 +0200 Subject: [PATCH 284/453] Fix fetch missing fields --- htdocs/fourn/facture/card.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index b928cc5bdf9..75aa5898574 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2643,7 +2643,7 @@ if ($action == 'create') { * View card */ $objectidnext = $object->getIdReplacingInvoice(); - + $head = facturefourn_prepare_head($object); $titre = $langs->trans('SupplierInvoice'); @@ -3305,7 +3305,10 @@ if ($action == 'create') { $paymentstatic->datepaye = $db->jdate($objp->dp); $paymentstatic->ref = ($objp->ref ? $objp->ref : $objp->rowid); $paymentstatic->num_payment = $objp->num_payment; + $paymentstatic->paiementcode = $objp->payment_code; + $paymentstatic->type_code = $objp->payment_code; + $paymentstatic->type_label = $objp->payment_type; print '
'; From aa560db06de3a75e22fac74db00503c20ef06de7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 13:58:24 +0200 Subject: [PATCH 285/453] Fix regression --- htdocs/compta/facture/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index f60f1da089d..dd322bd8245 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2238,7 +2238,7 @@ if (empty($reshook)) { $type = GETPOST('type'); $fk_unit = GETPOST('units', 'alpha'); } - + $pu_ht_devise = price2num($price_ht_devise, 'MU'); // Margin @@ -2287,7 +2287,7 @@ if (empty($reshook)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; - if (!empty-$conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { From ea6f751fd3a27457613aad536088c8ea0675a73e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 14:21:36 +0200 Subject: [PATCH 286/453] Update card.php --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d56f9419989..723ff70139d 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -602,7 +602,7 @@ if (empty($reshook)) { $result = $object->create($user); - if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email)) { + if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email) && !empty($object->no_email)) { // Add mass emailing flag into table mailing_unsubscribe $result = $object->setNoEmail($object->no_email); if ($result < 0) { From 56f1964c68e19b0db6e28eb5f97dae1b96be7ce3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 14:23:24 +0200 Subject: [PATCH 287/453] Update card.php --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 723ff70139d..cc0b92fca00 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -602,7 +602,7 @@ if (empty($reshook)) { $result = $object->create($user); - if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email) && !empty($object->no_email)) { + if (empty($error) && !empty($conf->mailing->enabled) && !empty($object->email) && $object->no_email == 1) { // Add mass emailing flag into table mailing_unsubscribe $result = $object->setNoEmail($object->no_email); if ($result < 0) { From de1de589b3769e5aa185936e485fe2866774df20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 7 Sep 2022 15:37:58 +0200 Subject: [PATCH 288/453] Update thirdparties.modules.php --- htdocs/core/modules/mailings/thirdparties.modules.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 1d7acf02c09..335e3ac575a 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -317,11 +317,11 @@ class mailing_thirdparties extends MailingTargets $s .= ajax_combobox("filter_status_thirdparties"); if (!empty($conf->global->MAIN_MULTILANGS)) { - // Choose language - require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; - $formadmin = new FormAdmin($this->db); - $s .= ''.$langs->trans("DefaultLang").': '; - $s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang_thirdparties', 0, null, 1, 0, 0, '', 0, 0, 0, null, 1); + // Choose language + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; + $formadmin = new FormAdmin($this->db); + $s .= ''.$langs->trans("DefaultLang").': '; + $s .= $formadmin->select_language($langs->getDefaultLang(1), 'filter_lang_thirdparties', 0, null, 1, 0, 0, '', 0, 0, 0, null, 1); } return $s; From 50169bc96a8cec3533c3d3fc2e50f2c288a57494 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 15:50:40 +0200 Subject: [PATCH 289/453] Clean code --- htdocs/admin/menus/edit.php | 31 ++++--- htdocs/core/lib/functions.lib.php | 8 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/en_US/modulebuilder.lang | 1 + htdocs/modulebuilder/index.php | 114 ++++++++++++++++++-------- 5 files changed, 106 insertions(+), 50 deletions(-) diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index 471b34866a7..64c3f4a7015 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -295,11 +295,13 @@ if ($action == 'create') { // User print '
'.$langs->trans('MenuForUsers').''.$langs->trans('DetailUser').'
'.$langs->trans('Id').''.$menu->id.''.$langs->trans('DetailId').'
'.$langs->trans('MenuModule').''.$menu->module.''.$langs->trans('DetailMenuModule').'
'.$langs->trans('MenuModule').''.(empty($menu->module) ? 'Core' : $menu->module).''.$langs->trans('DetailMenuModule').'
'.$langs->trans('MenuHandler').''.$handler.''.$langs->trans('DetailMenuHandler').'
'.$langs->trans('MenuForUsers').'
'.$langs->trans('MenuForUsers').''; + print ''.$langs->trans('DetailUser').'
'.$langs->trans('DetailUser').'
'.$langs->trans('Type').'
'.$langs->trans('Position').''.$langs->trans(ucfirst($menu->type)).''.$langs->trans('DetailType').'
'.$langs->trans('Position').''.$langs->trans('DetailPosition').'
'.$langs->trans('Target').''.$langs->trans('DetailTarget').'
'.$langs->trans('Enabled').''.$langs->trans('DetailEnabled'); @@ -485,6 +484,14 @@ if ($action == 'create') { } print '
'.$langs->trans('Target').''; + print ajax_combobox("target"); + print ''.$langs->trans('DetailTarget').'
'; print dol_get_fiche_end(); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8a5751d72b3..1bb48831113 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5118,8 +5118,12 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin $out .= '>'; } if ($tooltip) { - // You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. - $tmptooltip = explode(':', $tooltip); + // You can also use 'TranslationString:keyfortooltiponclick' for a tooltip on click. + if (preg_match('/:\w+$/', $tooltip)) { + $tmptooltip = explode(':', $tooltip); + } else { + $tmptooltip = array($tooltip); + } $out .= $form->textwithpicto($langs->trans($name), $langs->trans($tmptooltip[0]), 1, 'help', '', 0, 3, (empty($tmptooltip[1]) ? '' : 'extra_'.str_replace('.', '_', $field).'_'.$tmptooltip[1])); } else { $out .= $langs->trans($name); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cbec6cfc5ea..d82631cc8fa 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1767,7 +1767,7 @@ DetailMenuHandler=Menu handler where to show new menu DetailMenuModule=Module name if menu entry come from a module DetailType=Type of menu (top or left) DetailTitre=Menu label or label code for translation -DetailUrl=URL where menu send you (Absolute URL link or external link with http://) +DetailUrl=URL where menu send you (Relative URL link or external link with https://) DetailEnabled=Condition to show or not entry DetailRight=Condition to display unauthorized grey menus DetailLangs=Lang file name for label code translation diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index cab8fa37f16..53e60fa0fbd 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -50,6 +50,7 @@ PathToModulePackage=Path to zip of module/application package PathToModuleDocumentation=Path to file of module/application documentation (%s) SpaceOrSpecialCharAreNotAllowed=Spaces or special characters are not allowed. FileNotYetGenerated=File not yet generated +GenerateCode=Generate code RegenerateClassAndSql=Force update of .class and .sql files RegenerateMissingFiles=Generate missing files SpecificationFile=File of documentation diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 81da2909779..7e086887a37 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2090,10 +2090,12 @@ if ($module == 'initmodule') { //print ''.$langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $newdircustom).'
'; print '
'; - print ''.$langs->trans("ModuleName").' '; - print ' '.$form->textwithpicto('', $langs->trans("EnterNameOfModuleDesc")).'
'; + print '
'; - print ''.$langs->trans("IdModule").' '; + print '
'; + print ''.$langs->trans("IdModule").''; + print '
'; + print ''; print ''; print '   ('; print dolButtonToOpenUrlInDialogPopup('popup_modules_id', $langs->transnoentitiesnoconv("SeeIDsInUse"), $langs->transnoentitiesnoconv("SeeIDsInUse"), '/admin/system/modules.php?mainmenu=home&leftmenu=admintools_info', '', ''); @@ -2101,9 +2103,30 @@ if ($module == 'initmodule') { print ''.$langs->trans("SeeReservedIDsRangeHere").''; print ')'; print ''; - print '
'; - print ''.$langs->trans("Version").'
'; - print ''.$langs->trans("Family").' '; + print '
'; + + print '
'; + print ''.$langs->trans("ModuleName").''; + print '
'; + print ''; + print ' '.$form->textwithpicto('', $langs->trans("EnterNameOfModuleDesc")); + print '
'; + + print '
'; + print ''.$langs->trans("Description").''; + print '
'; + print '
'; + print '
'; + + print '
'; + print ''.$langs->trans("Version").''; + print '
'; + print ''; + print '
'; + + print '
'; + print ''.$langs->trans("Family").''; + print '
'; print '
'; + print ''; print ajax_combobox("family"); - print ''.$langs->trans("Picto").' '; - print $form->textwithpicto('', $langs->trans("Example").': fa-generic, fa-globe, ... any font awesome code.
Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]'); - print '
'; - print ''.$langs->trans("Description").'
'; + print '
'; - print ''.$langs->trans("EditorName").'
'; - print ''.$langs->trans("EditorUrl").'
'; + print '
'; + print ''.$langs->trans("Picto").''; + print '
'; + print ''; + print $form->textwithpicto('', $langs->trans("Example").': fa-generic, fa-globe, ... any font awesome code.
Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]'); + print '
'; + + print '
'; + print ''.$langs->trans("EditorName").''; + print '
'; + print '
'; + print '
'; + + print '
'; + print ''.$langs->trans("EditorUrl").''; + print '
'; + print '
'; + print '
'; print '
'; print ''; @@ -2273,7 +2309,7 @@ if ($module == 'initmodule') { print '
'; print '
'; - print load_fiche_titre($form->textwithpicto($langs->trans("DescriptorFile"), $pathtofile), '', ''); + print load_fiche_titre($form->textwithpicto($langs->trans("DescriptorFile"), $langs->transnoentitiesnoconv("File").' '.$pathtofile), '', ''); if (!empty($moduleobj)) { print '
'; @@ -2287,7 +2323,7 @@ if ($module == 'initmodule') { print '
'; - print $langs->trans("Numero"); + print $langs->trans("IdModule"); print ''; print $moduleobj->numero; print ''; @@ -2297,11 +2333,17 @@ if ($module == 'initmodule') { print '
'; - print $langs->trans("Name"); + print $langs->trans("ModuleName"); print ''; print $moduleobj->getName(); print '
'; + print $langs->trans("Description"); + print ''; + print $moduleobj->getDesc(); + print '
'; print $langs->trans("Version"); print ''; @@ -2322,12 +2364,6 @@ if ($module == 'initmodule') { print '   '.img_picto('', $moduleobj->picto, 'class="valignmiddle pictomodule paddingrightonly"'); print '
'; - print $langs->trans("Description"); - print ''; - print $moduleobj->getDesc(); - print '
'; print $langs->trans("EditorName"); print ''; @@ -2351,7 +2387,7 @@ if ($module == 'initmodule') { print '

'; // Readme file - print load_fiche_titre($form->textwithpicto($langs->trans("ReadmeFile"), $pathtofilereadme), '', ''); + print load_fiche_titre($form->textwithpicto($langs->trans("ReadmeFile"), $langs->transnoentitiesnoconv("File").' '.$pathtofilereadme), '', ''); print ''; if (dol_is_file($dirread.'/'.$pathtofilereadme)) { @@ -2363,7 +2399,7 @@ if ($module == 'initmodule') { print '

'; // ChangeLog - print load_fiche_titre($form->textwithpicto($langs->trans("ChangeLog"), $pathtochangelog), '', ''); + print load_fiche_titre($form->textwithpicto($langs->trans("ChangeLog"), $langs->transnoentitiesnoconv("File").' '.$pathtochangelog), '', ''); print ''; if (dol_is_file($dirread.'/'.$pathtochangelog)) { @@ -2555,7 +2591,7 @@ if ($module == 'initmodule') { print '
'; print '
'; print '
'; - print ''; + print ''; print '
'; print '
'; print '
'; @@ -2565,7 +2601,7 @@ if ($module == 'initmodule') { //print ' '; print $langs->trans("InitStructureFromExistingTable"); print ''; - print ''; + print ''; print '
'; print ''; @@ -3373,7 +3409,7 @@ if ($module == 'initmodule') { print '
'; //print '
'; //print '
'; - print ''; + print ''; /*print '
'; print '
'; print '
'; @@ -3383,7 +3419,7 @@ if ($module == 'initmodule') { //print ' '; print $langs->trans("InitStructureFromExistingTable"); print ''; - print ''; + print ''; print '
'; */ print ''; @@ -3464,18 +3500,18 @@ if ($module == 'initmodule') { print '
'; - print dol_escape_htmltag($menu['user']); + if ($menu['user'] == 2) { + print $langs->trans("AllMenus"); + } elseif ($menu['user'] == 0) { + print $langs->trans('Internal'); + } elseif ($menu['user'] == 1) { + print $langs->trans('External'); + } else { + print $menu['user']; // should not happen + } print '
'.$langs->trans('DetailUser').'
'.$langs->trans('Type').''; + print '
'.$langs->trans('Position').''; if ($parent_rowid) { print $langs->trans('Left'); print ''; @@ -315,6 +315,7 @@ if ($action == 'create') { print ''; print ''; print ''; + print ajax_combobox('topleft'); } print ''.$langs->trans('DetailType').'
'.$langs->trans('Position').''.$langs->trans('DetailPosition').'
'.$langs->trans('Target').''.$langs->trans('DetailTarget').'
'.$langs->trans('Enabled').''.$langs->trans('DetailEnabled').'
'.$langs->trans('Rights').''.$langs->trans('DetailRight').'
'.$langs->trans('Target').''; + print ajax_combobox("target"); + print ''.$langs->trans('DetailTarget').'
'; print dol_get_fiche_end(); diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 1c4a18a9c1f..a0d0dd2758e 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -343,6 +343,8 @@ class FormAdmin print ''."\n"; } print ''; + + print ajax_combobox($htmlname); } From 9835469a02efd96a210482c5ff9db4eec2f8080f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 16:27:31 +0200 Subject: [PATCH 293/453] Update propal.class.php --- htdocs/comm/propal/class/propal.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index cd56fac3e7b..e2b128f8cd0 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -384,7 +384,7 @@ class Propal extends CommonObject $this->socid = $socid; $this->id = $propalid; - $this->duree_validite = isset($conf->global->PROPALE_VALIDITY_DURATION)?((int) $conf->global->PROPALE_VALIDITY_DURATION):0; + $this->duree_validite = getDolGlobalInt('PROPALE_VALIDITY_DURATION', 0); } From 9d4bc513be3ff8740caa33b1deb304f1233a7352 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 16:39:19 +0200 Subject: [PATCH 294/453] Fix regression --- htdocs/core/boxes/box_activity.php | 2 +- .../core/boxes/box_dolibarr_state_board.php | 2 +- htdocs/core/boxes/box_propales.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 22 +++++++++---------- htdocs/index.php | 2 +- htdocs/user/class/user.class.php | 1 + 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 017c5fe3d02..fb0a60b567f 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -64,7 +64,7 @@ class box_activity extends ModeleBoxes $this->hidden = !((isModEnabled('facture') && $user->hasRight('facture', 'read')) || (isModEnabled('commande') && $user->hasRight('commande', 'read')) - || (isModEnabled('propal') && $user->hasRight('propale', 'read')) + || (isModEnabled('propal') && $user->hasRight('propal', 'read')) ); } diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index a979e3e5a36..1efd1d27f95 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -124,7 +124,7 @@ class box_dolibarr_state_board extends ModeleBoxes 'contacts' => isModEnabled('societe') && $user->hasRight('societe', 'contact', 'lire'), 'products' => isModEnabled('product') && $user->hasRight('produit', 'lire'), 'services' => isModEnabled('service') && $user->hasRight('service', 'lire'), - 'proposals' => isModEnabled('propal') && $user->hasRight('propale', 'lire'), + 'proposals' => isModEnabled('propal') && $user->hasRight('propal', 'read'), 'orders' => isModEnabled('commande') && $user->hasRight('commande', 'lire'), 'invoices' => isModEnabled('facture') && $user->hasRight('facture', 'lire'), 'donations' => isModEnabled('don') && $user->hasRight('don', 'lire'), diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 8e8efc8d8f3..7114fdb5399 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -61,7 +61,7 @@ class box_propales extends ModeleBoxes $this->db = $db; - $this->hidden = !($user->hasRight('propale', 'lire')); + $this->hidden = !($user->hasRight('propal', 'read')); } /** diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 66f85c3739c..a1b505da46a 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -234,7 +234,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = || isModEnabled('contrat') || isModEnabled('ficheinter') ) ? 1 : 0, - 'perms'=>($user->hasRight('propal', 'lire') + 'perms'=>($user->hasRight('propal', 'read') || $user->hasRight('commande', 'lire') || $user->hasRight('supplier_proposal', 'lire') || $user->hasRight('fournisseur', 'lire') @@ -1294,18 +1294,18 @@ function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $left // Customer proposal if (isModEnabled('propal')) { $langs->load("propal"); - $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->hasRight('propale', 'lire'), '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); - $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->hasRight('propale', 'creer')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->hasRight('propale', 'lire')); + $newmenu->add("/comm/propal/index.php?leftmenu=propals", $langs->trans("Proposals"), 0, $user->hasRight('propal', 'read'), '', $mainmenu, 'propals', 100, '', '', '', img_picto('', 'propal', 'class="paddingright pictofixedwidth"')); + $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->hasRight('propal', 'write')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->hasRight('propal', 'read')); if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") { - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->hasRight('propale', 'lire')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->hasRight('propale', 'lire')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->hasRight('propale', 'lire')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->hasRight('propale', 'lire')); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->hasRight('propale', 'lire')); - //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->hasRight('propale', 'lire')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->hasRight('propal', 'read')); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->hasRight('propal', 'read')); + //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->hasRight('propal', 'read')); } - $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->hasRight('propale', 'lire')); + $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->hasRight('propal', 'read')); } // Customers orders diff --git a/htdocs/index.php b/htdocs/index.php index 2a0a163f44e..97b82fb93ba 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -176,7 +176,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) { } // Number of commercial customer proposals open (expired) - if (isModEnabled('propal') && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->hasRight('propale', 'lire')) { + if (isModEnabled('propal') && empty($conf->global->MAIN_DISABLE_BLOCK_CUSTOMER) && $user->hasRight('propal', 'read')) { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $board = new Propal($db); $dashboardlines[$board->element.'_opened'] = $board->load_board($user, "opened"); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 54f1cbe4fc9..a09811b21fc 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -713,6 +713,7 @@ class User extends CommonObject 'order' => 'commande', //'product' => 'produit', // We must check $user->rights->produit... 'project' => 'projet', + 'propale' => 'propal', 'shipping' => 'expedition', 'task' => 'task@projet', 'fichinter' => 'ficheinter', From 46925dc9c41740987673a03dba47308d3c7adb38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Sep 2022 17:02:08 +0200 Subject: [PATCH 295/453] CSS --- htdocs/comm/propal/card.php | 133 +------------------------- htdocs/core/class/html.form.class.php | 3 +- 2 files changed, 7 insertions(+), 129 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 21a9612c829..52e2f9beb83 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2061,129 +2061,6 @@ if ($action == 'create') { $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); - if (! empty($deposit_percent_from_payment_terms) && ! empty($conf->facture->enabled) && ! empty($user->rights->facture->creer)) { - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; - - $object->fetchObjectLinked(); - - $eligibleForDepositGeneration = true; - - if (array_key_exists('facture', $object->linkedObjects)) { - foreach ($object->linkedObjects['facture'] as $invoice) { - if ($invoice->type == Facture::TYPE_DEPOSIT) { - $eligibleForDepositGeneration = false; - break; - } - } - } - - if ($eligibleForDepositGeneration && array_key_exists('commande', $object->linkedObjects)) { - foreach ($object->linkedObjects['commande'] as $order) { - $order->fetchObjectLinked(); - - if (array_key_exists('facture', $order->linkedObjects)) { - foreach ($order->linkedObjects['facture'] as $invoice) { - if ($invoice->type == Facture::TYPE_DEPOSIT) { - $eligibleForDepositGeneration = false; - break 2; - } - } - } - } - } - - - if ($eligibleForDepositGeneration) { - $formquestion[] = array( - 'type' => 'checkbox', - 'tdclass' => 'showonlyifsigned', - 'name' => 'generate_deposit', - 'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected')) - ); - - $formquestion[] = array( - 'type' => 'date', - 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', - 'name' => 'datef', - 'label' => $langs->trans('DateInvoice'), - 'value' => dol_now(), - 'datenow' => true - ); - - if (! empty($conf->global->INVOICE_POINTOFTAX_DATE)) { - $formquestion[] = array( - 'type' => 'date', - 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', - 'name' => 'date_pointoftax', - 'label' => $langs->trans('DatePointOfTax'), - 'value' => dol_now(), - 'datenow' => true - ); - } - - ob_start(); - $form->select_conditions_paiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200'); - $paymentTermsSelect = ob_get_clean(); - - $formquestion[] = array( - 'type' => 'other', - 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', - 'name' => 'cond_reglement_id', - 'label' => $langs->trans('PaymentTerm'), - 'value' => $paymentTermsSelect - ); - - $formquestion[] = array( - 'type' => 'checkbox', - 'tdclass' => 'showonlyifgeneratedeposit', - 'name' => 'validate_generated_deposit', - 'label' => $langs->trans('ValidateGeneratedDeposit') - ); - - $formquestion[] = array( - 'type' => 'onecolumn', - 'value' => ' - - ' - ); - } - } - - $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); - if (!empty($deposit_percent_from_payment_terms) && isModEnabled('facture') && !empty($user->rights->facture->creer)) { require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; @@ -2221,6 +2098,7 @@ if ($action == 'create') { 'type' => 'checkbox', 'tdclass' => 'showonlyifsigned', 'name' => 'generate_deposit', + 'morecss' => 'margintoponly marginbottomonly', 'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected')) ); @@ -2244,9 +2122,7 @@ if ($action == 'create') { ); } - ob_start(); - $form->select_conditions_paiements(0, 'cond_reglement_id', -1, 0, 0, 'minwidth200'); - $paymentTermsSelect = ob_get_clean(); + $paymentTermsSelect = $form->getSelectConditionsPaiements(0, 'cond_reglement_id', -1, 0, 1, 'minwidth200'); $formquestion[] = array( 'type' => 'other', @@ -2260,6 +2136,7 @@ if ($action == 'create') { 'type' => 'checkbox', 'tdclass' => 'showonlyifgeneratedeposit', 'name' => 'validate_generated_deposit', + 'morecss' => 'margintoponly marginbottomonly', 'label' => $langs->trans('ValidateGeneratedDeposit') ); @@ -2314,9 +2191,9 @@ if ($action == 'create') { } if (empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)) { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 300); } else { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 250); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 300); } } elseif ($action == 'delete') { // Confirm delete diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a738bce9004..41279c8ae36 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4040,6 +4040,7 @@ class Form * 0 : use default deposit percentage from entry * > 0 : force deposit percentage (for example, from company object) * @return void + * @deprecated */ public function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '', $deposit_percent = -1) { @@ -5013,7 +5014,7 @@ class Form } elseif ($input['type'] == 'checkbox') { $more .= '
'; $more .= '
'.$input['label'].'
'; - $more .= ' Date: Wed, 7 Sep 2022 17:15:34 +0200 Subject: [PATCH 296/453] Fix conflict in workflow due to new feature --- htdocs/comm/propal/card.php | 206 +++++++++++++++++++----------------- 1 file changed, 106 insertions(+), 100 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 52e2f9beb83..c4f620f6686 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2059,126 +2059,132 @@ if ($action == 'create') { } $formquestion[] = array('type' => 'text', 'name' => 'note_private', 'label' => $langs->trans("Note"), 'value' => ''); // Field to complete private note (not replace) - $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); + if (getDolGlobalInt('PROPOSAL_SUGGEST_DOWN_PAYMENT_INVOICE_CREATION')) { + // This is a hidden option: + // Suggestion to create invoice during proposal signature is not enabled by default. + // Such choice should be managed by the workflow module and trigger. This option generates conflicts with some setup. + // It may also break step of creating an order when invoicing must be done from orders and not from proposal + $deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id); - if (!empty($deposit_percent_from_payment_terms) && isModEnabled('facture') && !empty($user->rights->facture->creer)) { - require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + if (!empty($deposit_percent_from_payment_terms) && isModEnabled('facture') && !empty($user->rights->facture->creer)) { + require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; - $object->fetchObjectLinked(); + $object->fetchObjectLinked(); - $eligibleForDepositGeneration = true; + $eligibleForDepositGeneration = true; - if (array_key_exists('facture', $object->linkedObjects)) { - foreach ($object->linkedObjects['facture'] as $invoice) { - if ($invoice->type == Facture::TYPE_DEPOSIT) { - $eligibleForDepositGeneration = false; - break; + if (array_key_exists('facture', $object->linkedObjects)) { + foreach ($object->linkedObjects['facture'] as $invoice) { + if ($invoice->type == Facture::TYPE_DEPOSIT) { + $eligibleForDepositGeneration = false; + break; + } } } - } - if ($eligibleForDepositGeneration && array_key_exists('commande', $object->linkedObjects)) { - foreach ($object->linkedObjects['commande'] as $order) { - $order->fetchObjectLinked(); + if ($eligibleForDepositGeneration && array_key_exists('commande', $object->linkedObjects)) { + foreach ($object->linkedObjects['commande'] as $order) { + $order->fetchObjectLinked(); - if (array_key_exists('facture', $order->linkedObjects)) { - foreach ($order->linkedObjects['facture'] as $invoice) { - if ($invoice->type == Facture::TYPE_DEPOSIT) { - $eligibleForDepositGeneration = false; - break 2; + if (array_key_exists('facture', $order->linkedObjects)) { + foreach ($order->linkedObjects['facture'] as $invoice) { + if ($invoice->type == Facture::TYPE_DEPOSIT) { + $eligibleForDepositGeneration = false; + break 2; + } } } } } - } - if ($eligibleForDepositGeneration) { - $formquestion[] = array( - 'type' => 'checkbox', - 'tdclass' => 'showonlyifsigned', - 'name' => 'generate_deposit', - 'morecss' => 'margintoponly marginbottomonly', - 'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected')) - ); + if ($eligibleForDepositGeneration) { + $formquestion[] = array( + 'type' => 'checkbox', + 'tdclass' => 'showonlyifsigned', + 'name' => 'generate_deposit', + 'morecss' => 'margintoponly marginbottomonly', + 'label' => $form->textwithpicto($langs->trans('GenerateDeposit', $object->deposit_percent), $langs->trans('DepositGenerationPermittedByThePaymentTermsSelected')) + ); - $formquestion[] = array( - 'type' => 'date', - 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', - 'name' => 'datef', - 'label' => $langs->trans('DateInvoice'), - 'value' => dol_now(), - 'datenow' => true - ); - - if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { $formquestion[] = array( 'type' => 'date', 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', - 'name' => 'date_pointoftax', - 'label' => $langs->trans('DatePointOfTax'), + 'name' => 'datef', + 'label' => $langs->trans('DateInvoice'), 'value' => dol_now(), 'datenow' => true ); + + if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) { + $formquestion[] = array( + 'type' => 'date', + 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', + 'name' => 'date_pointoftax', + 'label' => $langs->trans('DatePointOfTax'), + 'value' => dol_now(), + 'datenow' => true + ); + } + + $paymentTermsSelect = $form->getSelectConditionsPaiements(0, 'cond_reglement_id', -1, 0, 1, 'minwidth200'); + + $formquestion[] = array( + 'type' => 'other', + 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', + 'name' => 'cond_reglement_id', + 'label' => $langs->trans('PaymentTerm'), + 'value' => $paymentTermsSelect + ); + + $formquestion[] = array( + 'type' => 'checkbox', + 'tdclass' => 'showonlyifgeneratedeposit', + 'name' => 'validate_generated_deposit', + 'morecss' => 'margintoponly marginbottomonly', + 'label' => $langs->trans('ValidateGeneratedDeposit') + ); + + $formquestion[] = array( + 'type' => 'onecolumn', + 'value' => ' + + ' + ); } - - $paymentTermsSelect = $form->getSelectConditionsPaiements(0, 'cond_reglement_id', -1, 0, 1, 'minwidth200'); - - $formquestion[] = array( - 'type' => 'other', - 'tdclass' => 'fieldrequired showonlyifgeneratedeposit', - 'name' => 'cond_reglement_id', - 'label' => $langs->trans('PaymentTerm'), - 'value' => $paymentTermsSelect - ); - - $formquestion[] = array( - 'type' => 'checkbox', - 'tdclass' => 'showonlyifgeneratedeposit', - 'name' => 'validate_generated_deposit', - 'morecss' => 'margintoponly marginbottomonly', - 'label' => $langs->trans('ValidateGeneratedDeposit') - ); - - $formquestion[] = array( - 'type' => 'onecolumn', - 'value' => ' - - ' - ); } } @@ -2191,9 +2197,9 @@ if ($action == 'create') { } if (empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)) { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 300); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); } else { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 300); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?statut=3&id=' . $object->id, $langs->trans('Close'), $text, 'confirm_closeas', $formquestion, '', 1, 250); } } elseif ($action == 'delete') { // Confirm delete From acdac6552bdad0727cf0a0ae249f4688c1ce48b9 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 7 Sep 2022 17:49:39 +0200 Subject: [PATCH 297/453] FIX : inventory total columns --- htdocs/product/inventory/inventory.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 00523c6bf3d..e2455b30372 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -950,19 +950,23 @@ if ($object->id > 0) { print ''; } print ''; - print ''; - print ''; - print ''; if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { print ''; print ''; print ''; print ''; print ''; + print ''; print ''; print ''; print ''; - } + print ''; + print ''; + } else { + print ''; + print ''; + print ''; + } // Actions print ''; print ''; @@ -1160,9 +1164,9 @@ if ($object->id > 0) { } if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { print ''; - print ''.$langs->trans("Total").''; + print ''.$langs->trans("Total").''; print ''.price($totalExpectedValuation).''; - print ''.price($totalRealValuation).''; + print ''.price($totalRealValuation).''; print ''; print ''; } From 24a61b57db3c555fab101e1195edefed927a9fd5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 7 Sep 2022 16:09:08 +0000 Subject: [PATCH 298/453] Fixing style errors. --- htdocs/product/inventory/inventory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index e2455b30372..b33e471c3e4 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -966,7 +966,7 @@ if ($object->id > 0) { print ''; print ''; print ''; - } + } // Actions print ''; print ''; From 8a742df8de72db5f4a18b0cf6f021f628c4d9958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 7 Sep 2022 18:38:00 +0200 Subject: [PATCH 299/453] select2 multimatch --- htdocs/core/lib/ajax.lib.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 3e1af30ddd2..ef3498b0c71 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -448,20 +448,32 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = $tmpplugin = 'select2'; $msg = "\n".' - - ' - ); + + ' + ); + } } } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 6984255b91c..ef485f62b5f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1507,7 +1507,7 @@ if ($resql) { // Payment term if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) { print ''; - $form->select_conditions_paiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1); + print $form->getSelectConditionsPaiements($search_fk_cond_reglement, 'search_fk_cond_reglement', 1, 1, 1); print ''; } // Payment mode diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index aadaf3895e9..3edefe8f159 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3670,7 +3670,7 @@ if ($action == 'create') { // Payment term print ''.$langs->trans('PaymentConditionsShort').''; - $form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); + print $form->getSelectConditionsPaiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id'); print ''; @@ -3702,7 +3702,7 @@ if ($action == 'create') { $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; } } - $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); + print $form->getSelectConditionsPaiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); print ''; print ''; echo $dialog; if ($parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { - echo ''; + echo ''; } elseif ($parameters['currentcontext'] == 'membercard') { - echo ''; + echo ''; } elseif ($parameters['currentcontext'] == 'contactcard') { - echo ''; + echo ''; } if (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { - echo ''; + echo ''; } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'membercard') { - echo ''; + echo ''; } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicy_send']) && $parameters['currentcontext'] == 'contactcard') { - echo ''; + echo ''; } } } @@ -412,7 +412,7 @@ class ActionsDatapolicy if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $form = new Form($this->db); - echo $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1); + echo $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".GETPOST('socid'), substr($langs->trans("DATAPOLICY_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICY_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICY_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1); } } diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index d0cf2e48434..7bbe8d7c1a6 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -23,6 +23,7 @@ include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; /** @@ -161,17 +162,17 @@ class DataPolicy $from = $user->getFullName($langs).' <'.$user->email.'>'; $sendto = $contact->email; - $code = md5($contact->email); + $code = dol_hash($contact->email, 'md5'); if (!empty($contact->default_lang)) { $l = $contact->default_lang; } else { $l = $langs->defaultlang; } // TODO Use a dolibarr email template - $s = "DATAPOLICIESSUBJECT_".$l; - $ma = "DATAPOLICIESCONTENT_".$l; - $la = 'TXTLINKDATAPOLICIESACCEPT_'.$l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_'.$l; + $s = "DATAPOLICYSUBJECT_".$l; + $ma = "DATAPOLICYCONTENT_".$l; + $la = 'TXTLINKDATAPOLICYACCEPT_'.$l; + $lr = 'TXTLINKDATAPOLICYREFUSE_'.$l; $subject = $conf->global->$s; $message = $conf->global->$ma; @@ -182,8 +183,8 @@ class DataPolicy $deliveryreceipt = 0; $substitutionarray = array( - '__LINKACCEPT__' => ''.$linka.'', - '__LINKREFUSED__' => ''.$linkr.'', + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', '__FIRSTNAME__' => $contact->firstname, '__NAME__' => $contact->lastname, '__CIVILITY__' => $contact->civility, @@ -238,17 +239,17 @@ class DataPolicy $sendto = $societe->email; - $code = md5($societe->email); + $code = dol_hash($societe->email, 'md5'); if (!empty($societe->default_lang)) { $l = $societe->default_lang; } else { $l = $langs->defaultlang; } // TODO Use a dolibarr email template - $s = "DATAPOLICIESSUBJECT_".$l; - $ma = "DATAPOLICIESCONTENT_".$l; - $la = 'TXTLINKDATAPOLICIESACCEPT_'.$l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_'.$l; + $s = "DATAPOLICYSUBJECT_".$l; + $ma = "DATAPOLICYCONTENT_".$l; + $la = 'TXTLINKDATAPOLICYACCEPT_'.$l; + $lr = 'TXTLINKDATAPOLICYREFUSE_'.$l; $subject = $conf->global->$s; $message = $conf->global->$ma; @@ -259,8 +260,8 @@ class DataPolicy $deliveryreceipt = 0; $substitutionarray = array( - '__LINKACCEPT__' => ''.$linka.'', - '__LINKREFUSED__' => ''.$linkr.'', + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', ); $subject = make_substitutions($subject, $substitutionarray); $message = make_substitutions($message, $substitutionarray); @@ -311,17 +312,17 @@ class DataPolicy $sendto = $adherent->email; - $code = md5($adherent->email); + $code = dol_hash($adherent->email, 'md5'); if (!empty($adherent->default_lang)) { $l = $adherent->default_lang; } else { $l = $langs->defaultlang; } // TODO Use a dolibarr email template - $s = 'TXTLINKDATAPOLICIESSUBJECT_'.$l; - $ma = 'TXTLINKDATAPOLICIESMESSAGE_'.$l; - $la = 'TXTLINKDATAPOLICIESACCEPT_'.$l; - $lr = 'TXTLINKDATAPOLICIESREFUSE_'.$l; + $s = 'TXTLINKDATAPOLICYSUBJECT_'.$l; + $ma = 'TXTLINKDATAPOLICYMESSAGE_'.$l; + $la = 'TXTLINKDATAPOLICYACCEPT_'.$l; + $lr = 'TXTLINKDATAPOLICYREFUSE_'.$l; $subject = $conf->global->$s; $message = $conf->global->$ma; @@ -332,8 +333,8 @@ class DataPolicy $deliveryreceipt = 0; $substitutionarray = array( - '__LINKACCEPT__' => ''.$linka.'', - '__LINKREFUSED__' => ''.$linkr.'', + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', ); $subject = make_substitutions($subject, $substitutionarray); $message = make_substitutions($message, $substitutionarray); diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 965d93754f7..44152f0c68b 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -56,7 +56,7 @@ class DataPolicyCron // FIXME Exclude data from the selection if there is at least 1 invoice. $arrayofparameters = array( - 'DATAPOLICIES_TIERS_CLIENT' => array( + 'DATAPOLICY_TIERS_CLIENT' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s WHERE s.entity = %d @@ -90,7 +90,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_TIERS_PROSPECT' => array( + 'DATAPOLICY_TIERS_PROSPECT' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s WHERE s.entity = %d @@ -124,7 +124,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_TIERS_PROSPECT_CLIENT' => array( + 'DATAPOLICY_TIERS_PROSPECT_CLIENT' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s WHERE s.entity = %d @@ -158,7 +158,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT' => array( + 'DATAPOLICY_TIERS_NIPROSPECT_NICLIENT' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s WHERE s.entity = %d @@ -192,7 +192,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_TIERS_FOURNISSEUR' => array( + 'DATAPOLICY_TIERS_FOURNISSEUR' => array( 'sql' => " SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s WHERE s.entity = %d @@ -225,7 +225,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_CONTACT_CLIENT' => array( + 'DATAPOLICY_CONTACT_CLIENT' => array( 'sql' => " SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc @@ -263,7 +263,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_CONTACT_PROSPECT' => array( + 'DATAPOLICY_CONTACT_PROSPECT' => array( 'sql' => " SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc @@ -301,7 +301,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_CONTACT_PROSPECT_CLIENT' => array( + 'DATAPOLICY_CONTACT_PROSPECT_CLIENT' => array( 'sql' => " SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc @@ -339,7 +339,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT' => array( + 'DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT' => array( 'sql' => " SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc @@ -377,7 +377,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_CONTACT_FOURNISSEUR' => array( + 'DATAPOLICY_CONTACT_FOURNISSEUR' => array( 'sql' => " SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc @@ -414,7 +414,7 @@ class DataPolicyCron 'country_id' => '', ) ), - 'DATAPOLICIES_ADHERENT' => array( + 'DATAPOLICY_ADHERENT' => array( 'sql' => " SELECT a.rowid FROM ".MAIN_DB_PREFIX."adherent as a WHERE a.entity = %d diff --git a/htdocs/datapolicy/langs/fr_FR/datapolicy.lang b/htdocs/datapolicy/langs/fr_FR/datapolicy.lang deleted file mode 100644 index 6bf0c6a904d..00000000000 --- a/htdocs/datapolicy/langs/fr_FR/datapolicy.lang +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright (C) 2018 INOVEA CONSEil info@inovea-conseil.com -# -# 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 . - -# -# Générique -# - -# Module label 'ModuledatapolicyName' -Module4100Name = Protection des Données -# Module description 'ModuledatapolicyDesc' -Module4100Desc = Module de gestion de la protection des données (RGPD) - -# -# Page d'administration -# -datapolicySetup = Configuration du module Protection des données -Settings_DATAPOLICY = Paramétrage du module Protection des données -datapolicySetupPage = Selon la loi de votre pays (Exemple l’article 5 du RGPD), les données à caractère personnel doivent être conservées pendant une durée n’excédant pas celle nécessaire au regard des finalités pour lesquelles elles ont été traitées, à l’exception de fins archivistiques. La suppression se fera automatiquement après une certaine durée sans évènement (la durée que vous aurez indiquée ci-dessous). -NB_MONTHS = %s mois -ONE_YEAR = 1 an -NB_YEARS = %s ans -DATAPOLICY_TIERS_CLIENT = Client -DATAPOLICY_TIERS_PROSPECT = Prospect -DATAPOLICY_TIERS_PROSPECT_CLIENT = Prospect/Client -DATAPOLICY_TIERS_NIPROSPECT_NICLIENT = Ni prospect / Ni client -DATAPOLICY_TIERS_FOURNISSEUR = Fournisseur -DATAPOLICY_CONTACT_CLIENT = Client -DATAPOLICY_CONTACT_PROSPECT = Prospect -DATAPOLICY_CONTACT_PROSPECT_CLIENT = Prospect/Client -DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT = Ni prospect / Ni client -DATAPOLICY_CONTACT_FOURNISSEUR = Fournisseur -DATAPOLICY_ADHERENT = Adhérent -DATAPOLICY_Tooltip_SETUP = Type du contact - Indiquez vos choix pour chaque type. -DATAPOLICYMail=Paramétrage des emails -DATAPOLICYSUBJECTMAIL=Objet du mail -DATAPOLICYCONTENTMAIL=Contenu du mail -DATAPOLICYSUBSITUTION=Vous pouvez utiliser les variables suivantes dans votre email (LINKACCEPT permet de créer un lien enregistrant l'acceptation de la personne, LINKREFUSED permet d'enregistrer le refus de la personne) : -DATAPOLICYACCEPT=Message suite acceptation -DATAPOLICYREFUSE=Message suite opposition -SendAgreementText=Vous pouvez envoyer un email DATAPOLICY à tous vos contacts concernés (qui n'ont pas encore reçus de mail et pour lesquels vous n'avez rien enregistré concernant leur accord/désaccord DATAPOLICY). Pour cela, utilisez le bouton suivant. -SendAgreement=Envoyer les emails -AllAgreementSend = Tous les e-mails de consentement ont été envoyés -TXTLINKDATAPOLICYACCEPT= Texte du lien d'acceptation -TXTLINKDATAPOLICYREFUSE= Texte du lien d'opposition - - - -# -# Extrafield -# -DATAPOLICY_BLOCKCHECKBOX = DATAPOLICY : Traitement des données à caractère personnel -DATAPOLICY_consentement = Consentement recueilli pour le traitement des données à caractère personnel le concernant -DATAPOLICY_opposition_traitement = S’oppose au traitement de ses données à caractère personnel -DATAPOLICY_opposition_prospection = S’oppose au traitement de ses données à caractère personnel à des fins de prospection - -# -# Popup -# -DATAPOLICY_POPUP_ANONYME_TITLE = Anonymiser un tiers -DATAPOLICY_POPUP_ANONYME_TEXTE = Vous ne pouvez pas supprimer ce contact de Dolibarr car des éléments y sont liés. Conformément au DATAPOLICY, vous allez rendre toutes ces données anonymes afin de respecter vos obligations. Souhaitez-vous continuer ? - -# -# Bouton portabilité -# -DATAPOLICY_PORTABILITE = Portabilité DATAPOLICY -DATAPOLICY_PORTABILITE_TITLE = Export des données à caractère personnel -DATAPOLICY_PORTABILITE_CONFIRMATION = Vous souhaitez exporter les données à caractère personnel de ce contact. Etes-vous sûr ? - -# -# Note ajoutés lors d'une anonymisation -# -ANONYMISER_AT = Anonymisé le %s - -#V2 -DATAPOLICYReturn=Validation DATAPOLICY -DATAPOLICY_date=Date d'accord/opposition au traitement -DATAPOLICY_send=Date envoi consentement -DATAPOLICYReturn=Retour DATAPOLICY -DATAPOLICY_SEND=Envoyer l'email de consentement -MailSent=L'email a bien été envoyé - -#ERROR -ErrorSubjectIsRequired=Erreur : vous n'avez pas indiqué l'objet de l'email dans la configuration -=Suite à un problème technique, nous n'avons pas pu enregistrer votre choix. Nous nous en excusons. Contactez-nous pour nous transmettre votre choix. -NUMBER_MONTH_BEFORE_DELETION = Nombre de mois avant suppression des données diff --git a/htdocs/datapolicy/langs/it_IT/datapolicy.lang b/htdocs/datapolicy/langs/it_IT/datapolicy.lang deleted file mode 100644 index 68284e17844..00000000000 --- a/htdocs/datapolicy/langs/it_IT/datapolicy.lang +++ /dev/null @@ -1,78 +0,0 @@ -# Copyright (C) 2018 INOVEA CONSEIl info@inovea-conseil.com - Thanks to Claudio Aschieri -# -# # Module label 'ModuledatapolicyName' -Module4100Name = Data Policy -# Module description 'ModuledatapolicyDesc' -Module4100Desc = Conformità con GDPR - -# -# Page d'administration -# -datapolicySetup = Module Setup -Settings_DATAPOLICY = Configurazione modulo GDPR -datapolicySetupPage = In accordo con l'art 5 del GDPR i dati personali devono essere conservati per un periodo di tempo che .... ed eliminati se non sono più utili agli scopi per cui sono stati processati. -NB_MONTHS = %s mesi -ONE_YEAR = 1 anno -NB_YEARS = %s anni -DATAPOLICY_TIERS_CLIENT = Cliente -DATAPOLICY_TIERS_PROSPECT = Fornitore -DATAPOLICY_TIERS_PROSPECT_CLIENT = Potenziale Cliente / Cliente -DATAPOLICY_TIERS_NIPROSPECT_NICLIENT = Nè potenziale cliente / Nè cliente -DATAPOLICY_TIERS_FOURNISSEUR = Fornitore -DATAPOLICY_CONTACT_CLIENT = Cliente -DATAPOLICY_CONTACT_PROSPECT = Potenziale cliente -DATAPOLICY_CONTACT_PROSPECT_CLIENT = Potenziale Cliente / Cliente -DATAPOLICY_CONTACT_NIPROSPECT_NICLIENT = Nè potenziale cliente / Nè cliente -DATAPOLICY_CONTACT_FOURNISSEUR = Fornitore -DATAPOLICY_ADHERENT = Membri -DATAPOLICY_Tooltip_SETUP = Tipo di contatto - Indica la scelta per ogni tipologia -DATAPOLICYMail=Configurazione Email -DATAPOLICYSUBJECTMAIL=Subject dell'e-mail -DATAPOLICYCONTENTMAIL=Contenuto dell'e-mail -DATAPOLICYSUBSITUTION=Puoi utilizzare le seguenti variabili nella tua email (LINKACCEPT consente di creare un link per registrare l'accettazione della persona, LINKREFUSED consente di registrare il rifiuto della persona): -DATAPOLICYACCEPT= Messaggio dopo il consenso -DATAPOLICYREFUSE=Messaggio dopo il rifiuto -SendAgreementText=Puoi inviare un'email GDPR a tutti i tuoi contatti rilevanti (che non hanno ancora ricevuto un'e-mail e per i quali non hai registrato nulla sul loro accordo GDPR). Per fare ciò, utilizzare il seguente pulsante. -SendAgreement=Invia emails -AllAgreementSend = Tutte le email sono state inviate -TXTLINKDATAPOLICYACCEPT= Testo per il link "Consenso" -TXTLINKDATAPOLICYREFUSE= Testo per il link "Consenso negato" - -# -# Extrafield -# -DATAPOLICY_BLOCKCHECKBOX = GDPR : Trattamento dei dati personali -DATAPOLICY_consentement = Consenso ottenuto al Trattamento dei dati personali -DATAPOLICY_opposition_traitement = Consenso negato al trattamento dei dati personali -DATAPOLICY_opposition_prospection = Consenso negato al trattamento dei dati personali a fini commerciali - -# -# Popup -# -DATAPOLICY_POPUP_ANONYME_TITLE = Anonimizza un soggetto terzo -DATAPOLICY_POPUP_ANONYME_TEXTE = Impossibile eliminare questo contatto da Dolibarr perchè vi sono elementi collegati. In conformità con il GDPR, renderai tutti questi dati anonimi per rispettare i tuoi obblighi. Vuoi continuare? - - -# -# Bouton portabilité -# -DATAPOLICY_PORTABILITE = Portabilità GDPR -DATAPOLICY_PORTABILITE_TITLE = Esporta i dati personali -DATAPOLICY_PORTABILITE_CONFIRMATION = Vuoi davvero esportare i dati personali di questo contatto? - -# -# Note ajoutée lors d'une anonymisation -# -ANONYMISER_AT = Anonimizzato il %s - -#V2 -DATAPOLICYReturn=GDPR Validazione -DATAPOLICY_date = Data di accordo / disaccordo GDPR -DATAPOLICY_send = Data di invio del consenso (e-mail) -DATAPOLICYReturn = GDPR ritorno -DATAPOLICY_SEND = Inviare GDPR e-mail -MailSent=L'email è stata inviata - -#ERROR -ErrorSubjectIsRequired= Errore: L'oggetto della mail è obbligatorio. Inserisci l'oggetto nella configurazione del modulo. -=A causa di un problema tecnico, non siamo stati in grado di registrare la tua scelta. Ci scusiamo per questo. Contattaci per inviarci la tua scelta. diff --git a/htdocs/datapolicy/lib/datapolicy.lib.php b/htdocs/datapolicy/lib/datapolicy.lib.php index 02ac575047e..eb70736d27c 100644 --- a/htdocs/datapolicy/lib/datapolicy.lib.php +++ b/htdocs/datapolicy/lib/datapolicy.lib.php @@ -31,7 +31,7 @@ function datapolicyAdminPrepareHead() { global $langs, $conf; - $langs->load("datapolicy@datapolicy"); + $langs->load("datapolicy"); $h = 0; $head = array(); @@ -41,10 +41,10 @@ function datapolicyAdminPrepareHead() $head[$h][2] = 'settings'; $h++; - if (!empty($conf->global->DATAPOLICIES_ENABLE_EMAILS)) { + if (!empty($conf->global->DATAPOLICY_ENABLE_EMAILS) || getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) { $head[$h][0] = DOL_URL_ROOT."/datapolicy/admin/setupmail.php"; - $head[$h][1] = $langs->trans("DATAPOLICIESMail"); - $head[$h][2] = 'settings'; + $head[$h][1] = $langs->trans("DATAPOLICYMail"); + $head[$h][2] = 'emailing'; $h++; } diff --git a/htdocs/datapolicy/langs/en_US/datapolicy.lang b/htdocs/langs/en_US/datapolicy.lang similarity index 100% rename from htdocs/datapolicy/langs/en_US/datapolicy.lang rename to htdocs/langs/en_US/datapolicy.lang diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php index 2581b407f3b..3b7b1b13009 100644 --- a/htdocs/modulebuilder/template/mymoduleindex.php +++ b/htdocs/modulebuilder/template/mymoduleindex.php @@ -75,7 +75,7 @@ if (isset($user->socid) && $user->socid > 0) { // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; -//if (!isModEnabled('barcode')) { +//if (!isModEnabled('mymodule')) { // accessforbidden('Module not enabled'); //} //if (! $user->hasRight('mymodule', 'myobject', 'read')) { diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 3e6213eaa26..6cc99f4f34d 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -148,7 +148,9 @@ if ($enablepermissioncheck) { //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->mymodule->enabled)) accessforbidden(); +if (!isModEnabled("mymodule")) { + accessforbidden(); +} if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 18328de1f9d..7ecce8c745f 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -148,8 +148,12 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object- //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->mymodule->enabled)) accessforbidden(); -if (!$permissiontoread) accessforbidden(); +if (!isModEnabled("mymodule")) { + accessforbidden(); +} +if (!$permissiontoread) { + accessforbidden(); +} /* diff --git a/htdocs/modulebuilder/template/myobject_contact.php b/htdocs/modulebuilder/template/myobject_contact.php index 9a365dd88f2..b0f7b5cfb30 100644 --- a/htdocs/modulebuilder/template/myobject_contact.php +++ b/htdocs/modulebuilder/template/myobject_contact.php @@ -94,7 +94,9 @@ if ($enablepermissioncheck) { //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->mymodule->enabled)) accessforbidden(); +if (!isModEnabled("mymodule")) { + accessforbidden(); +} if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index 173bea760a0..d06eb61ba0e 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -140,7 +140,9 @@ if ($enablepermissioncheck) { //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->mymodule->enabled)) accessforbidden(); +if (!isModEnabled("mymodule")) { + accessforbidden(); +} if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ce7aa447c66..987b58f2369 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -199,7 +199,9 @@ if ($user->socid > 0) accessforbidden(); //$socid = 0; if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->mymodule->enabled)) accessforbidden('Module not enabled'); +if (!isModEnabled("mymodule")) { + accessforbidden(); +} if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php index f38e703fa69..6b03ddbf8c6 100644 --- a/htdocs/modulebuilder/template/myobject_note.php +++ b/htdocs/modulebuilder/template/myobject_note.php @@ -120,7 +120,9 @@ if ($enablepermissioncheck) { //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->mymodule->enabled)) accessforbidden(); +if (!isModEnabled("mymodule")) { + accessforbidden(); +} if (!$permissiontoread) accessforbidden(); diff --git a/htdocs/datapolicy/public/index.php b/htdocs/public/datapolicy/index.php similarity index 75% rename from htdocs/datapolicy/public/index.php rename to htdocs/public/datapolicy/index.php index 104b393bf7e..79172f30efd 100644 --- a/htdocs/datapolicy/public/index.php +++ b/htdocs/public/datapolicy/index.php @@ -1,5 +1,4 @@ * * This program is free software: you can redistribute it and/or modify @@ -19,15 +18,12 @@ /** * \file htdocs/datapolicy/admin/setup.php * \ingroup datapolicy - * \brief datapolicy setup page. + * \brief Page to show the result of updating it Data policiy preferences after an email campaign using sendMailDataPolicyContact() */ if (!defined('NOLOGIN')) { define("NOLOGIN", 1); // This means this output page does not require to be logged. } -if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test -} if (!defined('NOREQUIREMENU')) { define('NOREQUIREMENU', '1'); } @@ -38,89 +34,103 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; require_once DOL_DOCUMENT_ROOT.'/datapolicy/class/datapolicy.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; $idc = GETPOST('c', 'int'); $ids = GETPOST('s', 'int'); $ida = GETPOST('a', 'int'); -$action = GETPOST('action', 'aZ09'); -$lang = GETPOST('l', 'alpha'); -$code = GETPOST('key', 'alpha'); +$action = GETPOST('action', 'aZ09'); // 1 or 2 +$l = GETPOST('l', 'alpha'); +$securitykey = GETPOST('key', 'alpha'); -$acc = "DATAPOLICIESACCEPT_".$lang; -$ref = "DATAPOLICIESREFUSE_".$lang; -$langs->load('datapolicy@datapolicy', 0, 0, $lang); +$acc = "DATAPOLICIESACCEPT_".$l; +$ref = "DATAPOLICIESREFUSE_".$l; +$langs->load('datapolicy', 0, 0, $l); + + +/* + * Actions + */ if (empty($action) || (empty($idc) && empty($ids) && empty($ida))) { + print 'Missing paramater s, c or a'; return 0; } elseif (!empty($idc)) { $contact = new Contact($db); $contact->fetch($idc); - $check = md5($contact->email); - if ($check != $code) { - $return = $langs->trans('ErrorEmailDATAPOLICIES'); + $check = dol_hash($contact->email, 'md5'); + if ($check != $securitykey) { + $return = $langs->trans('Bad value for key.'); } elseif ($action == 1) { $contact->array_options['options_datapolicy_consentement'] = 1; $contact->array_options['options_datapolicy_opposition_traitement'] = 0; $contact->array_options['options_datapolicy_opposition_prospection'] = 0; - $contact->array_options['options_datapolicy_date'] = date('Y-m-d', time()); + $contact->array_options['options_datapolicy_date'] = dol_now(); - $return = $conf->global->$acc; + $return = getDolGlobalString($acc); } elseif ($action == 2) { $contact->no_email = 1; $contact->array_options['options_datapolicy_consentement'] = 0; $contact->array_options['options_datapolicy_opposition_traitement'] = 1; $contact->array_options['options_datapolicy_opposition_prospection'] = 1; - $contact->array_options['options_datapolicy_date'] = date('Y-m-d', time()); + $contact->array_options['options_datapolicy_date'] = dol_now(); - $return = $conf->global->$ref; + $return = getDolGlobalString($ref); } $contact->update($idc); } elseif (!empty($ids)) { $societe = new Societe($db); $societe->fetch($ids); - $check = md5($societe->email); - if ($check != $code) { - $return = $langs->trans('ErrorEmailDATAPOLICIES'); + $check = dol_hash($societe->email, 'md5'); + if ($check != $securitykey) { + $return = $langs->trans('Bad value for key.'); } elseif ($action == 1) { $societe->array_options['options_datapolicy_consentement'] = 1; $societe->array_options['options_datapolicy_opposition_traitement'] = 0; $societe->array_options['options_datapolicy_opposition_prospection'] = 0; - $societe->array_options['options_datapolicy_date'] = date('Y-m-d', time()); - $return = $conf->global->$acc; + $societe->array_options['options_datapolicy_date'] = dol_now(); + + $return = getDolGlobalString($acc); } elseif ($action == 2) { $societe->array_options['options_datapolicy_consentement'] = 0; $societe->array_options['options_datapolicy_opposition_traitement'] = 1; $societe->array_options['options_datapolicy_opposition_prospection'] = 1; - $societe->array_options['options_datapolicy_date'] = date('Y-m-d', time()); + $societe->array_options['options_datapolicy_date'] = dol_now(); - $return = $conf->global->$ref; + $return = getDolGlobalString($ref); } $societe->update($ids); } elseif (!empty($ida)) { $adherent = new Adherent($db); $adherent->fetch($ida); - $check = md5($adherent->email); - if ($check != $code) { - $return = $langs->trans('ErrorEmailDATAPOLICIES'); + $check = dol_hash($adherent->email, 'md5'); + if ($check != $securitykey) { + $return = $langs->trans('Bad value for key.'); } elseif ($action == 1) { $adherent->array_options['options_datapolicy_consentement'] = 1; $adherent->array_options['options_datapolicy_opposition_traitement'] = 0; $adherent->array_options['options_datapolicy_opposition_prospection'] = 0; - //$adherent->array_options['options_datapolicy_date'] = date('Y-m-d', time()); - $return = $conf->global->$acc; + //$adherent->array_options['options_datapolicy_date'] = dol_now(); + + $return = getDolGlobalString($acc); } elseif ($action == 2) { $adherent->array_options['options_datapolicy_consentement'] = 0; $adherent->array_options['options_datapolicy_opposition_traitement'] = 1; $adherent->array_options['options_datapolicy_opposition_prospection'] = 1; - //$adherent->array_options['options_datapolicy_date'] = date('Y-m-d', time()); + //$adherent->array_options['options_datapolicy_date'] = dol_now(); - $return = $conf->global->$ref; + $return = getDolGlobalString($ref); } $newuser = new User($db); $adherent->update($newuser); } -header("Content-type: text/html; charset=".$conf->file->character_set_client); + +/* + * View + */ + +top_httphead(); print ''; print "\n"; From e19e65d362ea339c309e2fe1b9e3ae9cb95d403a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 16:38:39 +0200 Subject: [PATCH 330/453] Fix phpunit --- htdocs/user/class/user.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f521d10c936..12b2a52742d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -750,7 +750,9 @@ class User extends CommonObject // In $conf->modules, we have 'accounting', 'product', 'facture', ... // In $user->rights, we have 'accounting', 'produit', 'facture', ... - //if ($a) { var_dump($module); var_dump($this->rights->$rightsPath); var_dump($conf->modules); } + //var_dump($module); + //var_dump($this->rights->$rightsPath); + //var_dump($conf->modules); if (!in_array($module, $conf->modules)) { return 0; } From f26e2652e61c0c5a735f3f3c749a35665eb8ba6f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 16:39:47 +0200 Subject: [PATCH 331/453] Debug --- htdocs/datapolicy/lib/datapolicy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/datapolicy/lib/datapolicy.lib.php b/htdocs/datapolicy/lib/datapolicy.lib.php index eb70736d27c..2f195bfc3ab 100644 --- a/htdocs/datapolicy/lib/datapolicy.lib.php +++ b/htdocs/datapolicy/lib/datapolicy.lib.php @@ -41,7 +41,7 @@ function datapolicyAdminPrepareHead() $head[$h][2] = 'settings'; $h++; - if (!empty($conf->global->DATAPOLICY_ENABLE_EMAILS) || getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) { + if (!empty($conf->global->DATAPOLICY_ENABLE_EMAILS) || getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $head[$h][0] = DOL_URL_ROOT."/datapolicy/admin/setupmail.php"; $head[$h][1] = $langs->trans("DATAPOLICYMail"); $head[$h][2] = 'emailing'; From 4d14c0850f1eb0b8ecdbbc99b4f6e608b22766d7 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 18:56:48 +0200 Subject: [PATCH 332/453] Update ChangeLog - NEW: Add param *border* table for md theme - border instead of boder? - start moving CONFIG_OPTIONS from *For users:* section to *For developers or integrators:* --- ChangeLog | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9a5513031e9..7a87f3fbc2d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -59,66 +59,60 @@ NEW: Add margin info in proposal and order list NEW: Add massaction "Edit Extrafield" for Product NEW: Add more fields to detect duplicate during import of thirdparties NEW: Add option to foce delivery on email for purchase order receipt to yes -NEW: Add param boder table for md theme +NEW: Add param border table for md theme NEW: Add param color button action NEW: Add possibility to create contract from invoice NEW: Add possibility with constant MAIN_LOGIN_BADCHARUNAUTHORIZED to define bad character unauthorized into login name NEW: Add private and public notes on tax files. -NEW: Add status "Obsolete" to KM articles NEW: Add substitutions "user numbers" NEW: allow a ticket to be automatically marked as read when created from backend. NEW: allow cut&paste as real numeric value to excel NEW: A public form to send a message and create a lead is available NEW: automatically set totally received status in reception NEW: Auto set invoice paid when adding credit not and remain to pay is 0 -NEW: Availibility dictionnary has a new column unit and number NEW: Can change value of AWP during the inventory NEW: Can enter price with tax for predefined products on purchase objects NEW: Can filter on a thirdparty on product statistics NEW: Can removed doc templates from setup page of thirdparty -NEW: Can set the parent company during the creation of thirdparty (action=add of societe/card.php) NEW: Can use ! to make a search that exclude a string NEW: Change in theme colors does not need to use the refresh button NEW: clean values and amount in FEC import NEW: const MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND for mailing mass action NEW: Contact filter project list NEW: Create contract from invoice -NEW: create third-party with contact if not found on public ticket +NEW: Database: Can store the session into database (instead of beeing managed by PHP) +NEW: Database: Some core tables are created only at module activation NEW: Default value for MAIN_SECURITY_CSRF_WITH_TOKEN is now 2 (GET are also protected agains CSRF attacks) NEW: deposit payment terms: add field into dictionary admin page to define default percentage of deposit. NEW: Dictionaries - add possibility to manage countries in EEC +NEW: Dictionaries - Availibility dictionnary has a new column unit and number NEW: Display errors in a message box after generating documents -NEW: Display physical and virtual stock of the products when creating OF from a BOM -NEW: Display product ref in "Object link" product tab for BOM NEW: Enhance the import. Can use 'auto' for the ref (import of orders) NEW: Events on Proposal to Return to Draft NEW: Page to list expense report payments NEW: JS inventory autocalc input NEW: language support for more emailing target selectors NEW: leave requests: add field into type dictionary to block request if balance is negative -NEW: MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys -NEW: MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category NEW: Mass action "Close shipments" NEW: Module BOM - Add tabs for nets Bom NEW: Module BOM - Add the possibility to add sub-BOMs to BOM -NEW: Module Recruitment - Add a public page with all list of open job positions. +NEW: Module Recruitment - Add a public page with list of all open job positions. NEW: Module Recruitment - Add a tab with list of application on the jobposition file. -NEW: Module Website - supports now the multicompany module NEW: More mode for THEME_TOPMENU_DISABLE_IMAGE (2, 3, ...) NEW: Add option to move checkbox column as first column on Thirdparty list (only few screens) -NEW: on redirect of page in website module, GET parameters are kept. -NEW: optional display warning icons on ticket list NEW: payment conditions enabling semi-automatic deposit creation (Issue #18439) NEW: possibility to consume multiple batch NEW: Reverse movement product consumption NEW: Send email to the supplier order contact NEW: add permission to report time on timesheet -NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level -NEW: Some core tables are created only at module activation +NEW: Knowledge Management - Add status "Obsolete" to KM articles NEW: MRP - split consumption line on MO +NEW: MRP - Display physical and virtual stock of the products when creating OF from a BOM +NEW: MRP - Display product ref in "Object link" product tab for BOM NEW: Proposals - option update prices on proposal cloning -NEW: stock filter in reassort lists -NEW: stock limit in stock export CSV +NEW: SEPA XML - option to place payment Type Info at Credit transfer Transaction level +NEW: Stocks - stock filter in reassort lists +NEW: Stocks - stock limit in stock export CSV NEW: Supplier order - Show ref supplier of reception in linked object block NEW: support user_modif in order NEW: Surveys - Show number of votes into the label of tab "Results" of a survey @@ -128,20 +122,24 @@ NEW: TakePOS - show product reference NEW: TakePOS - add constant to hide categories NEW: TakePOS - add constant to show category description NEW: TakePOS - add constant to show only the products in stock +NEW: Third-Parties - Add rules "customer accountancy code" is mandatory to validate invoice +NEW: Third-Parties - Can set the parent company during the creation of thirdparty (action=add of societe/card.php) +NEW: Tickets - create Third-party with contact if not found on public ticket NEW: Tickets - option to default check "notify tier at creation" NEW: Tickets - Trigger: allow to automatically send messages on new tickets +NEW: Tickets - optional display warning icons on ticket list +NEW: Websites Module - supports now the multicompany module +NEW: Websites Module - on redirect of page in website module, GET parameters are kept. NEW: The backup tools has an "lowmemory" option for mysqldump on large database NEW: The 'reposition' class works on ajax constantonoff that make redirects -NEW: Thirdparty - Add rules "customer accountancy code" is mandatory to validate invoice NEW: thumbnail field in product list NEW: total mark rate in list NEW: uncheck "send message" by default on a ticket when private messages has been checked NEW: VAT Report by month - Show detail by rate and also by code -NEW: Can store the session into database (instead of beeing managed by PHP) NEW: Added MMK currency (Myanmar Kyat) NEW: On a form to send an email, we show all emails of contacts of object - Modules + Modules state NEW: Module Partnership Management NEW: Module Event Organization Management @@ -164,7 +162,7 @@ NEW: Creation of the function select_bom() used to display bom select list NEW: Add trigger and event on completely received status change NEW: Add utility function send backup by mail NEW: add WordPress OAuth to save a token (not SSO) -NEW: A module can embed a sql script run at each Dolibarr upgrade +NEW: A module can embed a SQL script run at each Dolibarr upgrade NEW: Add param to keep the robot=index meta tag on public pages NEW: Add method hintindex() in database handlers. NEW: add modifications for new function "$db->prefix()" @@ -209,9 +207,11 @@ NEW: TakePOS - add hook doaction in TakePOS invoice Config Options: NEW: Add hidden option on contract PDF line to hide qty and price -NEW: Option INVOICEREC_SET_AUTOFILL_DATE_START/END -NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action - +NEW: Option MAIL_MASS_ACTION_ADD_LAST_IF_MAIN_DOC_NOT_FOUND to send last document in mass mailing action +NEW: Option MAIN_API_DEBUG to save API logs into a file +NEW: Option MAIN_MAIL_AUTOCOPY_TO can accept several email and special keys +NEW: Option MAIN_SEARCH_CAT_OR_BY_DEFAULT const for search by category +NEW: Option INVOICEREC_SET_AUTOFILL_DATE_START/END WARNING: From 043a48892705136e57ddaf45c63c259af3e8d4d4 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 19:17:11 +0200 Subject: [PATCH 333/453] Update agenda.php add $langs->loadLangs 'agenda' --- htdocs/societe/agenda.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index c0525767527..3a4ca2df6f5 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('bills', 'companies', 'orders', 'propal')); +$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal')); if (GETPOST('actioncode', 'array')) { From 34522910e8d69cbf10028cf7f12e9bb9255575d1 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 19:37:40 +0200 Subject: [PATCH 334/453] Update card.php --- htdocs/product/card.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 17387e3948d..dd0a2cd75e0 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -44,19 +44,19 @@ // Load Dolibarr environment require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -if (isModEnabled("propal")) { +if (isModEnabled('propal')) { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; } if (isModEnabled('facture')) { @@ -91,7 +91,7 @@ $mesg = ''; $error = 0; $errors = array(); $refalreadyexists = 0; // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : null); $type = (GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT); $action = (GETPOST('action', 'alpha') ? GETPOST('action', 'alpha') : 'view'); @@ -184,7 +184,8 @@ if ($object->id > 0) { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('productcard', 'globalcard')); -$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire)); +// Permissions +$usercanread = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->lire) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->lire)); $usercancreate = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)); $usercandelete = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->supprimer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->supprimer)); From e6b5ef99a91bdbea4ead726b85591b046d53adc8 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 19:47:17 +0200 Subject: [PATCH 335/453] Update card.php --- htdocs/comm/action/card.php | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 14654914dd5..30339f51310 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -25,31 +25,36 @@ */ /** - * \file htdocs/comm/action/card.php - * \ingroup agenda - * \brief Page for event card + * \file htdocs/comm/action/card.php + * \ingroup agenda + * \brief Page for event card */ + +// Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncommreminder.class.php'; + +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncommreminder.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + // Load translation files required by the page $langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda", "mails")); +// Get Parameters $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -96,6 +101,7 @@ if ($user->socid) { $error = GETPOST("error"); $donotclearsession = GETPOST('donotclearsession') ?GETPOST('donotclearsession') : 0; +// Initialize Objects $object = new ActionComm($db); $cactioncomm = new CActionComm($db); $contact = new Contact($db); From b1ff726e9c5590b8df91eaaefa4de2f20a7df324 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 19:55:11 +0200 Subject: [PATCH 336/453] Update mo_card.php --- htdocs/mrp/mo_card.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 5d06f8c0f52..cda6088a982 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -16,11 +16,12 @@ */ /** - * \file mo_card.php - * \ingroup mrp - * \brief Page to create/edit/view mo + * \file htdocs/mrp/mo_card.php + * \ingroup mrp + * \brief Page to create/edit/view MO Manufacturing Order */ + // Load Dolibarr environment require '../main.inc.php'; @@ -35,7 +36,8 @@ require_once DOL_DOCUMENT_ROOT.'/bom/lib/bom.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("mrp", "other")); +$langs->loadLangs(array('mrp', 'other')); + // Get parameters $id = GETPOST('id', 'int'); @@ -97,6 +99,7 @@ if (GETPOST('fk_bom', 'int') > 0) { $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'mrp', $object->id, 'mrp_mo', '', 'fk_soc', 'rowid', $isdraft); +// Permissions $permissionnote = $user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php $permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php From 376825b3dd433c15643ceba11b7600ff22929e36 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:12:52 +0200 Subject: [PATCH 337/453] Update pay.php --- htdocs/takepos/pay.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index 7b5d4aea6b5..81d6d5d13d9 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -22,10 +22,11 @@ * \brief Page with the content of the popup to enter payments */ -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); +// if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language +// if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language +// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); + if (!defined('NOCSRFCHECK')) { define('NOCSRFCHECK', '1'); } @@ -39,11 +40,15 @@ if (!defined('NOREQUIREHTML')) { define('NOREQUIREHTML', '1'); } -require '../main.inc.php'; // Load $user and permissions +// Load Dolibarr environment +require '../main.inc.php'; // Load $user and permissions + +require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; + +// Load translation files required by the page $langs->loadLangs(array("main", "bills", "cashdesk", "banks")); $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'); // $place is id of table for Bar or Restaurant From ec6d490c99c87fad31642a637add72eab34e62b3 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:16:22 +0200 Subject: [PATCH 338/453] Update invoice.php --- htdocs/takepos/invoice.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 8659cc6ea52..f383b630275 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -18,15 +18,16 @@ */ /** - * \file htdocs/takepos/invoice.php - * \ingroup takepos - * \brief Page to generate section with list of lines + * \file htdocs/takepos/invoice.php + * \ingroup takepos + * \brief Page to generate section with list of lines */ -// if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language -// if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language -// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); -// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); +// if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language +// if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language +// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1'); +// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1'); + if (!defined('NOCSRFCHECK')) { define('NOCSRFCHECK', '1'); } @@ -43,13 +44,16 @@ if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } +// Load Dolibarr environment if (!defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { require '../main.inc.php'; } -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; + + $hookmanager->initHooks(array('takeposinvoice')); global $mysoc; From 3bd74e41884169e2369f996190cf72224b6eaa9a Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:20:57 +0200 Subject: [PATCH 339/453] Update index.php --- htdocs/takepos/index.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 410de2c330c..dd7eb27178f 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -18,15 +18,16 @@ */ /** - * \file htdocs/takepos/index.php - * \ingroup takepos - * \brief Main TakePOS screen + * \file htdocs/takepos/index.php + * \ingroup takepos + * \brief Main TakePOS screen */ -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language -//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language -//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +// if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +// if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); + if (!defined('NOCSRFCHECK')) { define('NOCSRFCHECK', '1'); } @@ -43,14 +44,16 @@ if (!defined('NOREQUIREAJAX')) { define('NOREQUIREAJAX', '1'); } +// Load Dolibarr environment require '../main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; + $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Bar or Restaurant or multiple sales $action = GETPOST('action', 'aZ09'); From 854cf63a6aa10ef4a1c7fde79c2cafd2be7130b7 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:26:31 +0200 Subject: [PATCH 340/453] Update multicurrency_rate.php --- htdocs/multicurrency/multicurrency_rate.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 3f20476f72a..2cc729bb35d 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -23,15 +23,16 @@ * 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 . + * along with this program. If not, see . */ /** - * \file htdocs/multicurrency/multicurrency_rate.php - * \ingroup multicurrency - * \brief Page to list multicurrency rate + * \file htdocs/multicurrency/multicurrency_rate.php + * \ingroup multicurrency + * \brief Page to list multicurrency rate */ +// Dolibarr Environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php'; @@ -39,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/multicurrency.lib.php'; // Load translation files required by the page $langs->loadLangs(array('multicurrency')); +// Get Parameters $action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); From 309dfe788f597ae70b544b00ddc377d7a0ec326c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Thu, 8 Sep 2022 20:32:18 +0200 Subject: [PATCH 341/453] clean code --- .../recruitmentcandidature_agenda.php | 8 ++-- .../recruitmentcandidature_card.php | 8 ++-- .../recruitmentcandidature_document.php | 5 +-- .../recruitmentcandidature_list.php | 15 +++---- .../recruitmentcandidature_note.php | 9 ++-- .../recruitmentjobposition_agenda.php | 8 ++-- .../recruitmentjobposition_applications.php | 41 +++---------------- .../recruitmentjobposition_card.php | 6 +-- .../recruitmentjobposition_list.php | 3 -- .../recruitmentjobposition_note.php | 9 ++-- htdocs/zapier/lib/zapier.lib.php | 2 +- 11 files changed, 38 insertions(+), 76 deletions(-) diff --git a/htdocs/recruitment/recruitmentcandidature_agenda.php b/htdocs/recruitment/recruitmentcandidature_agenda.php index 50a79a35872..2aeb51628a6 100644 --- a/htdocs/recruitment/recruitmentcandidature_agenda.php +++ b/htdocs/recruitment/recruitmentcandidature_agenda.php @@ -27,8 +27,8 @@ require_once '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -dol_include_once('/recruitment/class/recruitmentcandidature.class.php'); -dol_include_once('/recruitment/lib/recruitment_recruitmentcandidature.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment_recruitmentcandidature.lib.php'; // Load translation files required by the page @@ -36,9 +36,9 @@ $langs->loadLangs(array("recruitment", "other")); // Get parameters $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); if (GETPOST('actioncode', 'array')) { diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index f3d41f9de97..ca7e3c20e2c 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -36,14 +36,14 @@ $langs->loadLangs(array("recruitment", "other", "users")); // Get parameters $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'recruitmentcandidaturecard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -//$lineid = GETPOST('lineid', 'int'); +//$lineid = GETPOST('lineid', 'int'); // Initialize technical objects $object = new RecruitmentCandidature($db); diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php index f72271a3105..3f08c770111 100644 --- a/htdocs/recruitment/recruitmentcandidature_document.php +++ b/htdocs/recruitment/recruitmentcandidature_document.php @@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -dol_include_once('/recruitment/class/recruitmentcandidature.class.php'); -dol_include_once('/recruitment/lib/recruitment_recruitmentcandidature.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment_recruitmentcandidature.lib.php'; // Load translation files required by the page $langs->loadLangs(array("recruitment", "companies", "other", "mails")); @@ -118,7 +118,6 @@ if ($object->id) { } // Object card - // ------------------------------------------------------------ $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; diff --git a/htdocs/recruitment/recruitmentcandidature_list.php b/htdocs/recruitment/recruitmentcandidature_list.php index 2b1126e838f..34b852574f6 100644 --- a/htdocs/recruitment/recruitmentcandidature_list.php +++ b/htdocs/recruitment/recruitmentcandidature_list.php @@ -31,25 +31,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; -// for other modules -//dol_include_once('/othermodule/class/otherobject.class.php'); - // Load translation files required by the page $langs->loadLangs(array("recruitment", "other")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$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) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? -$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation -$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : ((empty($id) && empty($ref)) ? 'recruitmentcandidaturelist' : 'recruitmentjobposition_candidature'); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$mode = GETPOST('mode', 'aZ'); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'aZ'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; diff --git a/htdocs/recruitment/recruitmentcandidature_note.php b/htdocs/recruitment/recruitmentcandidature_note.php index ccb6b2a60cc..543d7a66c10 100644 --- a/htdocs/recruitment/recruitmentcandidature_note.php +++ b/htdocs/recruitment/recruitmentcandidature_note.php @@ -24,17 +24,17 @@ // Load Dolibarr environment require_once '../main.inc.php'; -dol_include_once('/recruitment/class/recruitmentcandidature.class.php'); -dol_include_once('/recruitment/lib/recruitment_recruitmentcandidature.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment_recruitmentcandidature.lib.php'; // Load translation files required by the page $langs->loadLangs(array("recruitment", "companies")); // Get parameters $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects @@ -139,7 +139,6 @@ if ($id > 0 || !empty($ref)) { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; print '
'; diff --git a/htdocs/recruitment/recruitmentjobposition_agenda.php b/htdocs/recruitment/recruitmentjobposition_agenda.php index 11e54486bfe..38adf67acc1 100644 --- a/htdocs/recruitment/recruitmentjobposition_agenda.php +++ b/htdocs/recruitment/recruitmentjobposition_agenda.php @@ -27,8 +27,8 @@ require_once '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -dol_include_once('/recruitment/class/recruitmentjobposition.class.php'); -dol_include_once('/recruitment/lib/recruitment_recruitmentjobposition.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment_recruitmentjobposition.lib.php'; // Load translation files required by the page @@ -36,9 +36,9 @@ $langs->loadLangs(array("recruitment", "other")); // Get parameters $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); if (GETPOST('actioncode', 'array')) { diff --git a/htdocs/recruitment/recruitmentjobposition_applications.php b/htdocs/recruitment/recruitmentjobposition_applications.php index 6a7d471046e..3cdca44c93e 100644 --- a/htdocs/recruitment/recruitmentjobposition_applications.php +++ b/htdocs/recruitment/recruitmentjobposition_applications.php @@ -22,52 +22,23 @@ */ // 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 && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} - +require_once '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -dol_include_once('/recruitment/class/recruitmentjobposition.class.php'); -dol_include_once('/recruitment/lib/recruitment_recruitmentjobposition.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment_recruitmentjobposition.lib.php'; // Load translation files required by the page $langs->loadLangs(array("recruitment", "other")); // Get parameters $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'recruitmentjobpositioncard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index cf41a06f954..bdae11bdc60 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -37,12 +37,12 @@ $langs->loadLangs(array("recruitment", "other")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'recruitmentjobpositioncard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -//$lineid = GETPOST('lineid', 'int'); +//$lineid = GETPOST('lineid', 'int'); // Initialize technical objects $object = new RecruitmentJobPosition($db); diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 5435a5a2ac2..5b1bee43e56 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -29,9 +29,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; -// for other modules -//dol_include_once('/othermodule/class/otherobject.class.php'); - // Load translation files required by the page $langs->loadLangs(array("recruitment", "other")); diff --git a/htdocs/recruitment/recruitmentjobposition_note.php b/htdocs/recruitment/recruitmentjobposition_note.php index bbcced5326a..dcda5b53109 100644 --- a/htdocs/recruitment/recruitmentjobposition_note.php +++ b/htdocs/recruitment/recruitmentjobposition_note.php @@ -24,17 +24,17 @@ // Load Dolibarr environment require_once '../main.inc.php'; -dol_include_once('/recruitment/class/recruitmentjobposition.class.php'); -dol_include_once('/recruitment/lib/recruitment_recruitmentjobposition.lib.php'); +require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentjobposition.class.php'; +require_once DOL_DOCUMENT_ROOT.'/recruitment/lib/recruitment_recruitmentjobposition.lib.php'; // Load translation files required by the page $langs->loadLangs(array("recruitment", "companies")); // Get parameters $id = GETPOST('id', 'int'); -$ref = GETPOST('ref', 'alpha'); +$ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); -$cancel = GETPOST('cancel', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects @@ -97,7 +97,6 @@ if ($id > 0 || !empty($ref)) { print dol_get_fiche_head($head, 'note', $langs->trans("RecruitmentJobPosition"), -1, $object->picto); // Object card - // ------------------------------------------------------------ $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; diff --git a/htdocs/zapier/lib/zapier.lib.php b/htdocs/zapier/lib/zapier.lib.php index e483ebd9229..dedec01ac71 100644 --- a/htdocs/zapier/lib/zapier.lib.php +++ b/htdocs/zapier/lib/zapier.lib.php @@ -52,7 +52,7 @@ function zapierAdminPrepareHead() //$this->tabs = array( // 'entity:-tabname:Title:@zapier:/zapier/mypage.php?id=__ID__' //); // to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'zapier'); + complete_head_from_modules($conf, $langs, null, $head, $h, 'zapier'); return $head; } From 32f5642156c53c5ae9c4cb501abbd24e4f4d1b20 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:43:26 +0200 Subject: [PATCH 342/453] Update transfer.php --- htdocs/compta/bank/transfer.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index ff38abb32d4..cb3f04d5126 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -22,17 +22,21 @@ */ /** - * \file htdocs/compta/bank/transfer.php - * \ingroup banque - * \brief Page de saisie d'un virement + * \file htdocs/compta/bank/transfer.php + * \ingroup bank + * \brief Page for entering a bank transfer */ + +// Load Dolibarr environment require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page -$langs->loadLangs(array("banks", "categories", "multicurrency")); +$langs->loadLangs(array('banks', 'categories', 'multicurrency')); + + $socid = 0; if ($user->socid > 0) { $socid = $user->socid; From af6308799cf252f61805fc28ea57265c77f5e9c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 8 Sep 2022 20:48:05 +0200 Subject: [PATCH 343/453] Update ticket.class.php --- htdocs/ticket/class/ticket.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 18cdf5e1067..9d19e5d95c6 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Christophe Battarel - * Copyright (C) 2019-2020 Frédéric France + * Copyright (C) 2019-2022 Frédéric France * Copyright (C) 2020 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -108,7 +108,8 @@ class Ticket extends CommonObject /** * @var int Ticket statut - * @deprecated + * @deprecated use status + * @see $status */ public $fk_statut; @@ -217,7 +218,9 @@ class Ticket extends CommonObject */ public $oldcopy; - + /** + * @var array array of TicketsLine + */ public $lines; @@ -3013,7 +3016,7 @@ class TicketsLine { /** * @var int ID - * @deprecated + * @deprecated use id */ public $rowid; From 31c8dce167b9d985c0f6fb43aa7d311018bdef0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 8 Sep 2022 20:51:12 +0200 Subject: [PATCH 344/453] Update agenda.php --- htdocs/ticket/agenda.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index a79d30bb377..5f7263f5214 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -41,12 +41,12 @@ $track_id = GETPOST('track_id', 'alpha', 3); $socid = GETPOST('socid', 'int'); $action = GETPOST('action', 'aZ09'); -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); -$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -$page = is_numeric($page) ? $page : 0; -$page = $page == -1 ? 0 : $page; +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +$page = is_numeric($page) ? $page : 0; +$page = $page == -1 ? 0 : $page; if (!$sortfield) { $sortfield = "a.datep,a.id"; } @@ -90,7 +90,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) { accessforbidden(); } // or for unauthorized internals users -if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { +if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden(); } @@ -146,7 +146,7 @@ if ($socid > 0) { print dol_get_fiche_end(); } -if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { +if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY)) { $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; } elseif ($user->socid > 0) { $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; @@ -244,12 +244,12 @@ if (!empty($object->id)) { $morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 1, array('morecss'=>'btnTitleSelected')); // Show link to add a message (if read and not closed) - $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; $url = 'card.php?track_id='.$object->track_id.'&action=presend_addmessage&mode=init'; $morehtmlright .= dolGetButtonTitle($langs->trans('TicketAddMessage'), '', 'fa fa-comment-dots', $url, 'add-new-ticket-title-button', $btnstatus); // Show link to add event (if read and not closed) - $btnstatus = $object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; + $btnstatus = $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage"; $url = DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.date('YmdHi').'&origin=ticket&originid='.$object->id.'&projectid='.$object->fk_project.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id); $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, 'add-new-ticket-even-button', $btnstatus); From 1a3ff13808622cf97d72a6f1631fafdfef2a2aa9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 20:52:33 +0200 Subject: [PATCH 345/453] FIX Restore the option MAIN_OPTIMIZEFORTEXTBROWSER --- htdocs/core/lib/usergroups.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index accbd84ba8c..367a4eb087e 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -906,7 +906,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } // Use MAIN_OPTIMIZEFORTEXTBROWSER - if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if ($foruserprofile) { //$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER); $default = $langs->trans('No'); print ''; From 64beee3396d9978ef4483163bb150224e42de903 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 22:04:29 +0200 Subject: [PATCH 346/453] FIX the shipment PDF was using the full size logo instead of small --- .../modules/expedition/doc/pdf_espadon.modules.php | 10 +++++++++- .../core/modules/expedition/doc/pdf_merou.modules.php | 10 +++++++++- .../core/modules/expedition/doc/pdf_rouget.modules.php | 10 +++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 39df041bb51..5280c2b7a1e 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -969,8 +969,16 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 9a905422ff1..3646ef515de 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -548,8 +548,16 @@ class pdf_merou extends ModelePdfExpedition //*********************LOGO**************************** $pdf->SetXY(11, 7); - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, 10, 5, 0, $height); // width=0 (auto) diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index eededb90d67..b2bacffa901 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -914,8 +914,16 @@ class pdf_rouget extends ModelePdfExpedition $pdf->SetXY($this->marge_gauche, $posy); // Logo - $logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo; if ($this->emetteur->logo) { + $logodir = $conf->mycompany->dir_output; + if (!empty($conf->mycompany->multidir_output[$object->entity])) { + $logodir = $conf->mycompany->multidir_output[$object->entity]; + } + if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { + $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; + } else { + $logo = $logodir.'/logos/'.$this->emetteur->logo; + } if (is_readable($logo)) { $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) From 36b798e9a81986b16b432f05ee1366925274b459 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 22:16:31 +0200 Subject: [PATCH 347/453] Fix responsive --- htdocs/expedition/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 2d81c5e0545..9b55ff46c14 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -658,7 +658,7 @@ if (!empty($arrayfields['e.fk_shipping_method']['checked'])) { // Delivery method print ''; $shipment->fetch_delivery_methods(); - print $form->selectarray("search_shipping_method_id", $shipment->meths, $search_shipping_method_id, 1, 0, 0, "", 1); + print $form->selectarray("search_shipping_method_id", $shipment->meths, $search_shipping_method_id, 1, 0, 0, "", 1, 0, 0, '', 'maxwidth150'); print "\n"; } // Tracking number @@ -904,7 +904,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['e.fk_shipping_method']['checked'])) { // Get code using getLabelFromKey $code=$langs->getLabelFromKey($db, $shipment->shipping_method_id, 'c_shipment_mode', 'rowid', 'code'); - print ''; + print ''; if ($shipment->shipping_method_id > 0) print $langs->trans("SendingMethod".strtoupper($code)); print ''; } From 25199fd9c627855da164b5d276ac143cae176614 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 23:49:25 +0200 Subject: [PATCH 348/453] Code comment --- htdocs/admin/mails_templates.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 0c12ba1a3a0..dc46561b1f8 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1060,21 +1060,29 @@ if ($num) { print ''.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; print ''; } + + // If $acceptlocallinktomedia is true, we can add link media files int email templates (we already can do this into HTML editor of an email). + // Note that local link to a file into medias are replaced with a real link by email in CMailFile.class.php with value $urlwithroot defined like this: + // $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + // $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $acceptlocallinktomedia = true; // TODO Set it to true only if $urlwithroot is a HTTPS link ? + if ($tmpfieldlist == 'content') { print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; $okforextended = true; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_6, '90%'); + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%'); print $doleditor->Create(1); } if ($tmpfieldlist == 'content_lines') { print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; $okforextended = true; - if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) + if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { $okforextended = false; - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%'); + } + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%'); print $doleditor->Create(1); } print ''; From a87fbd3f06c3edf0c138ffd924bcbdd656bad10e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Sep 2022 23:58:38 +0200 Subject: [PATCH 349/453] Bad type --- htdocs/core/class/doleditor.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 2be0c36c56c..4402ff51732 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -68,7 +68,7 @@ class DolEditor * @param int $readonly 0=Read/Edit, 1=Read only * @param array $poscursor Array for initial cursor position array('x'=>x, 'y'=>y) */ - public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array()) + public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = 1, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array()) { global $conf, $langs; From e03d2311c39d37e893f54b38c46e73d87fd9b788 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 00:08:20 +0200 Subject: [PATCH 350/453] Accept media links if public url is not private --- htdocs/admin/mails_templates.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index dc46561b1f8..58a694726bc 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1065,7 +1065,35 @@ if ($num) { // Note that local link to a file into medias are replaced with a real link by email in CMailFile.class.php with value $urlwithroot defined like this: // $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); // $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - $acceptlocallinktomedia = true; // TODO Set it to true only if $urlwithroot is a HTTPS link ? + $acceptlocallinktomedia = getDolGlobalInt('MAIN_DISALLOW_MEDIAS_IN_EMAIL_TEMPLATES') ? 0 : 1; + if ($acceptlocallinktomedia) { + global $dolibarr_main_url_root; + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + + // Parse $newUrl + $newUrlArray = parse_url($urlwithouturlroot); + $hosttocheck = $newUrlArray['host']; + $hosttocheck = str_replace(array('[', ']'), '', $hosttocheck); // Remove brackets of IPv6 + + if (function_exists('gethostbyname')) { + $iptocheck = gethostbyname($hosttocheck); + } else { + $iptocheck = $hosttocheck; + } + + //var_dump($iptocheck.' '.$acceptlocallinktomedia); + if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { + // If ip of public url is an private network IP, we do not allow this. + $acceptlocallinktomedia = 0; + // TODO Show a warning + } + + if (preg_match('/http:/i', $urlwithouturlroot)) { + // If public url is not a https, we do not allow to add medias link. It will generate security alerts when email will be sent. + $acceptlocallinktomedia = 0; + // TODO Show a warning + } + } if ($tmpfieldlist == 'content') { print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; From fa64be5e82ef7093985f5c88aafeb3580c4a5404 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 00:29:45 +0200 Subject: [PATCH 351/453] Fix wrong number of td --- htdocs/compta/resultat/clientfourn.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 936adb482d2..915fa4de771 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1520,15 +1520,17 @@ $hookmanager->initHooks(array('externalbalance')); $reshook = $hookmanager->executeHooks('addBalanceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks print $hookmanager->resPrint; + + // Total print ''; -print ' '; +print ' '; print ''; print ''.$langs->trans("Income").''; if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht_income, 'MT')).''; -} else { +} elseif ($modecompta == 'RECETTES-DEPENSES') { print ''; } print ''.price(price2num($total_ttc_income, 'MT')).''; @@ -1536,7 +1538,7 @@ print ''; print ''.$langs->trans("Outcome").''; if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num(-$total_ht_outcome, 'MT')).''; -} else { +} elseif ($modecompta == 'RECETTES-DEPENSES') { print ''; } print ''.price(price2num(-$total_ttc_outcome, 'MT')).''; @@ -1544,7 +1546,7 @@ print ''; print ''.$langs->trans("Profit").''; if ($modecompta == 'CREANCES-DETTES') { print ''.price(price2num($total_ht, 'MT')).''; -} else { +} elseif ($modecompta == 'RECETTES-DEPENSES') { print ''; } print ''.price(price2num($total_ttc, 'MT')).''; From c5d5a963cb377f55bc95b5e2a4125f205965dfce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 00:38:16 +0200 Subject: [PATCH 352/453] Fix preselected country --- htdocs/accountancy/admin/categories_list.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index ea613ea38cd..aca2854df7f 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -885,9 +885,11 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co $fieldname = 'country'; if ($context == 'add') { $fieldname = 'country_id'; - print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); + $preselectcountrycode = GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $mysoc->country_code; + print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); } else { - print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); + $preselectcountrycode = (empty($obj->country_code) ? (empty($obj->country) ? $mysoc->country_code : $obj->country) : $obj->country_code); + print $form->select_country($preselectcountrycode, $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); } print ''; } elseif ($fieldlist[$field] == 'country_id') { From 5341c7a4a18cb7f12d376e4666c1ecfb1e9ffb53 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 01:36:58 +0200 Subject: [PATCH 353/453] Fix sql error --- htdocs/compta/resultat/clientfourn.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 915fa4de771..2c9d467ddc2 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1062,7 +1062,11 @@ if ($modecompta == 'BOOKKEEPING') { $sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; } - $sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm"; + if ($modecompta == 'CREANCES-DETTES') { + //No need of GROUP BY + } else { + $sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm"; + } $newsortfield = $sortfield; if ($newsortfield == 's.nom, s.rowid') { $newsortfield = 'p.ref'; From c505b6618aad8c7551357c8addf051753cbadcd0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 01:42:43 +0200 Subject: [PATCH 354/453] Fix type --- htdocs/core/class/doleditor.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index b529d23ebda..e5b7512895c 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -68,7 +68,7 @@ class DolEditor * @param int $readonly 0=Read/Edit, 1=Read only * @param array $poscursor Array for initial cursor position array('x'=>x, 'y'=>y) */ - public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array()) + public function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = 1, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0, $poscursor = array()) { global $conf, $langs; From 9a09e0f304b21af390ba8e7a632b2a94844369ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 02:26:45 +0200 Subject: [PATCH 355/453] Merge SEPA payment using Stripe manually. --- htdocs/compta/facture/prelevement.php | 24 ++- htdocs/langs/en_US/withdrawals.lang | 1 + htdocs/stripe/class/stripe.class.php | 251 +++++++++++++------------- 3 files changed, 149 insertions(+), 127 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 5a10c2055c0..8bd2a02ce57 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -111,8 +111,14 @@ if (empty($reshook)) { $sourcetype = 'supplier_invoice'; $newtype = 'bank-transfer'; } + $paymentservice = GETPOST('paymentservice'); + + if (preg_match('/stripesepa/', $paymentservice)) { + $result = $object->demande_prelevement_stripe($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype); + } else { + $result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype); + } - $result = $object->demande_prelevement($user, price2num(GETPOST('withdraw_request_amount', 'alpha')), $newtype, $sourcetype); if ($result > 0) { $db->commit(); @@ -736,6 +742,22 @@ if ($object->id > 0) { print ''; print ''; print ''; + + if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) { + print "
"; + //add stripe sepa button + $buttonlabel = $langs->trans("MakeWithdrawRequestStripe"); + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + } } else { print ''.$buttonlabel.''; } diff --git a/htdocs/langs/en_US/withdrawals.lang b/htdocs/langs/en_US/withdrawals.lang index c7820a965aa..c2d9a042ece 100644 --- a/htdocs/langs/en_US/withdrawals.lang +++ b/htdocs/langs/en_US/withdrawals.lang @@ -42,6 +42,7 @@ CreditTransferStatistics=Credit transfer statistics Rejects=Rejects LastWithdrawalReceipt=Latest %s direct debit receipts MakeWithdrawRequest=Make a direct debit payment request +MakeWithdrawRequestStripe=Make a direct debit payment request via Stripe MakeBankTransferOrder=Make a credit transfer request WithdrawRequestsDone=%s direct debit payment requests recorded BankTransferRequestsDone=%s credit transfer requests recorded diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 6410050c642..ea453b28412 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -434,8 +434,10 @@ class Stripe extends CommonObject // list of payment method types $paymentmethodtypes = array("card"); + $descriptor = dol_trunc($tag, 10, 'right', 'UTF-8', 1); if (!empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) { $paymentmethodtypes[] = "sepa_debit"; //&& ($object->thirdparty->isInEEC()) + //$descriptor = preg_replace('/ref=[^:=]+/', '', $descriptor); // Clean ref } if (!empty($conf->global->STRIPE_KLARNA)) { $paymentmethodtypes[] = "klarna"; @@ -463,7 +465,8 @@ class Stripe extends CommonObject "currency" => $currency_code, "payment_method_types" => $paymentmethodtypes, "description" => $description, - "statement_descriptor_suffix" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + "statement_descriptor_suffix" => $descriptor, // For card payment, 22 chars that appears on bank receipt (prefix into stripe setup + this suffix) + "statement_descriptor" => $descriptor, // For SEPA, it will take only statement_descriptor, not statement_descriptor_suffix //"save_payment_method" => true, "setup_future_usage" => "on_session", "metadata" => $metadata @@ -589,131 +592,6 @@ class Stripe extends CommonObject } } - /** - * Get the Stripe SEPA of a company payment mode - * - * @param \Stripe\StripeCustomer $cu Object stripe customer. - * @param CompanyPaymentMode $object Object companypaymentmode to check, or create on stripe (create on stripe also update the societe_rib table for current entity) - * @param string $stripeacc ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect - * @param int $status Status (0=test, 1=live) - * @param int $createifnotlinkedtostripe 1=Create the stripe sepa and the link if the sepa is not yet linked to a stripe sepa. Deprecated with new Stripe API and SCA. - * @return \Stripe\PaymentMethod|null Stripe SEPA or null if not found - */ - public function sepaStripe($cu, CompanyPaymentMode $object, $stripeacc = '', $status = 0, $createifnotlinkedtostripe = 0) - { - global $conf, $user, $langs; - $sepa = null; - - $sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.iban_prefix"; // stripe_card_ref is src_ for sepa - $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as sa"; - $sql .= " WHERE sa.rowid = '".$this->db->escape($object->id)."'"; // We get record from ID, no need for filter on entity - $sql .= " AND sa.type = 'ban'"; //type ban to get normal bank account of customer (prelevement) - - $soc = new Societe($this->db); - $soc->fetch($object->fk_soc); - - dol_syslog(get_class($this)."::fetch search stripe sepa(card) id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - if ($num) { - $obj = $this->db->fetch_object($resql); - $cardref = $obj->stripe_card_ref; - dol_syslog(get_class($this)."::cardStripe cardref=".$cardref); - if ($cardref) { - try { - if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage - if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) { - $sepa = $cu->sources->retrieve($cardref); - } else { - $sepa = \Stripe\PaymentMethod::retrieve($cardref); - } - } else { - if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) { - //$sepa = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided - $sepa = $cu->sources->retrieve($cardref); - } else { - //$sepa = \Stripe\PaymentMethod::retrieve($cardref, array("stripe_account" => $stripeacc)); // Don't know if this works - $sepa = \Stripe\PaymentMethod::retrieve($cardref); - } - } - } catch (Exception $e) { - $this->error = $e->getMessage(); - dol_syslog($this->error, LOG_WARNING); - } - } elseif ($createifnotlinkedtostripe) { - $iban = $obj->iban_prefix; //prefix ? - $ipaddress = getUserRemoteIP(); - - $dataforcard = array( - 'type'=>'sepa_debit', - "sepa_debit" => array('iban' => $iban), - 'currency' => 'eur', - 'usage' => 'reusable', - 'owner' => array( - 'name' => $soc->name, - ), - "metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress) - ); - - //$a = \Stripe\Stripe::getApiKey(); - //var_dump($a);var_dump($stripeacc);exit; - try { - dol_syslog("Try to create sepa_debit 0"); - - $service = 'StripeTest'; - $servicestatus = 0; - if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { - $service = 'StripeLive'; - $servicestatus = 1; - } - // Force to use the correct API key - global $stripearrayofkeysbyenv; - $stripeacc = $stripearrayofkeysbyenv[$servicestatus]['secret_key']; - - dol_syslog("Try to create sepa_debit with data = ".json_encode($dataforcard)); - $s = new \Stripe\StripeClient($stripeacc); - $sepa = $s->sources->create($dataforcard); - if (!$sepa) { - $this->error = 'Creation of sepa_debit on Stripe has failed'; - } else { - //association du client avec cette source de paimeent - $cs = $cu->createSource( - $cu->id, - [ - 'source' => $sepa->id, - ] - ); - if (!$cs) { - $this->error = 'Link SEPA <-> Customer failed'; - } else { - dol_syslog("Try to create sepa_debit 3"); - // print json_encode($sepa); - - $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib"; - $sql .= " SET stripe_card_ref = '".$this->db->escape($sepa->id)."', card_type = 'sepa_debit',"; - $sql .= " stripe_account= '" . $this->db->escape($cu->id . "@" . $stripeacc) . "'"; - $sql .= " WHERE rowid = '".$this->db->escape($object->id)."'"; - $sql .= " AND type = 'ban'"; - $resql = $this->db->query($sql); - if (!$resql) { - $this->error = $this->db->lasterror(); - } - } - } - } catch (Exception $e) { - $this->error = $e->getMessage(); - dol_syslog($this->error, LOG_WARNING); - } - } - } - } else { - dol_print_error($this->db); - } - - return $sepa; - } - /** * Get the Stripe payment intent. Create it with confirmnow=false * Warning. If a payment was tried and failed, a payment intent was created. @@ -1012,6 +890,127 @@ class Stripe extends CommonObject return $card; } + + /** + * Get the Stripe SEPA of a company payment mode + * + * @param \Stripe\StripeCustomer $cu Object stripe customer. + * @param CompanyPaymentMode $object Object companypaymentmode to check, or create on stripe (create on stripe also update the societe_rib table for current entity) + * @param string $stripeacc ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect + * @param int $status Status (0=test, 1=live) + * @param int $createifnotlinkedtostripe 1=Create the stripe sepa and the link if the sepa is not yet linked to a stripe sepa. Deprecated with new Stripe API and SCA. + * @return \Stripe\PaymentMethod|null Stripe SEPA or null if not found + */ + public function sepaStripe($cu, CompanyPaymentMode $object, $stripeacc = '', $status = 0, $createifnotlinkedtostripe = 0) + { + global $conf, $user, $langs; + $sepa = null; + + $sql = "SELECT sa.stripe_card_ref, sa.proprio, sa.iban_prefix"; // stripe_card_ref is src_ for sepa + $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as sa"; + $sql .= " WHERE sa.rowid = '".$this->db->escape($object->id)."'"; // We get record from ID, no need for filter on entity + $sql .= " AND sa.type = 'ban'"; //type ban to get normal bank account of customer (prelevement) + + $soc = new Societe($this->db); + $soc->fetch($object->fk_soc); + + dol_syslog(get_class($this)."::fetch search stripe sepa(card) id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + if ($num) { + $obj = $this->db->fetch_object($resql); + $cardref = $obj->stripe_card_ref; + dol_syslog(get_class($this)."::cardStripe cardref=".$cardref); + if ($cardref) { + try { + if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage + if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) { + $sepa = $cu->sources->retrieve($cardref); + } else { + $sepa = \Stripe\PaymentMethod::retrieve($cardref); + } + } else { + if (!preg_match('/^pm_/', $cardref) && !empty($cu->sources)) { + //$sepa = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided + $sepa = $cu->sources->retrieve($cardref); + } else { + //$sepa = \Stripe\PaymentMethod::retrieve($cardref, array("stripe_account" => $stripeacc)); // Don't know if this works + $sepa = \Stripe\PaymentMethod::retrieve($cardref); + } + } + } catch (Exception $e) { + $this->error = $e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + } + } elseif ($createifnotlinkedtostripe) { + $iban = $obj->iban_prefix; //prefix ? + $ipaddress = getUserRemoteIP(); + + $dataforcard = array( + 'type'=>'sepa_debit', + "sepa_debit" => array('iban' => $iban), + 'currency' => 'eur', + 'usage' => 'reusable', + 'owner' => array( + 'name' => $soc->name, + ), + "metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress) + ); + + //$a = \Stripe\Stripe::getApiKey(); + //var_dump($a);var_dump($stripeacc);exit; + try { + dol_syslog("Try to create sepa_debit 0"); + + $service = 'StripeTest'; + $servicestatus = 0; + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { + $service = 'StripeLive'; + $servicestatus = 1; + } + // Force to use the correct API key + global $stripearrayofkeysbyenv; + $stripeacc = $stripearrayofkeysbyenv[$servicestatus]['secret_key']; + + dol_syslog("Try to create sepa_debit with data = ".json_encode($dataforcard)); + $s = new \Stripe\StripeClient($stripeacc); + $sepa = $s->sources->create($dataforcard); + if (!$sepa) { + $this->error = 'Creation of sepa_debit on Stripe has failed'; + } else { + // association du client avec cette source de paimeent + $cs = $cu->createSource($cu->id, array('source' => $sepa->id)); + if (!$cs) { + $this->error = 'Link SEPA <-> Customer failed'; + } else { + dol_syslog("Try to create sepa_debit 3"); + // print json_encode($sepa); + + $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib"; + $sql .= " SET stripe_card_ref = '".$this->db->escape($sepa->id)."', card_type = 'sepa_debit',"; + $sql .= " stripe_account= '" . $this->db->escape($cu->id . "@" . $stripeacc) . "'"; + $sql .= " WHERE rowid = '".$this->db->escape($object->id)."'"; + $sql .= " AND type = 'ban'"; + $resql = $this->db->query($sql); + if (!$resql) { + $this->error = $this->db->lasterror(); + } + } + } + } catch (Exception $e) { + $this->error = $e->getMessage(); + dol_syslog($this->error, LOG_WARNING); + } + } + } + } else { + dol_print_error($this->db); + } + + return $sepa; + } + /** * Create charge. * This is called by page htdocs/stripe/payment.php and may be deprecated. From 584f9e6a73117e3d652ff52c01271788ee158f87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 04:10:48 +0200 Subject: [PATCH 356/453] Clean code to manage SEPA payment using external service --- htdocs/core/class/commoninvoice.class.php | 809 ++++++++++++++++++ htdocs/langs/en_US/errors.lang | 3 +- .../class/companybankaccount.class.php | 10 +- htdocs/societe/paymentmodes.php | 442 +++++++--- htdocs/stripe/class/stripe.class.php | 8 +- 5 files changed, 1148 insertions(+), 124 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index bed28c63035..190e3a3fc62 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -823,6 +823,815 @@ abstract class CommonInvoice extends CommonObject } } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Create a withdrawal request for a direct debit order or a credit transfer order. + * Use the remain to pay excluding all existing open direct debit requests. + * + * @param User $fuser User asking the direct debit transfer + * @param float $amount Amount we request direct debit for + * @param string $type 'direct-debit' or 'bank-transfer' + * @param string $sourcetype Source ('facture' or 'supplier_invoice') + * @return int <0 if KO, >0 if OK + */ + public function demande_prelevement_stripe($fuser, $amount = 0, $type = 'direct-debit', $sourcetype = 'facture') + { + // phpcs:enable + global $conf, $mysoc, $user, $langs; + + if (empty($conf->global->STRIPE_SEPA_DIRECT_DEBIT)) { + //exit + return 0; + } + + $error = 0; + + dol_syslog(get_class($this)."::demande_prelevement_stripe 0", LOG_DEBUG); + + if ($this->statut > self::STATUS_DRAFT && $this->paye == 0) { + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; + $bac = new CompanyBankAccount($this->db); + $bac->fetch(0, $this->socid); + + $sql = 'SELECT count(*)'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; + $sql .= ' WHERE fk_facture = '.$this->id; + $sql .= ' AND ext_payment_id IS NULL'; // To exclude record done for some online payments + $sql .= ' AND traite = 0'; + + dol_syslog(get_class($this)."::demande_prelevement_stripe 1", LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $row = $this->db->fetch_row($resql); + + if ($row[0] == 0) { + $now = dol_now(); + + $totalpaye = $this->getSommePaiement(); + $totalcreditnotes = $this->getSumCreditNotesUsed(); + $totaldeposits = $this->getSumDepositsUsed(); + //print "totalpaye=".$totalpaye." totalcreditnotes=".$totalcreditnotes." totaldeposts=".$totaldeposits; + + // We can also use bcadd to avoid pb with floating points + // For example print 239.2 - 229.3 - 9.9; does not return 0. + //$resteapayer=bcadd($this->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT); + //$resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT); + if (empty($amount)) { + $amount = price2num($this->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT'); + } + + if (is_numeric($amount) && $amount != 0) { + require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php'; + $companypaymentmode = new CompanyPaymentMode($this->db); + $companypaymentmode->fetch($bac->id); + + dol_syslog(get_class($this)."::demande_prelevement_stripe amount=$amount, companypaymentmode = " . $companypaymentmode->id, LOG_DEBUG); + + //Start code from sellyoursaas + $service = 'StripeTest'; + $servicestatus = 0; + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { + $service = 'StripeLive'; + $servicestatus = 1; + } + + $langs->load("agenda"); + dol_syslog("doTakePaymentStripeForThirdparty service=" . $service . " servicestatus=" . $servicestatus . " thirdparty_id=" . $this->socid . " companypaymentmode=" . $companypaymentmode->id . " noemailtocustomeriferror=" . $noemailtocustomeriferror . " nocancelifpaymenterror=" . $nocancelifpaymenterror . " calledinmyaccountcontext=" . $calledinmyaccountcontext); + + $this->stripechargedone = 0; + $this->stripechargeerror = 0; + $now = dol_now(); + + $currency = $conf->currency; + + global $stripearrayofkeysbyenv; + global $savstripearrayofkeysbyenv; + + $errorforinvoice = 0; // We reset the $errorforinvoice at each invoice loop + + $this->fetch_thirdparty(); + + dol_syslog("--- Process invoice thirdparty_id=" . $this->id . ", thirdparty_name=" . $this->thirdparty->name . " id=" . $this->id . ", ref=" . $this->ref . ", datef=" . dol_print_date($this->date, 'dayhourlog'), LOG_DEBUG); + + $alreadypayed = $this->getSommePaiement(); + $amount_credit_notes_included = $this->getSumCreditNotesUsed(); + $amounttopay = $this->total_ttc - $alreadypayed - $amount_credit_notes_included; + + // Correct the amount according to unit of currency + // See https://support.stripe.com/questions/which-zero-decimal-currencies-does-stripe-support + $arrayzerounitcurrency = ['BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF']; + $amountstripe = $amounttopay; + if (!in_array($currency, $arrayzerounitcurrency)) { + $amountstripe = $amountstripe * 100; + } + + if ($amountstripe > 0) { + try { + //var_dump($companypaymentmode); + dol_syslog("We will try to pay with companypaymentmodeid=" . $companypaymentmode->id . " stripe_card_ref=" . $companypaymentmode->stripe_card_ref . " mode=" . $companypaymentmode->status, LOG_DEBUG); + + $thirdparty = new Societe($this->db); + $resultthirdparty = $thirdparty->fetch($this->socid); + + include_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php'; // This include the include of htdocs/stripe/config.php + // So it inits or erases the $stripearrayofkeysbyenv + $stripe = new Stripe($this->db); + + if (empty($savstripearrayofkeysbyenv)) { + $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv; + } + dol_syslog("Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']); + dol_syslog("Current Saved Stripe environment is " . $savstripearrayofkeysbyenv[$servicestatus]['publishable_key']); + + $foundalternativestripeaccount = ''; + + // Force stripe to another value (by default this value is empty) + if (!empty($thirdparty->array_options['options_stripeaccount'])) { + dol_syslog("The thirdparty id=" . $thirdparty->id . " has a dedicated Stripe Account, so we switch to it."); + + $tmparray = explode('@', $thirdparty->array_options['options_stripeaccount']); + if (!empty($tmparray[1])) { + $tmparray2 = explode(':', $tmparray[1]); + if (!empty($tmparray2[3])) { + $stripearrayofkeysbyenv = [ + 0 => [ + "publishable_key" => $tmparray2[0], + "secret_key" => $tmparray2[1] + ], + 1 => [ + "publishable_key" => $tmparray2[2], + "secret_key" => $tmparray2[3] + ] + ]; + + $stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus]; + \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); + + $foundalternativestripeaccount = $tmparray[0]; // Store the customer id + + dol_syslog("We use now customer=" . $foundalternativestripeaccount . " publishable_key=" . $stripearrayofkeys['publishable_key'], LOG_DEBUG); + } + } + + if (!$foundalternativestripeaccount) { + $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv; + + $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus]; + \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); + dol_syslog("We found a bad value for Stripe Account for thirdparty id=" . $thirdparty->id . ", so we ignore it and keep using the global one, so " . $stripearrayofkeys['publishable_key'], LOG_WARNING); + } + } else { + $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv; + + $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus]; + \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); + dol_syslog("The thirdparty id=" . $thirdparty->id . " has no dedicated Stripe Account, so we use global one, so " . json_encode($stripearrayofkeys), LOG_DEBUG); + } + + + dol_syslog("get stripe account", LOG_DEBUG); + $stripeacc = $stripe->getStripeAccount($service, $this->socid); // Get Stripe OAuth connect account if it exists (no network access here) + dol_syslog("get stripe account return " . json_encode($stripeacc), LOG_DEBUG); + + if ($foundalternativestripeaccount) { + if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage + $customer = \Stripe\Customer::retrieve(['id' => "$foundalternativestripeaccount", 'expand[]' => 'sources']); + } else { + $customer = \Stripe\Customer::retrieve(['id' => "$foundalternativestripeaccount", 'expand[]' => 'sources'], ["stripe_account" => $stripeacc]); + } + } else { + $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0); + if (empty($customer) && !empty($stripe->error)) { + $this->errors[] = $stripe->error; + } + /*if (!empty($customer) && empty($customer->sources)) { + $customer = null; + $this->errors[] = '\Stripe\Customer::retrieve did not returned the sources'; + }*/ + } + + // $nbhoursbetweentries = (empty($conf->global->SELLYOURSAAS_NBHOURSBETWEENTRIES) ? 49 : $conf->global->SELLYOURSAAS_NBHOURSBETWEENTRIES); // Must have more that 48 hours + 1 between each try (so 1 try every 3 daily batch) + // $nbdaysbeforeendoftries = (empty($conf->global->SELLYOURSAAS_NBDAYSBEFOREENDOFTRIES) ? 35 : $conf->global->SELLYOURSAAS_NBDAYSBEFOREENDOFTRIES); + $labeltouse = ''; + $postactionmessages = []; + + if ($resultthirdparty > 0 && !empty($customer)) { + if (!$error && !empty($this->array_options['options_delayautopayment']) && $this->array_options['options_delayautopayment'] > $now && empty($calledinmyaccountcontext)) { + $errmsg = 'Payment try was canceled (invoice qualified by the automatic payment was delayed after the ' . dol_print_date($this->array_options['options_delayautopayment'], 'day') . ')'; + dol_syslog($errmsg, LOG_DEBUG); + + $error++; + $errorforinvoice++; + $this->errors[] = $errmsg; + } + // if (!$error && ($this->date < ($now - ($nbdaysbeforeendoftries * 24 * 3600))) // We try until we reach $nbdaysbeforeendoftries + // && ($this->date < ($now - (62 * 24 * 3600)) || $this->date > ($now - (60 * 24 * 3600))) // or when we have 60 days + // && ($this->date < ($now - (92 * 24 * 3600)) || $this->date > ($now - (90 * 24 * 3600))) // or when we have 90 days + // && empty($nocancelifpaymenterror)) { + // $errmsg = 'Payment try was canceled (invoice date is older than ' . $nbdaysbeforeendoftries . ' days and not 60 days old and not 90 days old) - You can still take payment from backoffice.'; + // dol_syslog($errmsg, LOG_DEBUG); + + // $error++; + // $errorforinvoice++; + // $this->errors[] = $errmsg; + // } + // if (!$error && empty($nocancelifpaymenterror)) { // If we are not in a mode that ask to avoid cancelation, we cancel payment. + // // Test if last AC_PAYMENT_STRIPE_KO event is an old error lower than $nbhoursbetweentries hours. + // $recentfailedpayment = false; + // $sqlonevents = 'SELECT COUNT(*) as nb FROM ' . MAIN_DB_PREFIX . 'actioncomm WHERE fk_soc = ' . $thirdparty->id . " AND code ='AC_PAYMENT_STRIPE_KO' AND datep > '" . $this->db->idate($now - ($nbhoursbetweentries * 3600)) . "'"; + // $resqlonevents = $this->db->query($sqlonevents); + // if ($resqlonevents) { + // $obj = $this->db->fetch_object($resqlonevents); + // if ($obj && $obj->nb > 0) { + // $recentfailedpayment = true; + // } + // } + + // if ($recentfailedpayment) { + // $errmsg = 'Payment try was canceled (recent payment, in last ' . $nbhoursbetweentries . ' hours, with error AC_PAYMENT_STRIPE_KO for this customer)'; + // dol_syslog($errmsg, LOG_DEBUG); + + // $error++; + // $errorforinvoice++; + // $this->errors[] = $errmsg; + // } + // } + + if (!$error) { // Payment was not canceled + //erics card or sepa ? + $sepaMode = false; + if ($companypaymentmode->type == 'ban') { + $sepaMode = true; + $stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0); + } else { + $stripecard = $stripe->cardStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0); + } + + if ($stripecard) { // Can be card_... (old mode) or pm_... (new mode) + $FULLTAG = 'INV=' . $this->id . '-CUS=' . $thirdparty->id; + $description = 'Stripe payment from doTakePaymentStripeForThirdparty: ' . $FULLTAG . ' ref=' . $this->ref; + + $stripefailurecode = ''; + $stripefailuremessage = ''; + $stripefailuredeclinecode = ''; + + if (preg_match('/^card_/', $stripecard->id)) { // Using old method + dol_syslog("* Create charge on card " . $stripecard->id . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG); + + $ipaddress = getUserRemoteIP(); + + $charge = null; // Force reset of $charge, so, if already set from a previous fetch, it will be empty even if there is an exception at next step + try { + $charge = \Stripe\Charge::create([ + 'amount' => price2num($amountstripe, 'MU'), + 'currency' => $currency, + 'capture' => true, // Charge immediatly + 'description' => $description, + 'metadata' => ["FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version' => DOL_VERSION, 'dol_entity' => $conf->entity, 'ipaddress' => $ipaddress], + 'customer' => $customer->id, + //'customer' => 'bidon_to_force_error', // To use to force a stripe error + 'source' => $stripecard, + 'statement_descriptor' => dol_trunc('INV=' . $this->id, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description) + ]); + } catch (\Stripe\Error\Card $e) { + // Since it's a decline, Stripe_CardError will be caught + $body = $e->getJsonBody(); + $err = $body['error']; + + $stripefailurecode = $err['code']; + $stripefailuremessage = $err['message']; + $stripefailuredeclinecode = $err['decline_code']; + } catch (Exception $e) { + $stripefailurecode = 'UnknownChargeError'; + $stripefailuremessage = $e->getMessage(); + } + } else { // Using new SCA method + if ($sepaMode) + dol_syslog("* Create payment on SEPA " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG); + else dol_syslog("* Create payment on card " . $stripecard->id . ", amounttopay=" . $amounttopay . ", amountstripe=" . $amountstripe . ", FULLTAG=" . $FULLTAG, LOG_DEBUG); + + // Create payment intent and charge payment (confirmnow = true) + $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $invoice, $customer->id, $stripeacc, $servicestatus, 0, 'automatic', true, $stripecard->id, 1); + + $charge = new stdClass(); + //erics add processing sepa is like success ? + if ($paymentintent->status === 'succeeded' || $paymentintent->status === 'processing') { + $charge->status = 'ok'; + $charge->id = $paymentintent->id; + $charge->customer = $customer->id; + } elseif ($paymentintent->status === 'requires_action') { + //paymentintent->status may be => 'requires_action' (no error in such a case) + dol_syslog(var_export($paymentintent, true), LOG_DEBUG); + + $charge->status = 'failed'; + $charge->customer = $customer->id; + $charge->failure_code = $stripe->code; + $charge->failure_message = $stripe->error; + $charge->failure_declinecode = $stripe->declinecode; + $stripefailurecode = $stripe->code; + $stripefailuremessage = 'Action required. Contact the support at ';// . $conf->global->SELLYOURSAAS_MAIN_EMAIL; + $stripefailuredeclinecode = $stripe->declinecode; + } else { + dol_syslog(var_export($paymentintent, true), LOG_DEBUG); + + $charge->status = 'failed'; + $charge->customer = $customer->id; + $charge->failure_code = $stripe->code; + $charge->failure_message = $stripe->error; + $charge->failure_declinecode = $stripe->declinecode; + $stripefailurecode = $stripe->code; + $stripefailuremessage = $stripe->error; + $stripefailuredeclinecode = $stripe->declinecode; + } + + //var_dump("stripefailurecode=".$stripefailurecode." stripefailuremessage=".$stripefailuremessage." stripefailuredeclinecode=".$stripefailuredeclinecode); + //exit; + } + + // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) + if (empty($charge) || $charge->status == 'failed') { + dol_syslog('Failed to charge card or payment mode ' . $stripecard->id . ' stripefailurecode=' . $stripefailurecode . ' stripefailuremessage=' . $stripefailuremessage . ' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING); + + // Save a stripe payment was in error + $this->stripechargeerror++; + + $error++; + $errorforinvoice++; + $errmsg = $langs->trans("FailedToChargeCard"); + if (!empty($charge)) { + if ($stripefailuredeclinecode == 'authentication_required') { + $errauthenticationmessage = $langs->trans("ErrSCAAuthentication"); + $errmsg = $errauthenticationmessage; + } elseif (in_array($stripefailuredeclinecode, ['insufficient_funds', 'generic_decline'])) { + $errmsg .= ': ' . $charge->failure_code; + $errmsg .= ($charge->failure_message ? ' - ' : '') . ' ' . $charge->failure_message; + if (empty($stripefailurecode)) { + $stripefailurecode = $charge->failure_code; + } + if (empty($stripefailuremessage)) { + $stripefailuremessage = $charge->failure_message; + } + } else { + $errmsg .= ': failure_code=' . $charge->failure_code; + $errmsg .= ($charge->failure_message ? ' - ' : '') . ' failure_message=' . $charge->failure_message; + if (empty($stripefailurecode)) { + $stripefailurecode = $charge->failure_code; + } + if (empty($stripefailuremessage)) { + $stripefailuremessage = $charge->failure_message; + } + } + } else { + $errmsg .= ': ' . $stripefailurecode . ' - ' . $stripefailuremessage; + $errmsg .= ($stripefailuredeclinecode ? ' - ' . $stripefailuredeclinecode : ''); + } + + $description = 'Stripe payment ERROR from doTakePaymentStripeForThirdparty: ' . $FULLTAG; + $postactionmessages[] = $errmsg . ' (' . $stripearrayofkeys['publishable_key'] . ')'; + $this->errors[] = $errmsg; + } else { + dol_syslog('Successfuly charge card ' . $stripecard->id); + + $postactionmessages[] = 'Success to charge card (' . $charge->id . ' with ' . $stripearrayofkeys['publishable_key'] . ')'; + + // Save a stripe payment was done in realy life so later we will be able to force a commit on recorded payments + // even if in batch mode (method doTakePaymentStripe), we will always make all action in one transaction with a forced commit. + $this->stripechargedone++; + + // Default description used for label of event. Will be overwrite by another value later. + $description = 'Stripe payment OK (' . $charge->id . ') from doTakePaymentStripeForThirdparty: ' . $FULLTAG; + + $db = $this->db; + + $ipaddress = getUserRemoteIP(); + + $TRANSACTIONID = $charge->id; + $currency = $conf->currency; + $paymentmethod = 'stripe'; + $emetteur_name = $charge->customer; + + // Same code than into paymentok.php... + + $paymentTypeId = 0; + if ($paymentmethod == 'paybox') { + $paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS; + } + if ($paymentmethod == 'paypal') { + $paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS; + } + if ($paymentmethod == 'stripe') { + $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; + } + if (empty($paymentTypeId)) { + //erics + if ($sepaMode) { + $paymentType = 'PRE'; + } else { + $paymentType = $_SESSION["paymentType"]; + if (empty($paymentType)) { + $paymentType = 'CB'; + } + } + $paymentTypeId = dol_getIdFromCode($this->db, $paymentType, 'c_paiement', 'code', 'id', 1); + } + + $currencyCodeType = $currency; + + $ispostactionok = 1; + + // Creation of payment line + include_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php'; + $paiement = new Paiement($this->db); + $paiement->datepaye = $now; + $paiement->date = $now; + if ($currencyCodeType == $conf->currency) { + $paiement->amounts = [$this->id => $amounttopay]; // Array with all payments dispatching with invoice id + } else { + $paiement->multicurrency_amounts = [$this->id => $amounttopay]; // Array with all payments dispatching + + $postactionmessages[] = 'Payment was done in a different currency than currency expected of company'; + $ispostactionok = -1; + // Not yet supported, so error + $error++; + $errorforinvoice++; + } + $paiement->paiementid = $paymentTypeId; + $paiement->num_paiement = ''; + $paiement->num_payment = ''; + // Add a comment with keyword 'SellYourSaas' in text. Used by trigger. + $paiement->note_public = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; + $paiement->note_private = 'StripeSepa payment ' . dol_print_date($now, 'standard') . ' using ' . $paymentmethod . ($ipaddress ? ' from ip ' . $ipaddress : '') . ' - Transaction ID = ' . $TRANSACTIONID; + $paiement->ext_payment_id = $charge->id . ':' . $customer->id . '@' . $stripearrayofkeys['publishable_key']; + $paiement->ext_payment_site = 'stripe'; + + if (!$errorforinvoice) { + dol_syslog('* Record payment for invoice id ' . $this->id . '. It includes closing of invoice and regenerating document'); + + // This include closing invoices to 'paid' (and trigger including unsuspending) and regenerating document + $paiement_id = $paiement->create($user, 1); + if ($paiement_id < 0) { + $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } else { + $postactionmessages[] = 'Payment created'; + } + + dol_syslog("The payment has been created for invoice id " . $this->id); + } + + if (!$errorforinvoice && !empty($conf->banque->enabled)) { + dol_syslog('* Add payment to bank'); + + $bankaccountid = 0; + if ($paymentmethod == 'paybox') { + $bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS; + } + if ($paymentmethod == 'paypal') { + $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS; + } + if ($paymentmethod == 'stripe') { + $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS; + } + + if ($bankaccountid > 0) { + $label = '(CustomerInvoicePayment)'; + if ($this->type == Facture::TYPE_CREDIT_NOTE) { + $label = '(CustomerInvoicePaymentBack)'; + } // Refund of a credit note + $result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, $emetteur_name, ''); + if ($result < 0) { + $postactionmessages[] = $paiement->error . ($paiement->error ? ' ' : '') . join("
\n", $paiement->errors); + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } else { + $postactionmessages[] = 'Bank transaction of payment created (by doTakePaymentStripeForThirdparty)'; + } + } else { + $postactionmessages[] = 'Setup of bank account to use in module ' . $paymentmethod . ' was not set. No way to record the payment.'; + $ispostactionok = -1; + $error++; + $errorforinvoice++; + } + } + + if ($ispostactionok < 1) { + $description = 'Stripe payment OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') but post action KO from doTakePaymentStripeForThirdparty: ' . $FULLTAG; + } else { + $description = 'Stripe payment+post action OK (' . $charge->id . ' - ' . $amounttopay . ' ' . $conf->currency . ') from doTakePaymentStripeForThirdparty: ' . $FULLTAG; + } + } + + $object = $invoice; + + // Send emails + $labeltouse = 'InvoicePaymentSuccess'; + $sendemailtocustomer = 1; + + if (empty($charge) || $charge->status == 'failed') { + $labeltouse = 'InvoicePaymentFailure'; + if ($noemailtocustomeriferror) { + $sendemailtocustomer = 0; + } // $noemailtocustomeriferror is set when error already reported on myaccount screen + } + + // Track an event + if (empty($charge) || $charge->status == 'failed') { + $actioncode = 'PAYMENT_STRIPE_KO'; + $extraparams = $stripefailurecode; + $extraparams .= (($extraparams && $stripefailuremessage) ? ' - ' : '') . $stripefailuremessage; + $extraparams .= (($extraparams && $stripefailuredeclinecode) ? ' - ' : '') . $stripefailuredeclinecode; + } else { + $actioncode = 'PAYMENT_STRIPE_OK'; + $extraparams = ''; + } + } else { + $error++; + $errorforinvoice++; + dol_syslog("No card or payment method found for this stripe customer " . $customer->id, LOG_WARNING); + $this->errors[] = 'Failed to get card | payment method for stripe customer = ' . $customer->id; + + $labeltouse = 'InvoicePaymentFailure'; + $sendemailtocustomer = 1; + if ($noemailtocustomeriferror) { + $sendemailtocustomer = 0; + } // $noemailtocustomeriferror is set when error already reported on myaccount screen + + $description = 'Failed to find or use the payment mode - no credit card defined for the customer account'; + $stripefailurecode = 'BADPAYMENTMODE'; + $stripefailuremessage = 'Failed to find or use the payment mode - no credit card defined for the customer account'; + $postactionmessages[] = $description . ' (' . $stripearrayofkeys['publishable_key'] . ')'; + + $object = $invoice; + + $actioncode = 'PAYMENT_STRIPE_KO'; + $extraparams = ''; + } + } else { + // If error because payment was canceled for a logical reason, we do nothing (no email and no event added) + $labeltouse = ''; + $sendemailtocustomer = 0; + + $description = ''; + $stripefailurecode = ''; + $stripefailuremessage = ''; + + $object = $invoice; + + $actioncode = ''; + $extraparams = ''; + } + } else { // Else of the if ($resultthirdparty > 0 && ! empty($customer)) { + if ($resultthirdparty <= 0) { + dol_syslog('SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING); + $this->errors[] = 'Failed to load customer for thirdparty_id = ' . $thirdparty->id; + } else { // $customer stripe not found + dol_syslog('SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key'], LOG_WARNING); + $this->errors[] = 'Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id . " in mode " . $servicestatus . " in Stripe env " . $stripearrayofkeysbyenv[$servicestatus]['publishable_key']; + } + $error++; + $errorforinvoice++; + + $labeltouse = 'InvoicePaymentFailure'; + $sendemailtocustomer = 1; + if ($noemailtocustomeriferror) { + $sendemailtocustomer = 0; + } // $noemailtocustomeriferror is set when error already reported on myaccount screen + + $description = 'Failed to find or use your payment mode (no payment mode for this customer id)'; + $stripefailurecode = 'BADPAYMENTMODE'; + $stripefailuremessage = 'Failed to find or use your payment mode (no payment mode for this customer id)'; + $postactionmessages = []; + + $object = $invoice; + + $actioncode = 'PAYMENT_STRIPE_KO'; + $extraparams = ''; + } + + // Send email + create action after + if ($sendemailtocustomer && $labeltouse) { + dol_syslog("* Send email with result of payment - " . $labeltouse); + + // Set output language + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + $outputlangs->loadLangs(["main", "members", "bills"]); + + // Get email content from templae + $arraydefaultmessage = null; + + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; + $formmail = new FormMail($this->db); + + if (!empty($labeltouse)) { + $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'facture_send', $user, $outputlangs, 0, 1, $labeltouse); + } + + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { + $subject = $arraydefaultmessage->topic; + $msg = $arraydefaultmessage->content; + } + + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); + + //$substitutionarray['__SELLYOURSAAS_PAYMENT_ERROR_DESC__'] = $stripefailurecode . ' ' . $stripefailuremessage; + + complete_substitutions_array($substitutionarray, $outputlangs, $object); + + // Set the property ->ref_customer with ref_customer of contract so __REF_CLIENT__ will be replaced in email content + // Search contract linked to invoice + $foundcontract = null; + $this->fetchObjectLinked(); + if (is_array($this->linkedObjects['contrat']) && count($this->linkedObjects['contrat']) > 0) { + //dol_sort_array($object->linkedObjects['facture'], 'date'); + foreach ($this->linkedObjects['contrat'] as $idcontract => $contract) { + $substitutionarray['__CONTRACT_REF__'] = $contract->ref_customer; + $substitutionarray['__REFCLIENT__'] = $contract->ref_customer; // For backward compatibility + $substitutionarray['__REF_CLIENT__'] = $contract->ref_customer; + $foundcontract = $contract; + break; + } + } + + dol_syslog('__DIRECTDOWNLOAD_URL_INVOICE__=' . $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']); + + //erics - erreur de réécriture de l'url de téléchargement direct de la facture ... le lien de base est le bon + //on cherche donc d'ou vien le pb ... + //$urlforsellyoursaasaccount = getRootUrlForAccount($foundcontract); + // if ($urlforsellyoursaasaccount) { + // $tmpforurl = preg_replace('/.*document.php/', '', $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__']); + // if ($tmpforurl) { + // dol_syslog('__DIRECTDOWNLOAD_URL_INVOICE__ cas 1, urlforsellyoursaasaccount=' . $urlforsellyoursaasaccount); + // // $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $urlforsellyoursaasaccount . '/source/document.php' . $tmpforurl; + // } else { + // dol_syslog('__DIRECTDOWNLOAD_URL_INVOICE__ cas 2, urlforsellyoursaasaccount=' . $urlforsellyoursaasaccount); + // // $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $urlforsellyoursaasaccount; + // } + // } + + $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); + $texttosend = make_substitutions($msg, $substitutionarray, $outputlangs); + + // Attach a file ? + $file = ''; + $listofpaths = []; + $listofnames = []; + $listofmimes = []; + if (is_object($invoice)) { + $invoicediroutput = $conf->facture->dir_output; + //erics - choix du PDF a joindre aux mails + $fileparams = dol_most_recent_file($invoicediroutput . '/' . $this->ref, preg_quote($this->ref, '/') . '[^\-]+*.pdf'); + $file = $fileparams['fullname']; + //$file = $invoicediroutput . '/' . $this->ref . '/' . $this->ref . '.pdf'; + // $file = ''; // Disable attachment of invoice in emails + + if ($file) { + $listofpaths = [$file]; + $listofnames = [basename($file)]; + $listofmimes = [dol_mimetype($file)]; + } + } + $from = "";//$conf->global->SELLYOURSAAS_NOREPLY_EMAIL; + + $trackid = 'inv' . $this->id; + $moreinheader = 'X-Dolibarr-Info: doTakeStripePaymentForThirdParty' . "\r\n"; + + // Send email (substitutionarray must be done just before this) + include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subjecttosend, $this->thirdparty->email, $from, $texttosend, $listofpaths, $listofmimes, $listofnames, '', '', 0, -1, '', '', $trackid, $moreinheader); + if ($mailfile->sendfile()) { + $result = 1; + } else { + $this->error = $langs->trans("ErrorFailedToSendMail", $from, $this->thirdparty->email) . '. ' . $mailfile->error; + $result = -1; + } + + if ($result < 0) { + $errmsg = $this->error; + $postactionmessages[] = $errmsg; + $ispostactionok = -1; + } else { + if ($file) { + $postactionmessages[] = 'Email sent to thirdparty (to ' . $this->thirdparty->email . ' with invoice document attached: ' . $file . ', language = ' . $outputlangs->defaultlang . ')'; + } else { + $postactionmessages[] = 'Email sent to thirdparty (to ' . $this->thirdparty->email . ' without any attached document, language = ' . $outputlangs->defaultlang . ')'; + } + } + } + + if ($description) { + dol_syslog("* Record event for payment result - " . $description); + require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + + // Insert record of payment (success or error) + $actioncomm = new ActionComm($this->db); + + $actioncomm->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) + $actioncomm->code = 'AC_' . $actioncode; + $actioncomm->label = $description; + $actioncomm->note_private = join(",\n", $postactionmessages); + $actioncomm->fk_project = $this->fk_project; + $actioncomm->datep = $now; + $actioncomm->datef = $now; + $actioncomm->percentage = -1; // Not applicable + $actioncomm->socid = $thirdparty->id; + $actioncomm->contactid = 0; + $actioncomm->authorid = $user->id; // User saving action + $actioncomm->userownerid = $user->id; // Owner of action + // Fields when action is a real email (content is already into note) + /*$actioncomm->email_msgid = $object->email_msgid; + $actioncomm->email_from = $object->email_from; + $actioncomm->email_sender= $object->email_sender; + $actioncomm->email_to = $object->email_to; + $actioncomm->email_tocc = $object->email_tocc; + $actioncomm->email_tobcc = $object->email_tobcc; + $actioncomm->email_subject = $object->email_subject; + $actioncomm->errors_to = $object->errors_to;*/ + $actioncomm->fk_element = $this->id; + $actioncomm->elementtype = $this->element; + $actioncomm->extraparams = dol_trunc($extraparams, 250); + + $actioncomm->create($user); + } + + $this->description = $description; + $this->postactionmessages = $postactionmessages; + } catch (Exception $e) { + $error++; + $errorforinvoice++; + dol_syslog('Error ' . $e->getMessage(), LOG_ERR); + $this->errors[] = 'Error ' . $e->getMessage(); + } + } else { // If remain to pay is null + $error++; + $errorforinvoice++; + dol_syslog("Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?", LOG_WARNING); + $this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?"; + } + + //end copy + // print json_encode($stripecard); + // exit; + + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'prelevement_facture_demande('; + $sql .= 'fk_facture, '; + $sql .= ' amount, date_demande, fk_user_demande, ext_payment_id, ext_payment_site, sourcetype, entity)'; + $sql .= ' VALUES ('.$this->id; + $sql .= ",'".price2num($amount)."'"; + $sql .= ",'".$this->db->idate($now)."'"; + $sql .= ",".$fuser->id; + $sql .= ",'".$this->db->escape($stripe_id)."'"; + $sql .= ",'".$this->db->escape($stripe_uri)."'"; + $sql .= ",'".$this->db->escape($sourcetype)."'"; + $sql .= ",".$conf->entity; + $sql .= ")"; + + dol_syslog(get_class($this)."::demande_prelevement_stripe", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this).'::demande_prelevement_stripe Erreur'); + $error++; + } + } else { + $this->error = 'WithdrawRequestErrorNilAmount'; + dol_syslog(get_class($this).'::demande_prelevement_stripe WithdrawRequestErrorNilAmount'); + $error++; + } + + if (!$error) { + // Force payment mode of invoice to withdraw + $payment_mode_id = dol_getIdFromCode($this->db, ($type == 'bank-transfer' ? 'VIR' : 'PRE'), 'c_paiement', 'code', 'id', 1); + if ($payment_mode_id > 0) { + $result = $this->setPaymentMethods($payment_mode_id); + } + } + + if ($error) { + return -1; + } + return 1; + } else { + $this->error = "A request already exists"; + dol_syslog(get_class($this).'::demande_prelevement_stripe Impossible de creer une demande, demande deja en cours'); + return 0; + } + } else { + $this->error = $this->db->error(); + dol_syslog(get_class($this).'::demande_prelevement_stripe Erreur -2'); + return -2; + } + } else { + $this->error = "Status of invoice does not allow this"; + dol_syslog(get_class($this)."::demande_prelevement_stripe ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id"); + return -3; + } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Remove a direct debit request or a credit transfer request diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index b47199e8fe2..fba4f286b62 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -292,7 +292,8 @@ ErrorThirpdartyOrMemberidIsMandatory=Third party or Member of partnership is man ErrorFailedToWriteInTempDirectory=Failed to write in temp directory ErrorQuantityIsLimitedTo=Quantity is limited to %s ErrorFailedToLoadThirdParty=Failed to find/load thirdparty from id=%s, email=%s, name=%s - +ErrorThisPaymentModeIsNotSepa=This payment mode is not a bank account + # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 4ddbd1c613f..c3ecbe31ccd 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -47,6 +47,9 @@ class CompanyBankAccount extends Account public $rum; public $date_rum; + public $stripe_card_ref; // ID of BAN into an external payment system + public $stripe_account; // Account of the external payment system + /** * Date creation record (datec) * @@ -187,6 +190,8 @@ class CompanyBankAccount extends Account } else { $sql .= ",label = NULL"; } + $sql .= ",stripe_card_ref = '".$this->db->escape($this->stripe_card_ref)."'"; + $sql .= ",stripe_account = '".$this->db->escape($this->stripe_account)."'"; $sql .= " WHERE rowid = ".((int) $this->id); $result = $this->db->query($sql); @@ -232,7 +237,8 @@ class CompanyBankAccount extends Account } $sql = "SELECT rowid, type, fk_soc, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix as iban, domiciliation, proprio,"; - $sql .= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur, date_rum"; + $sql .= " owner_address, default_rib, label, datec, tms as datem, rum, frstrecur, date_rum,"; + $sql .= " stripe_card_ref, stripe_account"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_rib"; if ($id) { $sql .= " WHERE rowid = ".((int) $id); @@ -274,6 +280,8 @@ class CompanyBankAccount extends Account $this->rum = $obj->rum; $this->frstrecur = $obj->frstrecur; $this->date_rum = $this->db->jdate($obj->date_rum); + $this->stripe_card_ref = $obj->stripe_card_ref; + $this->stripe_account = $obj->stripe_account; } $this->db->free($resql); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index e7899db813e..7e3c916ec27 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -175,6 +175,12 @@ if (empty($reshook)) { $companybankaccount->rum = $prelevement->buildRumNumber($object->code_client, $companybankaccount->datec, $companybankaccount->id); } + if (GETPOST('stripe_card_ref', 'alpha') && GETPOST('stripe_card_ref', 'alpha') != $companypaymentmode->stripe_card_ref) { + // If we set a stripe value that is different than previous one, we also set the stripe account + $companypaymentmode->stripe_account = $stripecu.'@'.$site_account; + } + $companybankaccount->stripe_card_ref = GETPOST('stripe_card_ref', 'alpha'); + $result = $companybankaccount->update($user); if (!$result) { setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); @@ -416,6 +422,7 @@ if (empty($reshook)) { if ($action == 'confirm_deletecard' && GETPOST('confirm', 'alpha') == 'yes') { $companypaymentmode = new CompanyPaymentMode($db); if ($companypaymentmode->fetch($ribid ? $ribid : $id)) { + // TODO This is currently done at bottom of page instead of asking confirm /*if ($companypaymentmode->stripe_card_ref && preg_match('/pm_/', $companypaymentmode->stripe_card_ref)) { $payment_method = \Stripe\PaymentMethod::retrieve($companypaymentmode->stripe_card_ref); @@ -440,6 +447,16 @@ if (empty($reshook)) { if ($action == 'confirm_delete' && GETPOST('confirm', 'alpha') == 'yes') { $companybankaccount = new CompanyBankAccount($db); if ($companybankaccount->fetch($ribid ? $ribid : $id)) { + // TODO This is currently done at bottom of page instead of asking confirm + /*if ($companypaymentmode->stripe_card_ref && preg_match('/pm_/', $companypaymentmode->stripe_card_ref)) + { + $payment_method = \Stripe\PaymentMethod::retrieve($companypaymentmode->stripe_card_ref); + if ($payment_method) + { + $payment_method->detach(); + } + }*/ + $result = $companybankaccount->delete($user); if ($result > 0) { $url = $_SERVER['PHP_SELF']."?socid=".$object->id; @@ -505,7 +522,7 @@ if (empty($reshook)) { } if (!$error) { - // Creation of Stripe card + update of societe_account + // Creation of Stripe card + update of llx_societe_rib // Note that with the new Stripe API, option to create a card is no more available, instead an error message will be returned to // ask to create the crdit card from Stripe backoffice. $card = $stripe->cardStripe($cu, $companypaymentmode, $stripeacc, $servicestatus, 1); @@ -517,18 +534,13 @@ if (empty($reshook)) { } } if ($action == 'syncsepatostripe') { - $companybankaccount->fetch(GETPOST('bankid', 'int')); - // print "stripe account = " . json_encode($stripe->getStripeAccount($service)); - // print json_encode($companybankaccount); - // print "fetch id = " . json_encode($socid); - - $companypaymentmode = new CompanyPaymentMode($db); - $companypaymentmode->fetch(null, null, $socid); - // print json_encode($companypaymentmode); + $companypaymentmode = new CompanyPaymentMode($db); // Get record in llx_societe_rib + $companypaymentmode->fetch($id); if ($companypaymentmode->type != 'ban') { $error++; - setEventMessages('ThisPaymentModeIsNotSepa', null, 'errors'); + $langs->load("errors"); + setEventMessages('ThisPaymentModeIsNotABan', null, 'errors'); } else { // Get the Stripe customer $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); @@ -539,13 +551,13 @@ if (empty($reshook)) { } if (!$error) { - // Creation of Stripe SEPA + update of societe_account + // Creation of Stripe SEPA + update of llx_societe_rib $card = $stripe->sepaStripe($cu, $companypaymentmode, $stripeacc, $servicestatus, 1); if (!$card) { $error++; setEventMessages($stripe->error, $stripe->errors, 'errors'); } else { - setEventMessages("", array("SEPA on Stripe", "SEPA IBAN is now linked to the Stripe customer account !")); + setEventMessages("", array("Bank Account on Stripe", "BAN is now linked to the Stripe customer account !")); } } } @@ -711,6 +723,37 @@ if (empty($reshook)) { $error++; setEventMessages($e->getMessage(), null, 'errors'); } + } elseif ($action == 'delete' && $source) { + try { + if (preg_match('/pm_/', $source)) { + $payment_method = \Stripe\PaymentMethod::retrieve($source, array("stripe_account" => $stripeacc)); + if ($payment_method) { + $payment_method->detach(); + } + } else { + $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); + $card = $cu->sources->retrieve("$source"); + if ($card) { + // $card->detach(); Does not work with card_, only with src_ + if (method_exists($card, 'detach')) { + $card->detach(); + $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib as sr "; + $sql .= " SET stripe_card_ref = null"; + $sql .= " WHERE sr.stripe_card_ref = '".$db->escape($source)."'"; + $resql = $db->query($sql); + } else { + $card->delete(); + } + } + } + + $url = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; + header('Location: '.$url); + exit; + } catch (Exception $e) { + $error++; + setEventMessages($e->getMessage(), null, 'errors'); + } } } } @@ -938,70 +981,75 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '
'; - // List of Stripe payment modes - if (!(empty($conf->stripe->enabled)) && $object->client) { + $showcardpaymentmode = 0; + if (isModEnabled('stripe')) { + $showcardpaymentmode++; + } + + // Get list of remote payment modes + $listofsources = array(); + + if (is_object($stripe)) { + try { + $customerstripe = $stripe->customerStripe($object, $stripeacc, $servicestatus); + if (!empty($customerstripe->id)) { + // When using the Charge API architecture + if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { + $listofsources = $customerstripe->sources->data; + } else { + $service = 'StripeTest'; + $servicestatus = 0; + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { + $service = 'StripeLive'; + $servicestatus = 1; + } + + // Force to use the correct API key + global $stripearrayofkeysbyenv; + \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus]['secret_key']); + + try { + if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage + $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card")); + $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit")); + } else { + $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card"), array("stripe_account" => $stripeacc)); + $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit"), array("stripe_account" => $stripeacc)); + } + + if ($paymentmethodobjsA->data != null && $paymentmethodobjsB->data != null) { + $listofsources = array_merge((array) $paymentmethodobjsA->data, (array) $paymentmethodobjsB->data); + } elseif ($paymentmethodobjsB->data != null) { + $listofsources = $paymentmethodobjsB->data; + } else { + $listofsources = $paymentmethodobjsA->data; + } + } catch (Exception $e) { + $error++; + setEventMessages($e->getMessage(), null, 'errors'); + } + } + } + } catch (Exception $e) { + dol_syslog("Error when searching/loading Stripe customer for thirdparty id =".$object->id); + } + } + + + // List of Card payment modes + if ($showcardpaymentmode && $object->client) { $morehtmlright = ''; if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { $morehtmlright .= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=createcard'); } - print load_fiche_titre($langs->trans('StripePaymentModes').($stripeacc ? ' (Stripe connection with StripeConnect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, 'stripe-s'); + print load_fiche_titre($langs->trans('CreditCard').($stripeacc ? ' (Stripe connection with StripeConnect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, 'fa-credit-card'); - $listofsources = array(); - if (is_object($stripe)) { - try { - $customerstripe = $stripe->customerStripe($object, $stripeacc, $servicestatus); - if (!empty($customerstripe->id)) { - // When using the Charge API architecture - if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { - $listofsources = $customerstripe->sources->data; - } else { - $service = 'StripeTest'; - $servicestatus = 0; - if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { - $service = 'StripeLive'; - $servicestatus = 1; - } - - // Force to use the correct API key - global $stripearrayofkeysbyenv; - \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus]['secret_key']); - - try { - if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage - $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card")); - $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit")); - } else { - $paymentmethodobjsA = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "card"), array("stripe_account" => $stripeacc)); - $paymentmethodobjsB = \Stripe\PaymentMethod::all(array("customer" => $customerstripe->id, "type" => "sepa_debit"), array("stripe_account" => $stripeacc)); - } - - if ($paymentmethodobjsA->data != null && $paymentmethodobjsB->data != null) { - $listofsources = array_merge((array) $paymentmethodobjsA->data, (array) $paymentmethodobjsB->data); - } elseif ($paymentmethodobjsB->data != null) { - $listofsources = $paymentmethodobjsB->data; - } else { - $listofsources = $paymentmethodobjsA->data; - } - } catch (Exception $e) { - $error++; - setEventMessages($e->getMessage(), null, 'errors'); - } - } - } - } catch (Exception $e) { - dol_syslog("Error when searching/loading Stripe customer for thirdparty id =".$object->id); - } - } - - print ''."\n"; + print ''."\n"; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''."\n"; print ''; - if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { - print ''; - } print ''; - print ''; + print ''; // external system ID print ''; print ''; print ''; @@ -1018,7 +1066,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $nbremote = 0; $nblocal = 0; - $arrayofstripecard = array(); + $arrayofremotecard = array(); // Show local sources if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { @@ -1042,18 +1090,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if ($obj) { $companypaymentmodetemp->fetch($obj->rowid); - $arrayofstripecard[$companypaymentmodetemp->stripe_card_ref] = $companypaymentmodetemp->stripe_card_ref; + $arrayofremotecard[$companypaymentmodetemp->stripe_card_ref] = $companypaymentmodetemp->stripe_card_ref; - print ''; - print ''; + print ''; + // Label print ''; - print ''; + // Type print ''; + // Information (Owner, ...) print ''; - // Local ID - if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { - print ''; + $imgline = ''; + if ($src->object == 'card') { + $imgline = img_credit_card($src->brand); + } elseif ($src->object == 'source' && $src->type == 'card') { + $imgline = img_credit_card($src->card->brand); + } elseif ($src->object == 'payment_method' && $src->type == 'card') { + $imgline = img_credit_card($src->card->brand); + } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { + continue; + } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { + continue; } + + print ''; print ''; // Src ID - print ''; - // Img of credit card + // Img print ''; // Information print ''; + print ''; + // Fields from hook $parameters = array('arrayfields'=>array(), 'stripesource'=>$src, 'linetype'=>'stripecardremoteonly'); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // Action column print '
'.$langs->trans('LocalID').''.$langs->trans('Label').''.$langs->trans('StripeID').''.$langs->trans('StripeID').''.$langs->trans('Type').''.$langs->trans('Informations').'
'; - print $companypaymentmodetemp->id; - print '
'; print dol_escape_htmltag($companypaymentmodetemp->label); print ''; - print $companypaymentmodetemp->stripe_card_ref; - if ($companypaymentmodetemp->stripe_card_ref) { + // External card ID + print ''; + if (!empty($companypaymentmodetemp->stripe_card_ref)) { $connect = ''; if (!empty($stripeacc)) { $connect = $stripeacc.'/'; @@ -1062,12 +1108,15 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if ($servicestatus) { $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$companypaymentmodetemp->stripe_card_ref; } - print ' '.img_picto($langs->trans('ShowInStripe').' - Customer and Publishable key = '.$companypaymentmodetemp->stripe_account, 'globe').''; + print ''.img_picto($langs->trans('ShowInStripe').' - Customer and Publishable key = '.$companypaymentmodetemp->stripe_account, 'globe').' '; } + print $companypaymentmodetemp->stripe_card_ref; print ''; print img_credit_card($companypaymentmodetemp->type); print ''; if ($companypaymentmodetemp->proprio) { print ''.$companypaymentmodetemp->proprio.'
'; @@ -1121,7 +1170,6 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print img_picto($langs->trans("Modify"), 'edit'); print ''; - print ' '; print ''; // source='.$companypaymentmodetemp->stripe_card_ref.'& print img_picto($langs->trans("Delete"), 'delete'); print ''; @@ -1140,24 +1188,31 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // Show remote sources (not already shown as local source) if (is_array($listofsources) && count($listofsources)) { foreach ($listofsources as $src) { - if (!empty($arrayofstripecard[$src->id])) { + if (!empty($arrayofremotecard[$src->id])) { continue; // Already in previous list } $nbremote++; - print '
'; - print '
'; print ''; + print ''; $connect = ''; - print $src->id; if (!empty($stripeacc)) { $connect = $stripeacc.'/'; } @@ -1167,21 +1222,12 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' //$url='https://dashboard.stripe.com/'.$connect.'sources/'.$src->id; $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$src->id; } - print " ".img_picto($langs->trans('ShowInStripe'), 'globe').""; + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." "; + print $src->id; print ''; - if ($src->object == 'card') { - print img_credit_card($src->brand); - } elseif ($src->object == 'source' && $src->type == 'card') { - print img_credit_card($src->card->brand); - } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { - print ''; - } elseif ($src->object == 'payment_method' && $src->type == 'card') { - print img_credit_card($src->card->brand); - } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { - print ''; - } + print $imgline; print''; @@ -1256,18 +1302,20 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $langs->trans("Remote"); //if ($src->cvc_check == 'fail') print ' - CVC check fail'; print ''; //var_dump($src); - print ''; print ''; if ($permissiontoaddupdatepaymentinformation) { - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); print ''; } @@ -1286,7 +1334,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '
'; } - // List of Stripe payment modes + // List of Stripe connect accounts if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && !empty($stripesupplieracc)) { print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc ? ' (Stripe connection with StripeConnect account '.$stripesupplieracc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, 'stripe-s'); $balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc)); @@ -1337,16 +1385,20 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $morehtmlright = dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&action=create'); } - print load_fiche_titre($langs->trans("BankAccounts"), $morehtmlright, 'bank'); + $nblocal = 0; $nbremote = 0; + $arrayofremoteban = array(); + $rib_list = $object->get_all_rib(); + if (is_array($rib_list)) { print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; - print_liste_field_titre("LabelRIB"); + print_liste_field_titre("Label"); + print_liste_field_titre("StripeID"); // external system ID print_liste_field_titre("Bank"); print_liste_field_titre("RIB"); print_liste_field_titre("IBAN"); @@ -1356,17 +1408,43 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print_liste_field_titre("DateRUM"); print_liste_field_titre("WithdrawMode"); } - print_liste_field_titre("DefaultRIB", '', '', '', '', '', '', '', 'center '); + print_liste_field_titre("Default", '', '', '', '', '', '', '', 'center '); print_liste_field_titre('', '', '', '', '', '', '', '', 'center '); + // Fields from hook + $parameters = array('arrayfields'=>array(), 'linetype'=>'stripebantitle'); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', '', '', 'maxwidthsearch '); print "\n"; + // List of local BAN foreach ($rib_list as $rib) { + $arrayofremoteban[$rib->stripe_card_ref] = $rib->stripe_card_ref; + + $nblocal++; + print ''; // Label - print ''; + print ''; + // Stripe ID + print ''; // Bank name - print ''; + print ''; // Account number print ''; // IBAN - print ''; - print ''; + print ''; print ''; @@ -1500,12 +1578,19 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $out; print ''; + // Fields from hook + $parameters = array('arrayfields'=>array(), 'stripe_card_ref'=>$rib->stripe_card_ref, 'stripe_account'=>$rib->stripe_account, 'linetype'=>'stripeban'); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Edit/Delete print ''; } - if (count($rib_list) == 0) { - $colspan = 9; + + // List of remote BAN (if not already added as local) + foreach ($listofsources as $src) { + if (!empty($arrayofremoteban[$src->id])) { + continue; // Already in previous list + } + + $nbremote++; + + $imgline = ''; + if ($src->object == 'source' && $src->type == 'sepa_debit') { + $imgline = ''; + } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { + $imgline = ''; + } else { + continue; + } + + print ''; + print ''; + // Src ID + print ''; + // Bank + print ''; + // Account number + print ''; + // IBAN + print ''; + // BIC + print ''; + if (!empty($conf->prelevement->enabled)) { - $colspan += 2; + // RUM + print ''; + // Date + print ''; + // Mode mandate + print ''; + } + + // Default + print ''; + /* + print ''; + */ + + print ''; + + // Fields from hook + $parameters = array('arrayfields'=>array(), 'stripe_card_ref'=>$rib->stripe_card_ref, 'stripe_account'=>$rib->stripe_account, 'linetype'=>'stripebanremoteonly'); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Action column + print ''; + + print ''; + } + + if ($nbremote == 0 && $nblocal == 0) { + $colspan = 10; + if (!empty($conf->prelevement->enabled)) { + $colspan += 3; } print ''; } @@ -1603,10 +1792,12 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) { print '
'; + print '
'; + print '
'; print '
'.$rib->label.''.dol_escape_htmltag($rib->label).''; + if ($rib->stripe_card_ref) { + $connect = ''; + if (!empty($stripeacc)) { + $connect = $stripeacc.'/'; + } + //$url='https://dashboard.stripe.com/'.$connect.'test/sources/'.$src->id; + $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$rib->stripe_card_ref; + if ($servicestatus) { + //$url='https://dashboard.stripe.com/'.$connect.'sources/'.$src->id; + $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$rib->stripe_card_ref; + } + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." "; + } + print $rib->stripe_card_ref; + print ''.$rib->bank.''.dol_escape_htmltag($rib->bank).''; $string = ''; @@ -1398,7 +1476,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $string; print ''.$rib->iban; + print ''.dol_escape_htmltag($rib->iban); if (!empty($rib->iban)) { if (!checkIbanForAccount($rib)) { print ' '.img_picto($langs->trans("IbanNotValid"), 'warning'); @@ -1417,7 +1495,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if (!empty($conf->prelevement->enabled)) { // RUM //print ''.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).''.$rib->rum.''.dol_escape_htmltag($rib->rum).''.dol_print_date($rib->date_rum, 'day').''; if ($permissiontoaddupdatepaymentinformation) { - print ''; - print img_picto($langs->trans("CreateBAN"), 'stripe'); - print ''; + if (empty($rib->stripe_card_ref)) { + print ''; + print img_picto($langs->trans("CreateBAN"), 'stripe'); + print ''; + } print ''; print img_picto($langs->trans("Modify"), 'edit'); @@ -1520,10 +1605,114 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '
'; + print ''; + $connect = ''; + if (!empty($stripeacc)) { + $connect = $stripeacc.'/'; + } + //$url='https://dashboard.stripe.com/'.$connect.'test/sources/'.$src->id; + $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$src->id; + if ($servicestatus) { + //$url='https://dashboard.stripe.com/'.$connect.'sources/'.$src->id; + $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$src->id; + } + print "".img_picto($langs->trans('ShowInStripe'), 'globe')." "; + print $src->id; + print ''; + print''; + print ''; + //var_dump($src); + print ''; + //var_dump($src); + print ''; + //var_dump($src); + print ''; + //var_dump($src); + print ''; + //var_dump($src); + print ''; + if ((empty($customerstripe->invoice_settings) && $customerstripe->default_source != $src->id) || + (!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) { + print ''; + print img_picto($langs->trans("Default"), 'off'); + print ''; + } else { + print img_picto($langs->trans("Default"), 'on'); + } + print ''; + print $langs->trans("Remote"); + //if ($src->cvc_check == 'fail') print ' - CVC check fail'; + print ''; + print ''; + if ($permissiontoaddupdatepaymentinformation) { + print ''; + print img_picto($langs->trans("Delete"), 'delete'); + print ''; + } + print '
'.$langs->trans("NoBANRecord").'
'; - print ''; + print ''; print ''; print ''; @@ -1702,6 +1893,9 @@ if ($socid && $action == 'edit' && $permissiontoaddupdatepaymentinformation) { print $form->selectarray("frstrecur", $tblArraychoice, dol_escape_htmltag(GETPOST('frstrecur', 'alpha') ?GETPOST('frstrecur', 'alpha') : $companybankaccount->frstrecur), 0); print ''; + print '"; + print ''; + print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("Label").'
'.$langs->trans("BankName").'
'.$langs->trans("StripeID")." ('src_....')
'; print '
'; } @@ -1720,9 +1914,12 @@ if ($socid && $action == 'editcard' && $permissiontoaddupdatepaymentinformation) dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); - print '
'; + print '
'; print '
'; + + print '
'; + print ''; print ''; @@ -1766,9 +1963,12 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print '
'; print '
'; + + print '
'; + print '
'.$langs->trans("Label").'
'; - print ''; + print ''; print ''; print ''; @@ -1858,6 +2058,9 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) { print $form->selectarray("frstrecur", $tblArraychoice, (GETPOSTISSET('frstrecur') ? GETPOST('frstrecur') : 'FRST'), 0); print ''; + print '"; + print ''; + print '
'.$langs->trans("LabelRIB").'
'.$langs->trans("Label").'
'.$langs->trans("Bank").'
'.$langs->trans("StripeID")." ('src_....')
'; } @@ -1881,6 +2084,9 @@ if ($socid && $action == 'createcard' && $permissiontoaddupdatepaymentinformatio print '
'; print '
'; + + print '
'; + print ''; print ''; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index ea453b28412..cc8178d2a01 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -774,7 +774,7 @@ class Stripe extends CommonObject $sql .= " WHERE sa.rowid = ".((int) $object->id); // We get record from ID, no need for filter on entity $sql .= " AND sa.type = 'card'"; - dol_syslog(get_class($this)."::fetch search stripe card id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG); + dol_syslog(get_class($this)."::cardStripe search stripe card id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); @@ -914,14 +914,14 @@ class Stripe extends CommonObject $soc = new Societe($this->db); $soc->fetch($object->fk_soc); - dol_syslog(get_class($this)."::fetch search stripe sepa(card) id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG); + dol_syslog(get_class($this)."::sepaStripe search stripe ban id for paymentmode id=".$object->id.", stripeacc=".$stripeacc.", status=".$status.", createifnotlinkedtostripe=".$createifnotlinkedtostripe, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); if ($num) { $obj = $this->db->fetch_object($resql); $cardref = $obj->stripe_card_ref; - dol_syslog(get_class($this)."::cardStripe cardref=".$cardref); + dol_syslog(get_class($this)."::sepaStripe cardref=".$cardref); if ($cardref) { try { if (empty($stripeacc)) { // If the Stripe connect account not set, we use common API usage @@ -990,7 +990,7 @@ class Stripe extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."societe_rib"; $sql .= " SET stripe_card_ref = '".$this->db->escape($sepa->id)."', card_type = 'sepa_debit',"; $sql .= " stripe_account= '" . $this->db->escape($cu->id . "@" . $stripeacc) . "'"; - $sql .= " WHERE rowid = '".$this->db->escape($object->id)."'"; + $sql .= " WHERE rowid = ".((int) $object->id); $sql .= " AND type = 'ban'"; $resql = $this->db->query($sql); if (!$resql) { From 9ffc4ef44db341bda78b59c103e2a8cc0e163fa7 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 9 Sep 2022 08:53:38 +0200 Subject: [PATCH 357/453] Update exportcsv.php --- htdocs/opensurvey/exportcsv.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/opensurvey/exportcsv.php b/htdocs/opensurvey/exportcsv.php index 624fd620816..a7e8b709793 100644 --- a/htdocs/opensurvey/exportcsv.php +++ b/htdocs/opensurvey/exportcsv.php @@ -1,5 +1,4 @@ * Copyright (C) 2014 Marcos García * From 348682c3862d16db8835eaa2c7a79221597d8f2c Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 9 Sep 2022 09:43:50 +0200 Subject: [PATCH 358/453] Update pertype.php --- htdocs/comm/action/pertype.php | 71 +++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index d21b20bbfaf..abfcc5951cf 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -23,20 +23,22 @@ /** - * \file htdocs/comm/action/pertype.php - * \ingroup agenda - * \brief Tab of calendar events per type + * \file htdocs/comm/action/pertype.php + * \ingroup agenda + * \brief Tab of calendar events per type */ + +// Load Dolibarr environment require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; -require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; -require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; -require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) { @@ -51,28 +53,35 @@ $filter = GETPOST("search_filter", 'alpha', 3) ? GETPOST("search_filter", 'alpha $filtert = GETPOST("search_filtert", "int", 3) ? GETPOST("search_filtert", "int", 3) : GETPOST("filtert", "int", 3); $usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", "int", 3) : GETPOST("usergroup", "int", 3); //if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id; -//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; -$showbirthday = 0; + +// $showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1; +$showbirthday = 0; // will be hidden here // If not choice done on calendar owner, we filter on user. if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { $filtert = $user->id; } +// Sorting $sortfield = GETPOST('sortfield', 'aZ09comma'); +if (!$sortfield) { + $sortfield = "a.datec"; +} + $sortorder = GETPOST('sortorder', 'aZ09comma'); +if (!$sortorder) { + $sortorder = "ASC"; +} + +// Page $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $offset = $limit * $page; -if (!$sortorder) { - $sortorder = "ASC"; -} -if (!$sortfield) { - $sortfield = "a.datec"; -} + + // Security check $socid = GETPOST("search_socid", "int") ?GETPOST("search_socid", "int") : GETPOST("socid", "int"); @@ -83,6 +92,7 @@ if ($socid < 0) { $socid = ''; } +// Permissions $canedit = 1; if (empty($user->rights->agenda->myactions->read)) { accessforbidden(); @@ -105,6 +115,7 @@ $status = GETPOSTISSET("search_status") ? GETPOST("search_status", 'alpha') : GE $type = GETPOSTISSET("search_type") ? GETPOST("search_type", 'alpha') : GETPOST("type", 'alpha'); $maxprint = ((GETPOST("maxprint", 'int') != '') ? GETPOST("maxprint", 'int') : $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW); $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) if (GETPOST('search_actioncode', 'array')) { $actioncode = GETPOST('search_actioncode', 'array', 3); @@ -117,11 +128,12 @@ if (GETPOST('search_actioncode', 'array')) { $dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int')); if ($dateselect > 0) { - $day = GETPOST('dateselectday', 'int'); + $day = GETPOST('dateselectday', 'int'); $month = GETPOST('dateselectmonth', 'int'); - $year = GETPOST('dateselectyear', 'int'); + $year = GETPOST('dateselectyear', 'int'); } +// working hours $tmp = empty($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); @@ -137,6 +149,7 @@ if ($end_h <= $begin_h) { $end_h = $begin_h + 1; } +// working days $tmp = empty($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); @@ -150,19 +163,24 @@ if (empty($mode) && !GETPOSTISSET('mode')) { $mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); } +// View by month if (GETPOST('viewcal', 'alpha') && $mode != 'show_day' && $mode != 'show_week' && $mode != 'show_peruser') { $mode = 'show_month'; $day = ''; -} // View by month +} +// View by week if (GETPOST('viewweek', 'alpha') || $mode == 'show_week') { $mode = 'show_week'; $week = ($week ? $week : date("W")); $day = ($day ? $day : date("d")); -} // View by week +} +// View by day if (GETPOST('viewday', 'alpha') || $mode == 'show_day') { $mode = 'show_day'; $day = ($day ? $day : date("d")); -} // View by day +} +// View by year if (GETPOST('viewyear', 'alpha') || $mode == 'show_year') { $mode = 'show_year'; -} // View by year +} +// Initialize object $object = new ActionComm($db); // Load translation files required by the page @@ -218,6 +236,7 @@ $parameters = array( 'resourceid' => $resourceid, 'usergroup' => $usergroup, ); + $reshook = $hookmanager->executeHooks('beforeAgendaPerType', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); @@ -226,14 +245,14 @@ if ($reshook < 0) { $form = new Form($db); $companystatic = new Societe($db); -$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda'; +$help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:Módulo_Agenda|DE:Modul_Terminplanung'; llxHeader('', $langs->trans("Agenda"), $help_url); $now = dol_now(); $nowarray = dol_getdate($now); -$nowyear = $nowarray['year']; +$nowyear = $nowarray['year']; $nowmonth = $nowarray['mon']; -$nowday = $nowarray['mday']; +$nowday = $nowarray['mday']; // Define list of all external calendars (global setup) @@ -246,7 +265,7 @@ $first_year = $year; $week = $prev['week']; -$day = (int) $day; +$day = (int) $day; $next = dol_get_next_day($day, $month, $year); $next_year = $year + 1; $next_month = $month; From 68b72ac17d542473a34b9c031259f8abe779d3d6 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 9 Sep 2022 10:06:16 +0200 Subject: [PATCH 359/453] Fix : php 8.1 warnings --- htdocs/compta/bank/annuel.php | 3 +++ htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/treso.php | 2 +- htdocs/compta/paiement/cheque/list.php | 2 ++ htdocs/compta/prelevement/create.php | 3 ++- htdocs/compta/prelevement/orders_list.php | 2 ++ htdocs/hrm/skill_card.php | 13 +++++++------ htdocs/stripe/payout.php | 8 ++++++-- htdocs/stripe/transaction.php | 13 ++++++++----- htdocs/user/bank.php | 6 +++--- 10 files changed, 35 insertions(+), 19 deletions(-) diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 41d58cb35c2..dda1e4f0758 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -192,6 +192,9 @@ for ($mois = 1; $mois < 13; $mois++) { print ''; print ""; for ($annee = $year_start; $annee <= $year_end; $annee++) { + $totsorties[$annee] = 0; + $totentrees[$annee] = 0; + $case = sprintf("%04s-%02s", $annee, $mois); print '"; print ""; - if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) { + if (getDolGlobalString("MULTICOMPANY_INVOICE_SHARING_ENABLED")) { if ($tmpobj->family == 'invoice') { $mc->getInfo($tmpobj->entity); print ""; diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 1c3abfe87bd..c8b828ebdd5 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -63,6 +63,8 @@ if (!$sortfield) { $year = GETPOST("year"); $month = GETPOST("month"); +$optioncss = GETPOST('optioncss', 'alpha'); +$view = GETPOST("view", 'alpha'); $form = new Form($db); $formother = new FormOther($db); diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 832429fe012..21b65d57517 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -61,6 +61,7 @@ $offset = $limit * $page; $hookmanager->initHooks(array('directdebitcreatecard', 'globalcard')); // Security check +$socid = GETPOST('socid', 'int'); if ($user->socid) { $socid = $user->socid; } @@ -71,7 +72,7 @@ if ($type == 'bank-transfer') { } $error = 0; - +$option = ""; /* * Actions diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index ee370b9532e..cc1e823c792 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -52,6 +52,8 @@ if (!$sortfield) { $sortfield = "p.datec"; } +$optioncss = GETPOST('optioncss', 'alpha'); + // Get supervariables $statut = GETPOST('statut', 'int'); $search_ref = GETPOST('search_ref', 'alpha'); diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 9093766d3ed..4fd3a0bc28b 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -47,7 +47,7 @@ $cancel = GETPOST('cancel', 'aZ09'); $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'skillcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); -//$lineid = GETPOST('lineid', 'int'); +$lineid = GETPOST('lineid', 'int'); // Initialize technical objects $object = new Skill($db); @@ -577,7 +577,7 @@ if ($action != "create" && $action != "edit") { $title = $langs->transnoentitiesnoconv("Skilldets"); $morejs = array(); $morecss = array(); - + $nbtotalofrecords = 0; // Build and execute select // -------------------------------------------------------------------- @@ -626,8 +626,10 @@ if ($action != "create" && $action != "edit") { print ''; } - $param_fk = "&fk_skill=" . $id . "&fk_user_creat=" . $user->rowid; + $param_fk = "&fk_skill=" . $id . "&fk_user_creat=" . (!empty($user->rowid) ? $user->rowid :0); $backtopage = dol_buildpath('/hrm/skill_card.php', 1) . '?id=' . $id; + $param = ""; + $massactionbutton = ""; //$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/hrm/skilldet_card.php', 1) . '?action=create&backtopage=' . urlencode($_SERVER['PHP_SELF']) . $param_fk . '&backtopage=' . $backtopage, '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_' . $object->picto, 0, "", '', '', 0, 0, 1); @@ -688,7 +690,7 @@ if ($action != "create" && $action != "edit") { // $cssforfield .= ($cssforfield ? ' ' : '') . 'right'; // } if (!empty($arrayfields['t.' . $key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, ($cssforfield ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield . ' ' : '')) . "\n"; + print getTitleFieldOfList($arrayfields['t.' . $key]['label'], 0, $_SERVER['PHP_SELF'], 't.' . $key, '', $param, (!empty($cssforfield) ? 'class="' . $cssforfield . '"' : ''), $sortfield, $sortorder, (!empty($cssforfield) ? $cssforfield . ' ' : '')) . "\n"; } } print ''; @@ -814,8 +816,7 @@ if ($action != "create" && $action != "edit") { print ''; } - - $db->free($resql); + if (!empty($resql)) $db->free($resql); $parameters = array('arrayfields' => $arrayfields, 'sql' => $sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectline); // Note that $action and $objectline may have been modified by hook diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index a33c183a1e7..f78734b107f 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -51,6 +51,10 @@ if (empty($page) || $page == -1) { $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; +$optioncss = GETPOST('optioncss', 'alpha'); +$param = ""; +$num = 0; +$totalnboflines = 0; $result = restrictedArea($user, 'banque'); @@ -95,12 +99,12 @@ if (!$rowid) { print ''; $title = $langs->trans("StripePayoutList"); - $title .= ($stripeaccount ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)'); + $title .= ($stripeacc ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); print '
'; - print '
'.$langs->trans("Label").'
".dol_print_date(dol_mktime(1, 1, 1, $mois, 1, 2000), "%B")." '; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index d9689202297..d89484174b7 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1277,7 +1277,7 @@ if ($resql) { } // Extra fields $element = 'banktransaction'; - if (is_array($extrafields->attributes[$element]['label']) && count($extrafields->attributes[$element]['label'])) { + if (!empty($extrafields->attributes[$element]['label']) && is_array($extrafields->attributes[$element]['label']) && count($extrafields->attributes[$element]['label'])) { foreach ($extrafields->attributes[$element]['label'] as $key => $val) { if (!empty($arrayfields["ef.".$key]['checked'])) { if (!empty($arrayfields[$key]['checked'])) { diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 0d76b40a3e2..abbc4a62a46 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -293,7 +293,7 @@ if (GETPOST("account") || GETPOST("ref")) { } print "".$ref."".$mc->label."
' . $langs->trans("NoRecordFound") . '
'."\n"; + print '
'."\n"; print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index f04833ff107..509edc07509 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -52,7 +52,9 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; $optioncss = GETPOST('optioncss', 'alpha'); - +$param = ""; +$num = 0; +$totalnboflines = 0; $result = restrictedArea($user, 'banque'); @@ -95,12 +97,12 @@ if (!$rowid) { print ''; $title = $langs->trans("StripeTransactionList"); - $title .= ($stripeaccount ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)'); + $title .= (!empty($stripeacc) ? ' (Stripe connection with Stripe OAuth Connect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $totalnboflines, 'title_accountancy.png', 0, '', '', $limit); print '
'; - print '
'."\n"; + print '
'."\n"; print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); @@ -113,6 +115,7 @@ if (!$rowid) { print_liste_field_titre("Fee", $_SERVER["PHP_SELF"], "", "", "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", '', '', '', 'right '); print "\n"; + $connect = ""; try { if ($stripeacc) { @@ -146,7 +149,7 @@ if (!$rowid) { else { $memberstatic->id = 0; - }*/ + } $societestatic->fetch($charge->metadata->idcustomer); $societestatic->id = $charge->metadata->idcustomer; @@ -155,7 +158,7 @@ if (!$rowid) { $societestatic->admin = $obj->admin; $societestatic->login = $obj->login; $societestatic->email = $obj->email; - $societestatic->societe_id = $obj->fk_soc; + $societestatic->societe_id = $obj->fk_soc;*/ print ''; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 4f3ee5c32c8..69f83259f31 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -646,9 +646,9 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac $salary->paye = $objp->paye; $salary->amount = $objp->amount; - $payment_salary->id = $objp->rowid; - $payment_salary->ref = $objp->ref; - $payment_salary->datep = $db->jdate($objp->datep); + $payment_salary->id = !empty($objp->rowid) ? $objp->rowid : 0; + $payment_salary->ref = !empty($objp->ref) ? $objp->ref : ""; + $payment_salary->datep = $db->jdate(!empty($objp->datep) ? $objp->datep : ""); print ''; print '
'; From e53457732051ad84e751208d5afa2be1b605185a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 9 Sep 2022 10:12:30 +0200 Subject: [PATCH 360/453] fix : Typo --- htdocs/core/actions_linkedfiles.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 86d4e923131..f11058312d1 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -41,8 +41,8 @@ if ((GETPOST('sendit', 'alpha') || ($action == 'confirm_deletefile' && $confirm == 'yes') || ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('link', 'alpha')) || ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha'))) && empty($permissiontoadd)) { - dol_syslog('The file actions_linkedfiles.inc.php was included but paramater $permissiontoadd as not set before.'); - print 'The file actions_linkedfiles.inc.php was included but paramater $permissiontoadd as not set before.'; + dol_syslog('The file actions_linkedfiles.inc.php was included but parameter $permissiontoadd was not set before.'); + print 'The file actions_linkedfiles.inc.php was included but parameter $permissiontoadd was not set before.'; die; } From ab9652db5f960d177089c51e38a0633c5c179d75 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 9 Sep 2022 10:23:07 +0200 Subject: [PATCH 361/453] update code toward php8 compliance --- htdocs/adherents/card.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 6816023f8de..b9e04015d7d 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -110,10 +110,10 @@ if ($id > 0 || !empty($ref)) { } // Define variables to determine what the current user can do on the members -$canaddmember = $user->rights->adherent->creer; +$canaddmember = $user->hasRight('adherent', 'creer'); // Define variables to determine what the current user can do on the properties of a member if ($id) { - $caneditfieldmember = $user->rights->adherent->creer; + $caneditfieldmember = $user->hasRight('adherent', 'creer'); } // Security check @@ -246,7 +246,7 @@ if (empty($reshook)) { } } - if ($action == 'update' && !$cancel && $user->rights->adherent->creer) { + if ($action == 'update' && !$cancel && $user->hasRight('adherent', 'creer')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $birthdate = ''; @@ -421,7 +421,7 @@ if (empty($reshook)) { } } - if ($action == 'add' && $user->rights->adherent->creer) { + if ($action == 'add' && $user->hasRight('adherent', 'creer')) { if ($canvas) { $object->canvas = $canvas; } @@ -629,7 +629,7 @@ if (empty($reshook)) { } } - if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') { + if ($user->hasRight('adherent', 'creer') && $action == 'confirm_valid' && $confirm == 'yes') { $error = 0; $db->begin(); @@ -854,7 +854,7 @@ if (empty($reshook)) { } } - if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') { + if ($user->hasRight('adherent', 'creer') && $action == 'confirm_add_spip' && $confirm == 'yes') { if (!count($object->errors)) { if (!$mailmanspip->add_to_spip($object)) { setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors'); @@ -867,7 +867,7 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->adherent->dir_output; - $permissiontoadd = $user->rights->adherent->creer; + $permissiontoadd = $user->hasRight('adherent', 'creer'); include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Actions to send emails @@ -1222,7 +1222,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Type print '
'.$langs->trans("Type").''; - if ($user->rights->adherent->creer) { + if ($user->hasRight('adherent', 'creer')) { print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid", 'int') : $object->typeid), 0, 0, 0, '', 0, 0, 0, '', '', 1); } else { print $adht->getNomUrl(1); @@ -1820,7 +1820,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Third party Dolibarr if (isModEnabled('societe')) { print '
'; - $editenable = $user->rights->adherent->creer; + $editenable = $user->hasRight('adherent', 'creer'); print $form->editfieldkey('LinkedToDolibarrThirdParty', 'thirdparty', '', $object, $editenable); print ''; if ($action == 'editthirdparty') { @@ -1857,7 +1857,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Login Dolibarr - Link to user print '
'; - $editenable = $user->rights->adherent->creer && $user->rights->user->user->creer; + $editenable = $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer; print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable); print ''; if ($action == 'editlogin') { @@ -1901,7 +1901,7 @@ 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 ($user->hasRight('adherent', 'creer')) { if (Adherent::STATUS_VALIDATED == $object->statut) { if ($object->email) print ''.$langs->trans("SendCardByMail")."\n"; else print ''.$langs->trans("SendCardByMail")."\n"; @@ -1913,7 +1913,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { }*/ // Modify - if (!empty($user->rights->adherent->creer)) { + if ($user->hasRight('adherent', 'creer')) { print ''.$langs->trans("Modify").''."\n"; } else { print ''.$langs->trans("Modify").''."\n"; @@ -1921,7 +1921,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Validate if (Adherent::STATUS_DRAFT == $object->statut) { - if ($user->rights->adherent->creer) { + if ($user->hasRight('adherent', 'creer')) { print ''.$langs->trans("Validate").''."\n"; } else { print ''.$langs->trans("Validate").''."\n"; @@ -1930,7 +1930,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Reactivate if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $object->statut) { - if ($user->rights->adherent->creer) { + if ($user->hasRight('adherent', 'creer')) { print ''.$langs->trans("Reenable")."\n"; } else { print ''.$langs->trans("Reenable").''."\n"; @@ -2022,7 +2022,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member'); $urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id; $genallowed = $user->rights->adherent->lire; - $delallowed = $user->rights->adherent->creer; + $delallowed = $user->hasRight('adherent', 'creer'); print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object); $somethingshown = $formfile->numoffiles; From 1bacb20a872cb1a16bf3b5f991dcea734cb9e824 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 9 Sep 2022 10:24:38 +0200 Subject: [PATCH 362/453] update code toward php8 compliance --- htdocs/adherents/document.php | 8 ++++---- htdocs/adherents/ldap.php | 4 ++-- htdocs/adherents/list.php | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index c8282179fe5..2170fe0ab62 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -87,10 +87,10 @@ if ($id > 0 || !empty($ref)) { } // Define variables to determine what the current user can do on the members -$canaddmember = $user->rights->adherent->creer; +$canaddmember = $user->hasRight('adherent', 'creer'); // Define variables to determine what the current user can do on the properties of a member if ($id) { - $caneditfieldmember = $user->rights->adherent->creer; + $caneditfieldmember = $user->hasRight('adherent', 'creer'); } $permissiontoadd = $canaddmember; @@ -186,8 +186,8 @@ if ($id > 0) { print dol_get_fiche_end(); $modulepart = 'member'; - $permissiontoadd = $user->rights->adherent->creer; - $permtoedit = $user->rights->adherent->creer; + $permissiontoadd = $user->hasRight('adherent', 'creer'); + $permtoedit = $user->hasRight('adherent', 'creer'); $param = '&id='.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; print "

"; diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index db87e514cb5..6a25b57b532 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -62,10 +62,10 @@ if ($id > 0 || !empty($ref)) { } // Define variables to determine what the current user can do on the members -$canaddmember = $user->rights->adherent->creer; +$canaddmember = $user->hasRight('adherent', 'creer'); // Define variables to determine what the current user can do on the properties of a member if ($id) { - $caneditfieldmember = $user->rights->adherent->creer; + $caneditfieldmember = $user->hasRight('adherent', 'creer'); } // Security check diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 98d75c9fefb..b0e63098322 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -232,7 +232,7 @@ if (empty($reshook)) { } // Close - if ($massaction == 'close' && $user->rights->adherent->creer) { + if ($massaction == 'close' && $user->hasRight('adherent', 'creer')) { $tmpmember = new Adherent($db); $error = 0; $nbclose = 0; @@ -262,7 +262,7 @@ if (empty($reshook)) { } // Create external user - if ($massaction == 'createexternaluser' && $user->rights->adherent->creer && $user->rights->user->user->creer) { + if ($massaction == 'createexternaluser' && $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) { $tmpmember = new Adherent($db); $error = 0; $nbcreated = 0; @@ -302,7 +302,7 @@ if (empty($reshook)) { $objectlabel = 'Members'; $permissiontoread = $user->rights->adherent->lire; $permissiontodelete = $user->rights->adherent->supprimer; - $permissiontoadd = $user->rights->adherent->creer; + $permissiontoadd = $user->hasRight('adherent', 'creer'); $uploaddir = $conf->adherent->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -617,7 +617,7 @@ $arrayofmassactions = array( //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); -if ($user->rights->adherent->creer) { +if ($user->hasRight('adherent', 'creer')) { $arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Resiliate"); } if ($user->rights->adherent->supprimer) { @@ -626,7 +626,7 @@ if ($user->rights->adherent->supprimer) { if ($user->rights->societe->creer) { $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag"); } -if ($user->rights->adherent->creer && $user->rights->user->user->creer) { +if ($user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) { $arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) { @@ -635,7 +635,7 @@ if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'pr $massactionbutton = $form->selectMassAction('', $arrayofmassactions); $newcardbutton = ''; -if ($user->rights->adherent->creer) { +if ($user->hasRight('adherent', 'creer')) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMember'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create'); } From b411ec8b596c0a9bd6ee7deaa006904f23f4963f Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 9 Sep 2022 10:26:01 +0200 Subject: [PATCH 363/453] update code toward php8 compliance --- htdocs/adherents/note.php | 8 ++++---- htdocs/adherents/subscription.php | 8 ++++---- htdocs/adherents/type.php | 2 +- htdocs/adherents/vcard.php | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index 7e445e41a37..ea5e22fe153 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -51,7 +51,7 @@ if ($result > 0) { } -$permissionnote = $user->rights->adherent->creer; // Used by the include of actions_setnotes.inc.php +$permissionnote = $user->hasRight('adherent', 'creer'); // Used by the include of actions_setnotes.inc.php // Fetch object if ($id > 0 || !empty($ref)) { @@ -71,10 +71,10 @@ if ($id > 0 || !empty($ref)) { } // Define variables to determine what the current user can do on the members -$canaddmember = $user->rights->adherent->creer; +$canaddmember = $user->hasRight('adherent', 'creer'); // Define variables to determine what the current user can do on the properties of a member if ($id) { - $caneditfieldmember = $user->rights->adherent->creer; + $caneditfieldmember = $user->hasRight('adherent', 'creer'); } $hookmanager->initHooks(array('membernote')); @@ -155,7 +155,7 @@ if ($id) { $cssclass = 'titlefield'; - $permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php + $permission = $user->hasRight('adherent', 'creer'); // Used by the include of notes.tpl.php include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 67c2ffef1d0..8700c3669ea 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -112,10 +112,10 @@ if ($id > 0 || !empty($ref)) { } // Define variables to determine what the current user can do on the members -$canaddmember = $user->rights->adherent->creer; +$canaddmember = $user->hasRight('adherent', 'creer'); // Define variables to determine what the current user can do on the properties of a member if ($id) { - $caneditfieldmember = $user->rights->adherent->creer; + $caneditfieldmember = $user->hasRight('adherent', 'creer'); } // Security check @@ -594,7 +594,7 @@ if ($rowid > 0) { print ''; - if ($action != 'editthirdparty' && $user->rights->adherent->creer) { + if ($action != 'editthirdparty' && $user->hasRight('adherent', 'creer')) { print ''; } print '
'; print $langs->trans("LinkedToDolibarrThirdParty"); print 'id.'">'.img_edit($langs->trans('SetLinkToThirdParty'), 1).'
'; @@ -636,7 +636,7 @@ if ($rowid > 0) { print ''; - if ($action != 'editlogin' && $user->rights->adherent->creer) { + if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) { print '
'; print $langs->trans("LinkedToDolibarrUser"); print ''; if ($user->rights->user->user->creer) { print 'id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).''; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index b6463e006a9..df74a1e33b7 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -753,7 +753,7 @@ if ($rowid > 0) { // Actions print ''; - if ($user->rights->adherent->creer) { + if ($user->hasRight('adherent', 'creer')) { print ''.img_edit().''; } if ($user->rights->adherent->supprimer) { diff --git a/htdocs/adherents/vcard.php b/htdocs/adherents/vcard.php index 902206c7874..235488b1290 100644 --- a/htdocs/adherents/vcard.php +++ b/htdocs/adherents/vcard.php @@ -53,10 +53,10 @@ if ($id > 0 || !empty($ref)) { } // Define variables to determine what the current user can do on the members -$canaddmember = $user->rights->adherent->creer; +$canaddmember = $user->hasRight('adherent', 'creer'); // Define variables to determine what the current user can do on the properties of a member if ($id) { - $caneditfieldmember = $user->rights->adherent->creer; + $caneditfieldmember = $user->hasRight('adherent', 'creer'); } // Security check From 9027e2b96b9b7ae6054330cd9ce6d3878b9f7d14 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 9 Sep 2022 10:28:00 +0200 Subject: [PATCH 364/453] update code toward php8 compliance --- .../adherents/canvas/default/tpl/adherentcard_view.tpl.php | 4 ++-- htdocs/adherents/class/api_members.class.php | 6 +++--- htdocs/adherents/class/api_subscriptions.class.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php index 696520f79d4..4b0eed154c0 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2012 Philippe Grand + * Copyright (C) 2012-2022 Philippe Grand * * 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 @@ -124,7 +124,7 @@ if (!empty($this->control->tpl['action_delete'])) { if (empty($user->socid)) { echo '
'; - if ($user->rights->adherent->creer) { + if ($user->hasRight('adherent', 'creer')) { echo ''.$langs->trans('Modify').''; } diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index d30e851b9a2..35ab65e9d82 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Xebax Christy * Copyright (C) 2017 Regis Houssin * Copyright (C) 2020 Thibault FOUCART - * Copyright (C) 2020 Frédéric France + * Copyright (C) 2020 Frédéric France * * 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 @@ -286,7 +286,7 @@ class Members extends DolibarrApi */ public function post($request_data = null) { - if (!DolibarrApiAccess::$user->rights->adherent->creer) { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) { throw new RestException(401); } // Check mandatory fields @@ -311,7 +311,7 @@ class Members extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->adherent->creer) { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) { throw new RestException(401); } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index f969017146b..0512ea46b20 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -173,7 +173,7 @@ class Subscriptions extends DolibarrApi */ public function put($id, $request_data = null) { - if (!DolibarrApiAccess::$user->rights->adherent->creer) { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) { throw new RestException(401); } From b3d0be6b6b7c8bf97bbd403484b202625afc96c6 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 9 Sep 2022 10:29:27 +0200 Subject: [PATCH 365/453] update code toward php8 compliance --- htdocs/categories/class/api_categories.class.php | 8 ++++---- htdocs/categories/viewcat.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index d5345106093..76381c0d53d 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -386,7 +386,7 @@ class Categories extends DolibarrApi } $object = new Contact($this->db); } elseif ($type === Categorie::TYPE_MEMBER) { - if (!DolibarrApiAccess::$user->rights->adherent->creer) { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) { throw new RestException(401); } $object = new Adherent($this->db); @@ -466,7 +466,7 @@ class Categories extends DolibarrApi } $object = new Contact($this->db); } elseif ($type === Categorie::TYPE_MEMBER) { - if (!DolibarrApiAccess::$user->rights->adherent->creer) { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) { throw new RestException(401); } $object = new Adherent($this->db); @@ -546,7 +546,7 @@ class Categories extends DolibarrApi } $object = new Contact($this->db); } elseif ($type === Categorie::TYPE_MEMBER) { - if (!DolibarrApiAccess::$user->rights->adherent->creer) { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) { throw new RestException(401); } $object = new Adherent($this->db); @@ -624,7 +624,7 @@ class Categories extends DolibarrApi } $object = new Contact($this->db); } elseif ($type === Categorie::TYPE_MEMBER) { - if (!DolibarrApiAccess::$user->rights->adherent->creer) { + if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) { throw new RestException(401); } $object = new Adherent($this->db); diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 0e5da0735ce..6ed4622ac00 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -117,7 +117,7 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'customer'; - } elseif ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) { + } elseif ($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $tmpobject = new Adherent($db); $result = $tmpobject->fetch($removeelem); @@ -733,7 +733,7 @@ if ($type == Categorie::TYPE_MEMBER) { if ($user->hasRight("adherent", "read")) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; - $permission = $user->rights->adherent->creer; + $permission = $user->hasRight('adherent', 'creer'); $prods = $object->getObjectsInCateg($type, 0, $limit, $offset); if ($prods < 0) { @@ -768,7 +768,7 @@ if ($type == Categorie::TYPE_MEMBER) { print '
'; $param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = ''; - $newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->adherent->creer); + $newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->hasRight('adherent', 'creer')); print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); print "\n"; From f1a68d9272448f60d4f0417dd342a3b3d3c722d7 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 9 Sep 2022 10:36:08 +0200 Subject: [PATCH 366/453] Update modZapier.class.php IMHO in this case is *require_once* instead of *include_one* more correct --- htdocs/core/modules/modZapier.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modZapier.class.php b/htdocs/core/modules/modZapier.class.php index c92de9d5909..b0a1daf642e 100644 --- a/htdocs/core/modules/modZapier.class.php +++ b/htdocs/core/modules/modZapier.class.php @@ -13,8 +13,9 @@ * 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 . + * along with this program. If not, see . */ + /** * \defgroup zapier Module Zapier * \brief Zapier module descriptor. @@ -23,7 +24,8 @@ * \ingroup zapier * \brief Description and activation file for the module Zapier */ -include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; + +require_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** * Description and activation class for module Zapier From 86d777009e4aa54466996a8cd45ff985bc80c032 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 9 Sep 2022 11:09:53 +0200 Subject: [PATCH 367/453] fix : scrutinaizer report --- htdocs/core/class/html.formticket.class.php | 1 + htdocs/projet/class/projectstats.class.php | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 1a48da2f752..7c5007ddca2 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -77,6 +77,7 @@ class FormTicket public $withtitletopic; public $withtopicreadonly; + public $withreadid; public $withcompany; // affiche liste déroulante company public $withfromsocid; public $withfromcontactid; diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index f1295c10424..322277187f7 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -32,6 +32,11 @@ class ProjectStats extends Stats public $status; public $opp_status; + //SQL stat + public $field; + public $from; + public $where; + /** * Constructor @@ -46,6 +51,18 @@ class ProjectStats extends Stats require_once 'project.class.php'; $this->project = new Project($this->db); + + $this->from = MAIN_DB_PREFIX.$this->project->table_element; + $this->field = 'opp_amount'; + $this->where = " entity = ".$conf->entity; + if ($this->socid > 0) { + $this->where .= " AND fk_soc = ".((int) $this->socid); + } + if (is_array($this->userid) && count($this->userid) > 0) { + $this->where .= ' AND fk_user IN ('.$this->db->sanitize(join(',', $this->userid)).')'; + } elseif ($this->userid > 0) { + $this->where .= " AND fk_user = ".((int) $this->userid); + } } @@ -538,7 +555,6 @@ class ProjectStats extends Stats { $sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")"; $sql .= " FROM ".$this->from; - $sql .= $this->join; $sql .= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'"; $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; From 999e5861e3343f27391de9116b5228b00631147e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 11:55:45 +0200 Subject: [PATCH 368/453] NEW Add method httponly_accessforbidden() --- htdocs/core/ajax/onlineSign.php | 4 +--- htdocs/core/lib/security.lib.php | 29 +++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index c342f7aeab1..f3a82783a2b 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -74,9 +74,7 @@ if ($type == 'proposal') { } if (empty($SECUREKEY) || !dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { - http_response_code(403); - print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); - exit(-1); + httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403); } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index d0067d7575b..1efcbaacf78 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -1016,8 +1016,30 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl return true; } + /** - * Show a message to say access is forbidden and stop program + * Show a message to say access is forbidden and stop program. + * This includes only HTTP header. + * Calling this function terminate execution of PHP. + * + * @param string $message Force error message + * @param int $http_response_code HTTP response code + * @return void + * @see accessforbidden() + */ +function httponly_accessforbidden($message = 1, $http_response_code = 403) +{ + top_httphead('text/html'); + http_response_code($http_response_code); + + print htmlentities($message); + + exit(1); +} + +/** + * Show a message to say access is forbidden and stop program. + * This includes HTTP and HTML header and footer. * Calling this function terminate execution of PHP. * * @param string $message Force error message @@ -1026,10 +1048,12 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl * @param int $showonlymessage Show only message parameter. Otherwise add more information. * @param array|null $params More parameters provided to hook * @return void + * @see httponly_accessforbidden() */ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $showonlymessage = 0, $params = null) { global $conf, $db, $user, $langs, $hookmanager; + if (!is_object($langs)) { include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; $langs = new Translate('', $conf); @@ -1049,7 +1073,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho if (!$message) { print $langs->trans("ErrorForbidden"); } else { - print $message; + print $langs->trans($message); } print ''; print '
'; @@ -1077,6 +1101,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho if ($printfooter && function_exists("llxFooter")) { llxFooter(); } + exit(0); } From f4973068555cb6b0df45eb0d2230b946ac72d97a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 9 Sep 2022 11:57:59 +0200 Subject: [PATCH 369/453] NEW : Supplier order list - Add column private and public note --- htdocs/fourn/commande/list.php | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index c6401b0a70a..f1f65ed3fa8 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -188,7 +188,9 @@ $arrayfields = array( 'state.nom'=>array('label'=>"StateShort", 'enabled'=>1, 'position'=>48), 'country.code_iso'=>array('label'=>"Country", 'enabled'=>1, 'position'=>49), 'typent.code'=>array('label'=>"ThirdPartyType", 'enabled'=>$checkedtypetiers, 'position'=>50), - 'u.login'=>array('label'=>"AuthorRequest", 'enabled'=>1, 'position'=>51) + 'u.login'=>array('label'=>"AuthorRequest", 'enabled'=>1, 'position'=>51), + 'cf.note_public'=>array('label'=>'NotePublic', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)), 'position'=>100), + 'cf.note_private'=>array('label'=>'NotePrivate', 'checked'=>0, 'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)), 'position'=>110), ); foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field @@ -1440,6 +1442,16 @@ if ($resql) { print ''; print ''; } + // Note public + if (!empty($arrayfields['cf.note_public']['checked'])) { + print '
'; + } + // Note private + if (!empty($arrayfields['cf.note_private']['checked'])) { + print ''; + } // Action column print '\n"; @@ -1867,6 +1885,25 @@ if ($resql) { $totalarray['nbfield']++; } } + // Note public + if (!empty($arrayfields['cf.note_public']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Note private + if (!empty($arrayfields['cf.note_private']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Action column print '\n"; From ca8c650feb12668abcd6a67fbc8147e577e68299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Courtier?= Date: Fri, 9 Sep 2022 12:20:47 +0200 Subject: [PATCH 371/453] Fix: status of product suplier price was not recovered --- htdocs/fourn/class/fournisseur.product.class.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 0ae975a1cbf..ea5dc639a5e 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -578,7 +578,7 @@ class ProductFournisseur extends Product $sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,"; $sql .= " pfp.barcode, pfp.fk_barcode_type, pfp.packaging,"; - $sql .= " p.ref as product_ref"; + $sql .= " p.ref as product_ref, p.tosell as status, p.tobuy as status_buy"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p"; $sql .= " WHERE pfp.rowid = ".(int) $rowid; $sql .= " AND pfp.fk_product = p.rowid"; @@ -594,7 +594,8 @@ class ProductFournisseur extends Product $this->fk_product = $obj->fk_product; $this->product_id = $obj->fk_product; $this->product_ref = $obj->product_ref; - + $this->status = $obj->status; + $this->status_buy = $obj->status_buy; $this->fourn_id = $obj->fk_soc; $this->fourn_ref = $obj->ref_fourn; // deprecated $this->ref_supplier = $obj->ref_fourn; @@ -670,7 +671,7 @@ class ProductFournisseur extends Product // phpcs:enable global $conf; - $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref,"; + $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref, p.tosell as status, p.tobuy as status_buy, "; $sql .= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,"; $sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,"; @@ -699,6 +700,8 @@ class ProductFournisseur extends Product $prodfourn->product_ref = $record["product_ref"]; $prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"]; + $prodfourn->status = $record["status"]; + $prodfourn->status_buy = $record["status_buy"]; $prodfourn->product_fourn_id = $record["product_fourn_id"]; $prodfourn->product_fourn_entity = $record["entity"]; $prodfourn->ref_supplier = $record["ref_fourn"]; From 14a3bc736072d2583ed6647684bc68f50dfc3b9e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 9 Sep 2022 12:26:17 +0200 Subject: [PATCH 372/453] Fix : php 8.1 warnings --- htdocs/admin/fichinter.php | 8 +- htdocs/admin/hrm.php | 2 +- htdocs/admin/reception_setup.php | 6 +- htdocs/admin/supplier_invoice.php | 2 +- htdocs/admin/supplier_order.php | 354 +++++++++--------- htdocs/admin/supplier_payment.php | 12 +- htdocs/admin/ticket.php | 5 +- htdocs/admin/ticket_public.php | 16 +- htdocs/core/db/mysqli.class.php | 2 +- .../modules/commande/mod_commande_saphir.php | 4 +- .../modules/contract/mod_contract_magre.php | 4 +- htdocs/core/modules/fichinter/mod_arctic.php | 4 +- .../doc/doc_generic_proposal_odt.modules.php | 4 +- .../reception/mod_reception_moonstone.php | 4 +- .../mod_facture_fournisseur_tulip.php | 22 +- .../mod_commande_fournisseur_orchidee.php | 4 +- .../mod_supplier_payment_brodator.php | 8 +- .../modules/ticket/mod_ticket_universal.php | 4 +- htdocs/hrm/admin/admin_establishment.php | 2 +- htdocs/hrm/establishment/card.php | 2 +- 20 files changed, 235 insertions(+), 234 deletions(-) diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 79896d0ed74..daa0d7e8570 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -537,7 +537,7 @@ print '' print ''; print ''; print ''; print ''; print ''; print ''; print ''; print ''; } diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index a06760b9da4..a43b8c8003f 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -237,7 +237,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->RECEPTION_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir) ? '&scan_dir='.$module->scandir : '').(!empty($module->name) ? '&label='.urlencode($module->name) : '').'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -344,10 +344,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if (isset($module->version) && $module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if (isset($module->version) && $module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index aa337ff1f29..646b5e1e13d 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -392,7 +392,7 @@ foreach ($dirmodels as $reldir) { // Default print '
'; + print ''; + print ''; $searchpicto = $form->showFilterButtons(); @@ -1540,6 +1552,12 @@ if ($resql) { if (!empty($arrayfields['cf.date_approve']['checked'])) { print_liste_field_titre($arrayfields['cf.date_approve']['label'], $_SERVER["PHP_SELF"], 'cf.date_approve', '', $param, '', $sortfield, $sortorder, 'center '); } + if (!empty($arrayfields['cf.note_public']['checked'])) { + print_liste_field_titre($arrayfields['cf.note_public']['label'], $_SERVER["PHP_SELF"], "cf.note_public", "", $param, '', $sortfield, $sortorder, 'right '); + } + if (!empty($arrayfields['cf.note_private']['checked'])) { + print_liste_field_titre($arrayfields['cf.note_private']['label'], $_SERVER["PHP_SELF"], "cf.note_private", "", $param, '', $sortfield, $sortorder, 'right '); + } print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "
'; + print dol_string_nohtmltag($obj->note_public); + print ''; + print dol_string_nohtmltag($obj->note_private); + print ''; From 9890965cfe7c8635da82dc3778f3266f9f756564 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Fri, 9 Sep 2022 12:03:42 +0200 Subject: [PATCH 370/453] rather center column title --- htdocs/fourn/commande/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index f1f65ed3fa8..f71126f60ed 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1553,10 +1553,10 @@ if ($resql) { print_liste_field_titre($arrayfields['cf.date_approve']['label'], $_SERVER["PHP_SELF"], 'cf.date_approve', '', $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['cf.note_public']['checked'])) { - print_liste_field_titre($arrayfields['cf.note_public']['label'], $_SERVER["PHP_SELF"], "cf.note_public", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['cf.note_public']['label'], $_SERVER["PHP_SELF"], "cf.note_public", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['cf.note_private']['checked'])) { - print_liste_field_titre($arrayfields['cf.note_private']['label'], $_SERVER["PHP_SELF"], "cf.note_private", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre($arrayfields['cf.note_private']['label'], $_SERVER["PHP_SELF"], "cf.note_private", "", $param, '', $sortfield, $sortorder, 'center '); } print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "
'; print $langs->trans("PrintProductsOnFichinter").' ('.$langs->trans("PrintProductsOnFichinterDetails").')global->FICHINTER_PRINT_PRODUCTS) { +if (getDolGlobalString("FICHINTER_PRINT_PRODUCTS")) { print 'checked '; } print '/>'; @@ -554,7 +554,7 @@ print ''; print $langs->trans("UseServicesDurationOnFichinter"); print ''; -print 'global->FICHINTER_USE_SERVICE_DURATION ? ' checked' : '').'>'; +print ''; print ''; print ''; @@ -570,7 +570,7 @@ print ''; print $langs->trans("UseDurationOnFichinter"); print ''; -print 'global->FICHINTER_WITHOUT_DURATION ? ' checked' : '').'>'; +print ''; print ''; print ''; @@ -586,7 +586,7 @@ print ''; print $langs->trans("UseDateWithoutHourOnFichinter"); print ''; -print 'global->FICHINTER_DATE_WITHOUT_HOUR ? ' checked' : '').'>'; +print ''; print ''; print ''; diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index c568e6de39c..838e9bf9a0b 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -624,7 +624,7 @@ if ($action == 'edit') { setEventMessages(null, $object->errors, "errors"); } } else { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } print '
'; - if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name") { + if (getDolGlobalString("INVOICE_SUPPLIER_ADDON_PDF") == "$name") { //print img_picto($langs->trans("Default"),'on'); // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 0204f184de7..905721128ad 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -1,63 +1,63 @@ - * Copyright (C) 2004-2011 Laurent Destailleur - * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2010-2013 Juanjo Menent - * Copyright (C) 2011-2018 Philippe Grand - * - * 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 . - */ + /* Copyright (C) 2003-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2005-2011 Regis Houssin + * Copyright (C) 2004 Sebastien Di Cintio + * Copyright (C) 2004 Benoit Mortier + * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2011-2018 Philippe Grand + * + * 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 htdocs/admin/supplier_order.php - * \ingroup fournisseur - * \brief Page d'administration-configuration du module Fournisseur - */ + /** + * \file htdocs/admin/supplier_order.php + * \ingroup fournisseur + * \brief Page d'administration-configuration du module Fournisseur + */ -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; -require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; + require '../main.inc.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; -// Load translation files required by the page -$langs->loadLangs(array("admin", "other", "orders", "stocks")); + // Load translation files required by the page + $langs->loadLangs(array("admin", "other", "orders", "stocks")); if (!$user->admin) { accessforbidden(); } -$type = GETPOST('type', 'alpha'); -$value = GETPOST('value', 'alpha'); -$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php + $type = GETPOST('type', 'alpha'); + $value = GETPOST('value', 'alpha'); + $modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php -$label = GETPOST('label', 'alpha'); -$action = GETPOST('action', 'aZ09'); -$scandir = GETPOST('scan_dir', 'alpha'); + $label = GETPOST('label', 'alpha'); + $action = GETPOST('action', 'aZ09'); + $scandir = GETPOST('scan_dir', 'alpha'); -$specimenthirdparty = new Societe($db); -$specimenthirdparty->initAsSpecimen(); + $specimenthirdparty = new Societe($db); + $specimenthirdparty->initAsSpecimen(); -/* - * Actions - */ + /* + * Actions + */ -include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; + include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; if ($action == 'updateMask') { $maskconstorder = GETPOST('maskconstorder', 'alpha'); @@ -193,40 +193,40 @@ if ($action == 'updateMask') { } -/* - * View - */ + /* + * View + */ -$form = new Form($db); + $form = new Form($db); -$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); -llxHeader("", ""); + llxHeader("", ""); -$linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); + $linkback = ''.$langs->trans("BackToModuleList").''; + print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup'); -print "
"; + print "
"; -$head = supplierorder_admin_prepare_head(); + $head = supplierorder_admin_prepare_head(); -print dol_get_fiche_head($head, 'order', $langs->trans("Suppliers"), -1, 'company'); + print dol_get_fiche_head($head, 'order', $langs->trans("Suppliers"), -1, 'company'); -// Supplier order numbering module + // Supplier order numbering module -print load_fiche_titre($langs->trans("OrdersNumberingModules"), '', ''); + print load_fiche_titre($langs->trans("OrdersNumberingModules"), '', ''); -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; + print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; -clearstatcache(); + clearstatcache(); foreach ($dirmodels as $reldir) { $dir = dol_buildpath($reldir."core/modules/supplier_order/"); @@ -309,24 +309,24 @@ foreach ($dirmodels as $reldir) { } } -print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Example").''.$langs->trans("Status").''.$langs->trans("ShortInfo").'

'; + print '

'; -/* - * Documents models for supplier orders - */ + /* + * Documents models for supplier orders + */ -print load_fiche_titre($langs->trans("OrdersModelModule"), '', ''); + print load_fiche_titre($langs->trans("OrdersModelModule"), '', ''); -// Defini tableau def de modele -$def = array(); + // Defini tableau def de modele + $def = array(); -$sql = "SELECT nom"; -$sql .= " FROM ".MAIN_DB_PREFIX."document_model"; -$sql .= " WHERE type = 'order_supplier'"; -$sql .= " AND entity = ".$conf->entity; + $sql = "SELECT nom"; + $sql .= " FROM ".MAIN_DB_PREFIX."document_model"; + $sql .= " WHERE type = 'order_supplier'"; + $sql .= " AND entity = ".$conf->entity; -$resql = $db->query($sql); + $resql = $db->query($sql); if ($resql) { $i = 0; $num_rows = $db->num_rows($resql); @@ -339,17 +339,17 @@ if ($resql) { dol_print_error($db); } -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''; -print ''; -print ''."\n"; + print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'
'."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''; + print ''; + print ''."\n"; -clearstatcache(); + clearstatcache(); foreach ($dirmodels as $reldir) { $realpath = $reldir."core/modules/supplier_order/doc"; @@ -434,76 +434,76 @@ foreach ($dirmodels as $reldir) { } } -print '
'.$langs->trans("Name").''.$langs->trans("Description").''.$langs->trans("Status").''.$langs->trans("Default").''.$langs->trans("ShortInfo").''.$langs->trans("Preview").'

'; + print '

'; -/* - * Other options - */ + /* + * Other options + */ -print '
'; -print ''; -print ''; + print ''; + print ''; + print ''; -print load_fiche_titre($langs->trans("OtherOptions"), '', ''); -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; + print load_fiche_titre($langs->trans("OtherOptions"), '', ''); + print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; + print ''; + print ''; + print ''; + print ''; + print "\n"; -print '\n"; + print '\n"; -// Ask for payment bank during supplier order -/* Kept as hidden for the moment -if (isModEnabled('banque')) { + // Ask for payment bank during supplier order + /* Kept as hidden for the moment + if (isModEnabled('banque')) { - print ''; -} -else -{ + print ''; + } + else + { - print ''; -} -*/ + print ''; + } + */ -$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); -$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); -$htmltext = ''.$langs->trans("AvailableVariables").':
'; + $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); + $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); + $htmltext = ''.$langs->trans("AvailableVariables").':
'; foreach ($substitutionarray as $key => $val) { $htmltext .= $key.'
'; } -$htmltext .= '
'; + $htmltext .= '
'; -print '\n"; + print '\n"; -// Option to add a quality/validation step, on products, after reception. -print ''; -print ''; -print ''; -print ''; + print ''; + print ''; + print '\n"; -print "\n"; + print "\n"; + print "\n"; -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").' 
'; -print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'
'; -print $langs->trans("IfSetToYesDontForgetPermission"); -print '
'; -print ''; -print ''; -print ''; -print "
'; + print $form->textwithpicto($langs->trans("UseDoubleApproval"), $langs->trans("Use3StepsApproval"), 1, 'help').'
'; + print $langs->trans("IfSetToYesDontForgetPermission"); + print '
'; + print ''; + print ''; + print ''; + print "
'; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '; - if (!empty($conf->use_javascript_ajax)) - { - print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER'); - } - else - { - if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) - { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; - } - else - { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; - } - } - print '
'; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '; + if (!empty($conf->use_javascript_ajax)) + { + print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER'); + } + else + { + if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) + { + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + } + else + { + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + } + } + print '
'; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '.$langs->trans('NotAvailable').'
'; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER").' '.$langs->trans('NotAvailable').'
'; -print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; -$variablename = 'SUPPLIER_ORDER_FREE_TEXT'; + print '
'; + print $form->textwithpicto($langs->trans("FreeLegalTextOnOrders"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; + $variablename = 'SUPPLIER_ORDER_FREE_TEXT'; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } else { @@ -511,15 +511,15 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { $doleditor = new DolEditor($variablename, getDolGlobalString($variablename), '', 80, 'dolibarr_notes'); print $doleditor->Create(); } -print '
'; -print ''; -print "
'; + print ''; + print "
'.$langs->trans("UseDispatchStatus").''; + // Option to add a quality/validation step, on products, after reception. + print '
'.$langs->trans("UseDispatchStatus").''; if (isModEnabled('reception')) { print ''.$langs->trans("FeatureNotAvailableWithReceptionModule").''; } else { @@ -530,33 +530,33 @@ if (isModEnabled('reception')) { print $form->selectarray("SUPPLIER_ORDER_USE_DISPATCH_STATUS", $arrval, $conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS); } } -print "

'; + print '

'; -print ''; + print ''; -/* - * Notifications - */ + /* + * Notifications + */ -print load_fiche_titre($langs->trans("Notifications"), '', ''); -print ''; -print ''; -print ''; -print ''; -print ''; -print "\n"; + print load_fiche_titre($langs->trans("Notifications"), '', ''); + print '
'.$langs->trans("Parameter").' 
'; + print ''; + print ''; + print ''; + print ''; + print "\n"; -print '\n"; + print '\n"; -print '
'.$langs->trans("Parameter").' 
'; -print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; -print '
'; -print "
'; + print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; + print '
'; + print "
'; + print '
'; -// End of page -llxFooter(); -$db->close(); + // End of page + llxFooter(); + $db->close(); diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index a41f9fdf80c..187123ebbe7 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -74,7 +74,7 @@ if ($action == 'updateMask') { } elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { - if ($conf->global->FACTURE_ADDON_PDF == "$value") { + if (getDolGlobalString("FACTURE_ADDON_PDF") == "$value") { dolibarr_del_const($db, 'SUPPLIER_PAYMENT_ADDON_PDF', $conf->entity); } } @@ -262,7 +262,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->SUPPLIER_PAYMENT_ADDON == $file || $conf->global->SUPPLIER_PAYMENT_ADDON.'.php' == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir) ? '&scandir='.$module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -288,7 +288,7 @@ foreach ($dirmodels as $reldir) { print ''; print $form->textwithpicto('', $htmltooltip, 1, 0); - if ($conf->global->PAYMENT_ADDON.'.php' == $file) { // If module is the one used, we show existing errors + if (getDolGlobalString("PAYMENT_ADDON").'.php' == $file) { // If module is the one used, we show existing errors if (!empty($module->error)) { dol_htmloutput_mesg($module->error, '', 'error', 1); } @@ -350,7 +350,7 @@ foreach ($dirmodels as $reldir) { print "\n"; print "\n"; require_once $dir.'/'.$file; - $module = new $classname($db, $specimenthirdparty); + $module = new $classname($db, new Societe($db)); if (method_exists($module, 'info')) { print $module->info($langs); } else { @@ -382,7 +382,7 @@ foreach ($dirmodels as $reldir) { // Default print ''; - if ($conf->global->SUPPLIER_PAYMENT_ADDON_PDF == "$name") { + if (getDolGlobalString("SUPPLIER_PAYMENT_ADDON_PDF") == "$name") { //print img_picto($langs->trans("Default"),'on'); // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all print 'scandir).'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; @@ -441,7 +441,7 @@ print "\n"; print ''; print $langs->trans("GroupPaymentsByModOnReports"); print ''; -print $form->selectyesno("PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", $conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD, 1); +print $form->selectyesno("PAYMENTS_FOURN_REPORT_GROUP_BY_MOD", getDolGlobalString("PAYMENTS_FOURN_REPORT_GROUP_BY_MOD"), 1); print ''; print "\n"; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index f1fbba03840..66b7f24a719 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -428,7 +428,7 @@ foreach ($dirmodels as $reldir) { // Default print ''; - if ($conf->global->TICKET_ADDON_PDF == $name) { + if (getDolGlobalString("TICKET_ADDON_PDF") == $name) { print img_picto($langs->trans("Default"), 'on'); } else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; @@ -540,9 +540,10 @@ print ''; print ''; if (isModEnabled('product')) { + $htmlname = "product_category_id"; print ''.$langs->trans("TicketChooseProductCategory").''; print ''; - $formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id'); + $formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, $htmlname); if ($conf->use_javascript_ajax) { print ajax_combobox('select_'.$htmlname); } diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 3e4c088620d..3d2a64e4d96 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -381,10 +381,10 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { } // Interface topic - $url_interface = $conf->global->TICKET_PUBLIC_INTERFACE_TOPIC; + $url_interface = getDolGlobalString("TICKET_PUBLIC_INTERFACE_TOPIC"); print ''.$langs->trans("TicketPublicInterfaceTopicLabelAdmin").''; print ''; - print ''; + print ''; print ''; print ''; print $form->textwithpicto('', $langs->trans("TicketPublicInterfaceTopicHelp"), 1, 'help'); @@ -403,7 +403,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print ''; // Text to help to enter a ticket - $public_text_help_message = $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'); + $public_text_help_message = getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe')); print ''.$langs->trans("TicketPublicInterfaceTextHelpMessageLabelAdmin").''; print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -415,10 +415,10 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print ''; // Url public interface - $url_interface = $conf->global->TICKET_URL_PUBLIC_INTERFACE; + $url_interface = getDolGlobalString("TICKET_URL_PUBLIC_INTERFACE"); print ''.$langs->trans("TicketUrlPublicInterfaceLabelAdmin").''; print ''; - print ''; + print ''; print ''; print ''; print $form->textwithpicto('', $langs->trans("TicketUrlPublicInterfaceHelpAdmin"), 1, 'help'); @@ -448,7 +448,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print ''; // Text of email after creatio of a ticket - $mail_mesg_new = $conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->trans('TicketNewEmailBody'); + $mail_mesg_new = getDolGlobalString("TICKET_MESSAGE_MAIL_NEW", $langs->trans('TicketNewEmailBody')); print ''; print $form->textwithpicto($langs->trans("TicketNewEmailBodyLabel"), $langs->trans("TicketNewEmailBodyHelp"), 1, 'help'); print ''; @@ -468,7 +468,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print ajax_constantonoff('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED); + print $form->selectarray("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED", $arrval, getDolGlobalString("TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_ENABLED")); } print ''; print ''; @@ -477,7 +477,7 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print ''; print $form->textwithpicto($langs->trans("TicketPublicNotificationNewMessageDefaultEmail"), $langs->trans("TicketPublicNotificationNewMessageDefaultEmailHelp"), 1, 'help'); print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 9b1d78f1694..1fe4ce77414 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -421,7 +421,7 @@ class DoliDBMysqli extends DoliDB if (!is_object($resultset)) { $resultset = $this->_results; } - return $resultset->num_rows; + return isset($resultset->num_rows) ? $resultset->num_rows : 0; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index 36efdcc1d88..ad2b109f2d1 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -79,7 +79,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -128,7 +128,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->COMMANDE_SAPHIR_MASK; + $mask = getDolGlobalString("COMMANDE_SAPHIR_MASK"); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index e0c54c1d022..e88d2c46b32 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -85,7 +85,7 @@ class mod_contract_magre extends ModelNumRefContracts $tooltip .= $langs->trans("GenericMaskCodes5"); $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; $texte .= ''; $texte .= ''; @@ -127,7 +127,7 @@ class mod_contract_magre extends ModelNumRefContracts require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $mask = $conf->global->CONTRACT_MAGRE_MASK; + $mask = getDolGlobalString("CONTRACT_MAGRE_MASK"); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index cb5acddd6e9..8efd936601b 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -84,7 +84,7 @@ class mod_arctic extends ModeleNumRefFicheinter // Setting the prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -130,7 +130,7 @@ class mod_arctic extends ModeleNumRefFicheinter require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We define the search criteria of the counter - $mask = $conf->global->FICHINTER_ARTIC_MASK; + $mask = getDolGlobalString("FICHINTER_ARTIC_MASK"); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 8314d62dada..dfcc9273505 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -123,7 +123,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -187,7 +187,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= '
'; // Set default template for different status of proposal - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if (getDolGlobalInt("MAIN_PROPAL_CHOOSE_ODT_DOCUMENT") > 0) { // Model for creation $list = ModelePDFPropales::liste_modeles($this->db); $texte .= ''; diff --git a/htdocs/core/modules/reception/mod_reception_moonstone.php b/htdocs/core/modules/reception/mod_reception_moonstone.php index e1a5669dc09..40aaa63a7a8 100644 --- a/htdocs/core/modules/reception/mod_reception_moonstone.php +++ b/htdocs/core/modules/reception/mod_reception_moonstone.php @@ -61,7 +61,7 @@ class mod_reception_moonstone extends ModelNumRefReception $tooltip .= $langs->trans("GenericMaskCodes5"); $texte .= ''; - $texte .= ''; + $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '
'.$langs->trans("Mask").':'.$form->textwithpicto('', $tooltip, 1, 1).''.$form->textwithpicto('', $tooltip, 1, 1).' 
'; @@ -106,7 +106,7 @@ class mod_reception_moonstone extends ModelNumRefReception require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $mask = $conf->global->RECEPTION_MOONSTONE_MASK; + $mask = getDolGlobalString("RECEPTION_MOONSTONE_MASK"); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index e6838b9c4c4..0aacecc69da 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -67,12 +67,12 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices */ public function info() { - global $conf, $langs; + global $conf, $langs, $db; // Load translation files required by the page $langs->loadLangs(array("bills", "admin")); - $form = new Form($this->db); + $form = new Form($db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte .= '
'; @@ -93,7 +93,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices // Setting the prefix $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").')'; $texte .= ':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -101,19 +101,19 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { // Parametrage du prefix des replacement $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; } // Prefix setting of deposit $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; @@ -159,16 +159,16 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices // Get Mask value $mask = ''; if (is_object($object) && $object->type == 1) { - $mask = $conf->global->SUPPLIER_REPLACEMENT_TULIP_MASK; + $mask = getDolGlobalString("SUPPLIER_REPLACEMENT_TULIP_MASK"); if (!$mask) { - $mask = $conf->global->SUPPLIER_INVOICE_TULIP_MASK; + $mask = getDolGlobalString("SUPPLIER_INVOICE_TULIP_MASK"); } } elseif (is_object($object) && $object->type == 2) { - $mask = $conf->global->SUPPLIER_CREDIT_TULIP_MASK; + $mask = getDolGlobalString("SUPPLIER_CREDIT_TULIP_MASK"); } elseif (is_object($object) && $object->type == 3) { - $mask = $conf->global->SUPPLIER_DEPOSIT_TULIP_MASK; + $mask = getDolGlobalString("SUPPLIER_DEPOSIT_TULIP_MASK"); } else { - $mask = $conf->global->SUPPLIER_INVOICE_TULIP_MASK; + $mask = getDolGlobalString("SUPPLIER_INVOICE_TULIP_MASK"); } if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 473664cb44c..8f67f28b42d 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -85,7 +85,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -131,7 +131,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // On defini critere recherche compteur - $mask = $conf->global->COMMANDE_FOURNISSEUR_ORCHIDEE_MASK; + $mask = getDolGlobalString("COMMANDE_FOURNISSEUR_ORCHIDEE_MASK"); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index 0bc0543e6cd..292662a14ad 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -61,11 +61,11 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments */ public function info() { - global $conf, $langs; + global $conf, $langs, $db; $langs->load("bills"); - $form = new Form($this->db); + $form = new Form($db); $texte = $langs->trans('GenericNumRefModelDesc')."
\n"; $texte .= ''; @@ -82,7 +82,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -128,7 +128,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->SUPPLIER_PAYMENT_BRODATOR_MASK; + $mask = getDolGlobalString("SUPPLIER_PAYMENT_BRODATOR_MASK"); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index 2c46376eea1..8efc2f6a4e5 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.php @@ -81,7 +81,7 @@ class mod_ticket_universal extends ModeleNumRefTicket // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -127,7 +127,7 @@ class mod_ticket_universal extends ModeleNumRefTicket include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // On defini critere recherche compteur - $mask = $conf->global->TICKET_UNIVERSAL_MASK; + $mask = getDolGlobalString("TICKET_UNIVERSAL_MASK"); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 223f8a720d5..f28c0285e1f 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -53,10 +53,10 @@ if (empty($page) || $page == -1) { $page = 0; } +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; /* diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 1b30eed663a..fa2ed2f55fd 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -254,7 +254,7 @@ if ($action == 'create') { } // Part to edit record -if (($id || $ref) && $action == 'edit') { +if ((!empty($id) || !empty($ref)) && $action == 'edit') { $result = $object->fetch($id); if ($result > 0) { $head = establishment_prepare_head($object); From b23ab2cb712a7f89ba989843a48bd12d26b9aa12 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 13:58:54 +0200 Subject: [PATCH 373/453] FIX #yogosha12266 --- htdocs/accountancy/journal/variousjournal.php | 2 +- htdocs/admin/clicktodial.php | 4 +- htdocs/api/index.php | 2 + htdocs/categories/viewcat.php | 20 +- htdocs/comm/action/list.php | 4 - htdocs/core/ajax/objectonoff.php | 9 +- htdocs/core/ajax/selectsearchbox.php | 1 + htdocs/core/lib/functions.lib.php | 3 +- htdocs/core/lib/security.lib.php | 23 ++- htdocs/core/tpl/login.tpl.php | 4 +- htdocs/core/tpl/passwordforgotten.tpl.php | 4 +- htdocs/core/website.inc.php | 26 ++- htdocs/document.php | 8 +- .../conferenceorboothattendee_note.php | 1 - htdocs/hrm/position.php | 1 - htdocs/hrm/skill_tab.php | 4 +- htdocs/main.inc.php | 13 +- htdocs/modulebuilder/index.php | 4 +- .../mailinglist_mymodule_myobject.modules.php | 6 +- .../template/myobject_agenda.php | 1 - .../modulebuilder/template/myobject_card.php | 4 +- .../template/myobject_document.php | 181 +++++++++--------- .../modulebuilder/template/myobject_list.php | 1 - .../modulebuilder/template/myobject_note.php | 1 - .../template/scripts/mymodule.php | 1 - htdocs/public/agenda/agendaexport.php | 2 +- htdocs/public/cron/cron_run_jobs_by_url.php | 2 +- htdocs/public/demo/index.php | 2 +- htdocs/public/donations/donateurs_code.php | 2 +- .../public/eventorganization/attendee_new.php | 2 +- .../eventorganization/subscriptionok.php | 2 +- htdocs/public/members/new.php | 5 +- htdocs/public/members/public_card.php | 2 +- htdocs/public/members/public_list.php | 2 +- htdocs/public/onlinesign/newonlinesign.php | 34 ++-- htdocs/public/opensurvey/studs.php | 10 +- htdocs/public/partnership/new.php | 5 +- htdocs/public/payment/paymentko.php | 2 +- htdocs/public/payment/paymentok.php | 2 +- htdocs/public/project/index.php | 2 +- htdocs/public/project/new.php | 2 +- htdocs/public/project/suggestbooth.php | 2 +- htdocs/public/project/suggestconference.php | 2 +- htdocs/public/project/viewandvote.php | 2 +- htdocs/public/recruitment/index.php | 2 +- htdocs/public/recruitment/view.php | 2 +- htdocs/public/stripe/ipn.php | 31 ++- htdocs/public/ticket/create_ticket.php | 2 +- htdocs/public/ticket/index.php | 2 +- htdocs/public/ticket/list.php | 2 +- htdocs/public/ticket/view.php | 2 +- htdocs/societe/document.php | 158 ++++++++------- htdocs/user/class/user.class.php | 2 +- htdocs/viewimage.php | 16 +- htdocs/webhook/target_card.php | 2 +- 55 files changed, 316 insertions(+), 317 deletions(-) diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index d737925f2c3..9c944aa7470 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -51,7 +51,7 @@ if ($result > 0) { } elseif ($result < 0) { dol_print_error('', $object->error, $object->errors); } elseif ($result == 0) { - accessforbidden($langs->trans('ErrorRecordNotFound')); + accessforbidden('ErrorRecordNotFound'); } $hookmanager->initHooks(array('globaljournal', $object->nature.'journal')); diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 8b8f2c6c921..72b7be134bb 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -35,8 +35,8 @@ if (!$user->admin) { $action = GETPOST('action', 'aZ09'); -if (!in_array('clicktodial', $conf->modules)) { - accessforbidden($langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module58Name"))); +if (!isModEnabled('clicktodial')) { + accessforbidden($langs->transnoentitiesnoconv("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module58Name"))); } diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 8543e284533..4c0d36fdcfe 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -76,6 +76,8 @@ if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) { header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY'); } +header('X-Frame-Options: SAMEORIGIN'); + $res = 0; if (!$res && file_exists("../main.inc.php")) { diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 0e5da0735ce..97c6d118842 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -563,7 +563,7 @@ if ($type == Categorie::TYPE_PRODUCT) { } } else { print_barre_liste($langs->trans("ProductsAndServices"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'products'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } @@ -643,7 +643,7 @@ if ($type == Categorie::TYPE_CUSTOMER) { } } else { print_barre_liste($langs->trans("Customers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } @@ -724,7 +724,7 @@ if ($type == Categorie::TYPE_SUPPLIER) { } } else { print_barre_liste($langs->trans("Suppliers"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'companies'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } @@ -808,7 +808,7 @@ if ($type == Categorie::TYPE_MEMBER) { } } else { print_barre_liste($langs->trans("Member"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'members'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } @@ -895,7 +895,7 @@ if ($type == Categorie::TYPE_CONTACT) { } } else { print_barre_liste($langs->trans("Contact"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'contact'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } @@ -977,7 +977,7 @@ if ($type == Categorie::TYPE_ACCOUNT) { } } else { print_barre_liste($langs->trans("Banque"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'bank'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } @@ -1060,7 +1060,7 @@ if ($type == Categorie::TYPE_PROJECT) { } } else { print_barre_liste($langs->trans("Project"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'project'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } @@ -1137,7 +1137,7 @@ if ($type == Categorie::TYPE_USER) { } } else { print_barre_liste($langs->trans("Users"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'user'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } @@ -1201,7 +1201,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) { } } else { print_barre_liste($langs->trans("Warehouse"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'stock'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } @@ -1280,7 +1280,7 @@ if ($type == Categorie::TYPE_TICKET) { } } else { print_barre_liste($langs->trans("Ticket"), null, $_SERVER["PHP_SELF"], '', '', '', '', '', '', 'ticket'); - accessforbidden($langs->trans("NotEnoughPermissions"), 0, 0); + accessforbidden("NotEnoughPermissions", 0, 0); } } diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index b42bf003333..767c91b8abd 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -27,10 +27,6 @@ * \brief Page to list actions */ -if (!defined("NOREDIRECTBYMAINTOLOGIN")) { - define('NOREDIRECTBYMAINTOLOGIN', 1); -} - require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index ffd05c4747e..5042dadb9b3 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -1,5 +1,6 @@ + * * 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 @@ -65,13 +66,15 @@ if (!empty($user->socid)) { $socid = $user->socid; } +//$user->rights->societe->lire = 0;$user->rights->fournisseur->lire = 0; +//restrictedArea($user, 'societe', $id); + if (in_array($field, array('status'))) { restrictedArea($user, $element, $id); } elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid'); } else { - accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1); - exit; + httponly_accessforbidden("Bad value for combination of parameters element/field."); } diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index b643351dc73..19f7523fd21 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -40,6 +40,7 @@ if (!isset($usedbyinclude) || empty($usedbyinclude)) { define('NOREQUIREAJAX', '1'); } if (!defined('NOREDIRECTBYMAINTOLOGIN')) { + // Disable redirect to main login because the selectsearch must not ask a login define('NOREDIRECTBYMAINTOLOGIN', '1'); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7391785312f..a18e3a761a9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4955,8 +4955,9 @@ function dol_print_error($db = '', $error = '', $errors = null) $out .= "
\n"; } - // Return a http error code if possible + // Return a http header with error code if possible if (!headers_sent()) { + top_httphead(); http_response_code(500); } diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 1efcbaacf78..ce6f9b38320 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -329,11 +329,11 @@ function dolGetLdapPasswordHash($password, $type = 'md5') * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param int $isdraft 1=The object with id=$objectid is a draft - * @param int $mode Mode (0=default, 1=return with not die) + * @param int $mode Mode (0=default, 1=return without dieing) * @return int If mode = 0 (default): Always 1, die process if not allowed. If mode = 1: Return 0 if access not allowed. * @see dol_check_secure_access_document(), checkUserAccessToObject() */ -function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0, $mode = 0) +function restrictedArea(User $user, $features, $objectid = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0, $mode = 0) { global $db, $conf; global $hookmanager; @@ -1022,24 +1022,29 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl * This includes only HTTP header. * Calling this function terminate execution of PHP. * - * @param string $message Force error message - * @param int $http_response_code HTTP response code + * @param string $message Force error message + * @param int $http_response_code HTTP response code + * @param int $stringalreadysanitized 1 if string is already sanitized with HTML entities * @return void * @see accessforbidden() */ -function httponly_accessforbidden($message = 1, $http_response_code = 403) +function httponly_accessforbidden($message = 1, $http_response_code = 403, $stringalreadysanitized = 0) { - top_httphead('text/html'); + top_httphead(); http_response_code($http_response_code); - print htmlentities($message); + if ($stringalreadysanitized) { + print $message; + } else { + print htmlentities($message); + } exit(1); } /** * Show a message to say access is forbidden and stop program. - * This includes HTTP and HTML header and footer. + * This includes HTTP and HTML header and footer (except if $printheader and $printfooter is 0, use this case inside an already started page). * Calling this function terminate execution of PHP. * * @param string $message Force error message @@ -1070,7 +1075,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho } } print '
'; - if (!$message) { + if (empty($message)) { print $langs->trans("ErrorForbidden"); } else { print $langs->trans($message); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index b07bb66b46c..f179ea9ed36 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -33,10 +33,8 @@ if (empty($conf) || !is_object($conf)) { // DDOS protection $size = (empty($_SERVER['CONTENT_LENGTH']) ? 0 : (int) $_SERVER['CONTENT_LENGTH']); if ($size > 10000) { - http_response_code(413); $langs->loadLangs(array("errors", "install")); - accessforbidden('
'.$langs->trans("ErrorRequestTooLarge").'.
'.$langs->trans("ClickHereToGoToApp").'
', 0, 0, 1); - exit; + httponly_accessforbidden('
'.$langs->trans("ErrorRequestTooLarge").'.
'.$langs->trans("ClickHereToGoToApp").'
', 413, 1); } require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 6d52cfff267..9aaba5745bb 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -30,10 +30,8 @@ if (empty($conf) || !is_object($conf)) { // DDOS protection $size = (int) $_SERVER['CONTENT_LENGTH']; if ($size > 10000) { - http_response_code(413); $langs->loadLangs(array("errors", "install")); - accessforbidden('
'.$langs->trans("ErrorRequestTooLarge").'
'.$langs->trans("ClickHereToGoToApp").'
', 0, 0, 1); - exit; + httponly_accessforbidden('
'.$langs->trans("ErrorRequestTooLarge").'
'.$langs->trans("ClickHereToGoToApp").'
', 413, 1); } require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index 3bbfe225bee..2bdc9080b78 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -75,6 +75,18 @@ if ($pageid > 0) { if (!defined('USEDOLIBARREDITOR') && (in_array($websitepage->type_container, array('menu', 'other')) || empty($websitepage->status) && !defined('USEDOLIBARRSERVER'))) { $weblangs->load("website"); + + // Security options + + // X-Content-Type-Options + header("X-Content-Type-Options: nosniff"); + + // X-Frame-Options + if (empty($websitepage->allowed_in_frames) && empty($conf->global->WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES)) { + header("X-Frame-Options: SAMEORIGIN"); + } + + //httponly_accessforbidden('


'.$weblangs->trans("YouTryToAccessToAFileThatIsNotAWebsitePage", $websitepage->pageurl, $websitepage->type_container, $websitepage->status).'
', 404, 1); http_response_code(404); print '


'.$weblangs->trans("YouTryToAccessToAFileThatIsNotAWebsitePage", $websitepage->pageurl, $websitepage->type_container, $websitepage->status).'
'; exit; @@ -198,9 +210,21 @@ if ($_SERVER['PHP_SELF'] != DOL_URL_ROOT.'/website/index.php') { // If we browsi } } -// Show off line message +// Show off line message when all website is off if (!defined('USEDOLIBARREDITOR') && empty($website->status)) { + // Security options + + // X-Content-Type-Options + header("X-Content-Type-Options: nosniff"); + + // X-Frame-Options + if (empty($websitepage->allowed_in_frames) && empty($conf->global->WEBSITE_ALLOW_FRAMES_ON_ALL_PAGES)) { + header("X-Frame-Options: SAMEORIGIN"); + } + $weblangs->load("website"); + + //httponly_accessforbidden('


'.$weblangs->trans("SorryWebsiteIsCurrentlyOffLine").'
', 503, 1); http_response_code(503); print '


'.$weblangs->trans("SorryWebsiteIsCurrentlyOffLine").'
'; exit; diff --git a/htdocs/document.php b/htdocs/document.php index 65e5cce7e5f..4f6652fafda 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -104,10 +104,10 @@ $entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; // Security check if (empty($modulepart) && empty($hashp)) { - accessforbidden('Bad link. Bad value for parameter modulepart', 0, 0, 1); + httponly_accessforbidden('Bad link. Bad value for parameter modulepart', 400); } if (empty($original_file) && empty($hashp)) { - accessforbidden('Bad link. Missing identification to find file (original_file or hashp)', 0, 0, 1); + httponly_accessforbidden('Bad link. Missing identification to find file (original_file or hashp)', 400); } if ($modulepart == 'fckeditor') { $modulepart = 'medias'; // For backward compatibility @@ -158,7 +158,7 @@ if (!empty($hashp)) { $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir //var_dump($original_file); exit; } else { - accessforbidden('Bad link. File is from another module part.', 0, 0, 1); + httponly_accessforbidden('Bad link. File is from another module part.', 403); } } else { $modulepart = $moduleparttocheck; @@ -171,7 +171,7 @@ if (!empty($hashp)) { } } else { $langs->load("errors"); - accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1); + httponly_accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 403, 1); } } diff --git a/htdocs/eventorganization/conferenceorboothattendee_note.php b/htdocs/eventorganization/conferenceorboothattendee_note.php index b6e343e4496..adc4a1683b8 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_note.php +++ b/htdocs/eventorganization/conferenceorboothattendee_note.php @@ -38,7 +38,6 @@ //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification diff --git a/htdocs/hrm/position.php b/htdocs/hrm/position.php index 2659321e5fc..24ce9ec3b51 100644 --- a/htdocs/hrm/position.php +++ b/htdocs/hrm/position.php @@ -41,7 +41,6 @@ //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification diff --git a/htdocs/hrm/skill_tab.php b/htdocs/hrm/skill_tab.php index c48a7c405c6..393e20ba3c4 100644 --- a/htdocs/hrm/skill_tab.php +++ b/htdocs/hrm/skill_tab.php @@ -64,7 +64,9 @@ if (in_array($objecttype, $TAuthorizedObjects)) { } elseif ($objecttype == "user") { $object = new User($db); } -} else accessforbidden($langs->trans('ErrorBadObjectType')); +} else { + accessforbidden('ErrorBadObjectType'); +} $hookmanager->initHooks(array('skilltab', 'globalcard')); // Note that conf->hooks_modules contains array diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 06ff00e474f..6d89923f20e 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -547,12 +547,12 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( ) { // If token is not provided or empty, error (we are in case it is mandatory) if (!GETPOST('token', 'alpha') || GETPOST('token', 'alpha') == 'notrequired') { + top_httphead(); if (GETPOST('uploadform', 'int')) { dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." refused. File size too large or not provided."); $langs->loadLangs(array("errors", "install")); print $langs->trans("ErrorFileSizeTooLarge").' '; print $langs->trans("ErrorGoBackAndCorrectParameters"); - die; } else { http_response_code(403); if (defined('CSRFCHECK_WITH_TOKEN')) { @@ -567,8 +567,8 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( } print " into setup).\n"; } - die; } + die; } } @@ -851,12 +851,16 @@ if (!defined('NOLOGIN')) { // No data to test login, so we show the login page. dol_syslog("--- Access to ".(empty($_SERVER["REQUEST_METHOD"]) ? '' : $_SERVER["REQUEST_METHOD"].' ').$_SERVER["PHP_SELF"]." - action=".GETPOST('action', 'aZ09')." - actionlogin=".GETPOST('actionlogin', 'aZ09')." - showing the login form and exit", LOG_INFO); if (defined('NOREDIRECTBYMAINTOLOGIN')) { + // When used with NOREDIRECTBYMAINTOLOGIN set, the http header must already be set when including the main. + // See example with selectsearchbox.php. This case is reserverd for the selectesearchbox.php so we can + // report a message to ask to login when search ajax component is used after a timeout. + //top_httphead(); return 'ERROR_NOT_LOGGED'; } else { if ($_SERVER["HTTP_USER_AGENT"] == 'securitytest') { http_response_code(401); // It makes easier to understand if session was broken during security tests } - dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); + dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); // This include http headers } exit; } @@ -1242,8 +1246,7 @@ if (!defined('NOLOGIN')) { // If not active, we refuse the user $langs->loadLangs(array("errors", "other")); dol_syslog("Authentication KO as login is disabled", LOG_NOTICE); - accessforbidden($langs->trans("ErrorLoginDisabled")); - exit; + accessforbidden("ErrorLoginDisabled"); } // Load permissions diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 7e086887a37..688f8235174 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -81,10 +81,10 @@ $idmodule= GETPOST('idmodule', 'alpha'); // Security check if (!isModEnabled('modulebuilder')) { - accessforbidden(); + accessforbidden('Module ModuleBuilder not enabled'); } if (!$user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) { - accessforbidden($langs->trans('ModuleBuilderNotAllowed')); + accessforbidden('ModuleBuilderNotAllowed'); } diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 290048785fd..280f62dc2c1 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -46,12 +46,8 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets */ public function __construct($db) { - global $conf; - $this->db = $db; - if (is_array($conf->modules)) { - $this->enabled = in_array('mymodule', $conf->modules) ? 1 : 0; - } + $this->enabled = isModEnabled('mymodule'); } diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 6cc99f4f34d..0a397dceaa6 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -38,7 +38,6 @@ //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message //if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 7ecce8c745f..aa2680ea568 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -38,7 +38,6 @@ //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message //if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification @@ -248,8 +247,7 @@ llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { if (empty($permissiontoadd)) { - accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1); - exit; + accessforbidden('NotEnoughPermissions', 0, 1); } print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("MyObject")), '', 'object_'.$object->picto); diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index d06eb61ba0e..4a4b68391bc 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -38,7 +38,6 @@ //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message //if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification @@ -143,7 +142,13 @@ if ($enablepermissioncheck) { if (!isModEnabled("mymodule")) { accessforbidden(); } -if (!$permissiontoread) accessforbidden(); +if (!$permissiontoread) { + accessforbidden(); +} +if (empty($object->id)) { + accessforbidden(); +} + /* @@ -164,100 +169,94 @@ $help_url = ''; //$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url); -if ($object->id) { - /* - * Show tabs - */ - $head = myobjectPrepareHead($object); +// Show tabs +$head = myobjectPrepareHead($object); - print dol_get_fiche_head($head, 'document', $langs->trans("MyObject"), -1, $object->picto); +print dol_get_fiche_head($head, 'document', $langs->trans("MyObject"), -1, $object->picto); - // Build file list - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); - $totalsize = 0; - foreach ($filearray as $key => $file) { - $totalsize += $file['size']; - } - - // Object card - // ------------------------------------------------------------ - $linkback = ''.$langs->trans("BackToList").''; - - $morehtmlref = '
'; - /* - // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); - // Thirdparty - $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); - // Project - if (!empty($conf->project->enabled)) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($permissiontoadd) - { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.=''; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ': '.$proj->getNomUrl(); - } else { - $morehtmlref .= ''; - } - } - }*/ - $morehtmlref .= '
'; - - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - - print '
'; - - print '
'; - print ''; - - // Number of files - print ''; - - // Total size - print ''; - - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; - - print '
'; - - print dol_get_fiche_end(); - - $modulepart = 'mymodule'; - //$permissiontoadd = $user->rights->mymodule->myobject->write; - $permissiontoadd = 1; - //$permtoedit = $user->rights->mymodule->myobject->write; - $permtoedit = 1; - $param = '&id='.$object->id; - - //$relativepathwithnofile='myobject/' . dol_sanitizeFileName($object->id).'/'; - $relativepathwithnofile = 'myobject/'.dol_sanitizeFileName($object->ref).'/'; - - include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} else { - accessforbidden('', 0, 1); +// Build file list +$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); +$totalsize = 0; +foreach ($filearray as $key => $file) { + $totalsize += $file['size']; } +// Object card +// ------------------------------------------------------------ +$linkback = ''.$langs->trans("BackToList").''; + +$morehtmlref = '
'; +/* + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + // Project + if (!empty($conf->project->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($permissiontoadd) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= ': '.$proj->getNomUrl(); + } else { + $morehtmlref .= ''; + } + } + }*/ +$morehtmlref .= '
'; + +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + +print '
'; + +print '
'; +print ''; + +// Number of files +print ''; + +// Total size +print ''; + +print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; + +print '
'; + +print dol_get_fiche_end(); + +$modulepart = 'mymodule'; +//$permissiontoadd = $user->rights->mymodule->myobject->write; +$permissiontoadd = 1; +//$permtoedit = $user->rights->mymodule->myobject->write; +$permtoedit = 1; +$param = '&id='.$object->id; + +//$relativepathwithnofile='myobject/' . dol_sanitizeFileName($object->id).'/'; +$relativepathwithnofile = 'myobject/'.dol_sanitizeFileName($object->ref).'/'; + +include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; + // End of page llxFooter(); $db->close(); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 987b58f2369..789a5d2312d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -38,7 +38,6 @@ //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message //if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification diff --git a/htdocs/modulebuilder/template/myobject_note.php b/htdocs/modulebuilder/template/myobject_note.php index 6b03ddbf8c6..e97d131551a 100644 --- a/htdocs/modulebuilder/template/myobject_note.php +++ b/htdocs/modulebuilder/template/myobject_note.php @@ -38,7 +38,6 @@ //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message //if (! defined("MAIN_SECURITY_FORCECSP")) define('MAIN_SECURITY_FORCECSP', 'none'); // Disable all Content Security Policies //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification diff --git a/htdocs/modulebuilder/template/scripts/mymodule.php b/htdocs/modulebuilder/template/scripts/mymodule.php index 860c3a54bec..2d9b3aac79c 100644 --- a/htdocs/modulebuilder/template/scripts/mymodule.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -39,7 +39,6 @@ //if (! defined('NOIPCHECK')) define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip //if (! defined("MAIN_LANG_DEFAULT")) define('MAIN_LANG_DEFAULT', 'auto'); // Force lang to a particular value //if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule'); // Force authentication handler -//if (! defined("NOREDIRECTBYMAINTOLOGIN")) define('NOREDIRECTBYMAINTOLOGIN', 1); // The main.inc.php does not make a redirect if not logged, instead show simple error message //if (! defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET //if (! defined('NOBROWSERNOTIF')) define('NOBROWSERNOTIF', '1'); // Disable browser notification if (!defined('NOSESSION')) define('NOSESSION', '1'); // On CLI mode, no need to use web sessions diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index a0e7ea817a7..fa134da668c 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -84,7 +84,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; // Security check if (empty($conf->agenda->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Agenda not enabled'); } // Not older than diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index fa81b8d8bd7..497c68954db 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -75,7 +75,7 @@ $langs->loadLangs(array("admin", "cron", "dict")); // Security check if (empty($conf->cron->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Cron not enabled'); } diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 49bde1a2b9b..892eb45870d 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -51,7 +51,7 @@ $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); // Security check global $dolibarr_main_demo; if (empty($dolibarr_main_demo)) { - accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page', 0, 0, 1); + httponly_accessforbidden('Parameter dolibarr_main_demo must be defined in conf file with value "default login,default pass" to enable the demo entry page'); } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 87db3ee4133..51f7ef7234b 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -60,7 +60,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; // Security check if (empty($conf->don->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Donation not enabled'); } diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 8bb85022b2e..b3eb731ab19 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -138,7 +138,7 @@ $user->loadDefaultValues(); // Security check if (empty($conf->eventorganization->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Event organization not enabled'); } diff --git a/htdocs/public/eventorganization/subscriptionok.php b/htdocs/public/eventorganization/subscriptionok.php index 8acf3daba78..248c281a284 100644 --- a/htdocs/public/eventorganization/subscriptionok.php +++ b/htdocs/public/eventorganization/subscriptionok.php @@ -77,7 +77,7 @@ if ($securekeyreceived != $securekeytocompare) { // Security check if (empty($conf->eventorganization->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Event organization not enabled'); } diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 2a69b4b0ef0..0a1ebc0600e 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -86,12 +86,11 @@ $langs->loadLangs(array("main", "members", "companies", "install", "other")); // Security check if (empty($conf->adherent->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Membership not enabled'); } if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) { - print $langs->trans("Auto subscription form for public visitors has not been enabled"); - exit; + httponly_accessforbidden("Auto subscription form for public visitors has not been enabled"); } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index d58b6448edb..067e6ed94ea 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -53,7 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; // Security check if (empty($conf->adherent->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Memebership no enabled'); } diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 178af5fce11..24cdcf5c001 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -49,7 +49,7 @@ require '../../main.inc.php'; // Security check if (empty($conf->adherent->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Membership not enabled'); } diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 65c2faf7918..411a37d6284 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -81,13 +81,6 @@ $ref = $REF = GETPOST("ref", 'alpha'); if (empty($source)) { $source = 'proposal'; } - -if (!$action) { - if ($source && !$ref) { - print $langs->trans('ErrorBadParameters')." - ref missing"; - exit; - } -} if (!empty($refusepropal)) { $action = "refusepropal"; } @@ -123,15 +116,12 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last & $creditor = $mysoc->name; $type = $source; -if ($source == 'proposal') { - require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; - $object = new Propal($db); - $result= $object->fetch(0, $ref, '', $entity); -} else { - accessforbidden('Bad value for source'); - exit; -} +if (!$action) { + if ($source && !$ref) { + httponly_accessforbidden($langs->trans('ErrorBadParameters')." - ref missing", 400, 1); + } +} // Check securitykey $securekeyseed = ''; @@ -139,10 +129,16 @@ if ($source == 'proposal') { $securekeyseed = getDolGlobalString('PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN'); } -if (!dol_verifyHash($securekeyseed.$type.$ref.(!isModEnabled('multicompany') ? '' : $entity), $SECUREKEY, '0')) { - http_response_code(403); - print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref); - exit(-1); +if (!dol_verifyHash($securekeyseed.$type.$ref.(isModEnabled('multicompany') ? $entity : ''), $SECUREKEY, '0')) { + httponly_accessforbidden('Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref), 403, 1); +} + +if ($source == 'proposal') { + require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; + $object = new Propal($db); + $result= $object->fetch(0, $ref, '', $entity); +} else { + httponly_accessforbidden($langs->trans('ErrorBadParameters')." - Bad value for source", 400, 1); } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 4853eec496e..3450393b7b7 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -59,7 +59,7 @@ $canbemodified = ((empty($object->date_fin) || $object->date_fin > dol_now()) && // Security check if (empty($conf->opensurvey->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Survey not enabled'); } @@ -74,7 +74,7 @@ $listofvoters = explode(',', $_SESSION["savevoter"]); // Add comment if (GETPOST('ajoutcomment', 'alpha')) { if (!$canbemodified) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('ErrorForbidden'); } $error = 0; @@ -108,7 +108,7 @@ if (GETPOST('ajoutcomment', 'alpha')) { // Add vote if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) { // boutonp for chrome, boutonp_x for firefox if (!$canbemodified) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('ErrorForbidden'); } //Si le nom est bien entré @@ -214,7 +214,7 @@ if ($testmodifier) { } if (!$canbemodified) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('ErrorForbidden'); } $idtomodify = GETPOST("idtomodify".$modifier); @@ -232,7 +232,7 @@ if ($testmodifier) { $idcomment = GETPOST('deletecomment', 'int'); if ($idcomment) { if (!$canbemodified) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('ErrorForbidden'); } $resql = $object->deleteComment($idcomment); diff --git a/htdocs/public/partnership/new.php b/htdocs/public/partnership/new.php index a50892c9e08..f2706bf0bc9 100644 --- a/htdocs/public/partnership/new.php +++ b/htdocs/public/partnership/new.php @@ -71,12 +71,11 @@ $langs->loadLangs(array("main", "members", "partnership", "companies", "install" // Security check if (empty($conf->partnership->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Partnership not enabled'); } if (empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) { - print $langs->trans("Auto subscription form for public visitors has not been enabled"); - exit; + httponly_accessforbidden("Auto subscription form for public visitors has not been enabled"); } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index 606bed0c490..67ad99d46f3 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -108,7 +108,7 @@ if (!empty($conf->stripe->enabled)) { // Security check if (empty($validpaymentmethod)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('No valid payment mode'); } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 209e931a75b..fee0e801964 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -138,7 +138,7 @@ if (!empty($conf->stripe->enabled)) { // Security check if (empty($validpaymentmethod)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('No valid payment mode'); } diff --git a/htdocs/public/project/index.php b/htdocs/public/project/index.php index e5dfeb59a8e..6c8746152c4 100644 --- a/htdocs/public/project/index.php +++ b/htdocs/public/project/index.php @@ -84,7 +84,7 @@ if ($resultproject < 0) { // Security check if (empty($conf->project->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Project not enabled'); } diff --git a/htdocs/public/project/new.php b/htdocs/public/project/new.php index d984b3346d8..3241b6004ca 100644 --- a/htdocs/public/project/new.php +++ b/htdocs/public/project/new.php @@ -82,7 +82,7 @@ $user->loadDefaultValues(); // Security check if (empty($conf->project->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Project not enabled'); } diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 52193e4fcd4..0c11c82e13b 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -105,7 +105,7 @@ $arrayofconfboothtype = $cactioncomm->liste_array('', 'id', '', 0, "module='boot // Security check if (empty($conf->eventorganization->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Event organization not enabled'); } diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 05cc8e61a82..cfe5bb67fec 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -106,7 +106,7 @@ $arrayofconfboothtype = $cactioncomm->liste_array('', 'id', '', 0, "module='conf // Security check if (empty($conf->eventorganization->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Event organization not enabled'); } diff --git a/htdocs/public/project/viewandvote.php b/htdocs/public/project/viewandvote.php index 805eb8cfdd1..1c8d1208d1f 100644 --- a/htdocs/public/project/viewandvote.php +++ b/htdocs/public/project/viewandvote.php @@ -91,7 +91,7 @@ if ($resultproject < 0) { // Security check if (empty($conf->eventorganization->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Event organization not enabled'); } diff --git a/htdocs/public/recruitment/index.php b/htdocs/public/recruitment/index.php index 32585c94bb4..5ad954af906 100644 --- a/htdocs/public/recruitment/index.php +++ b/htdocs/public/recruitment/index.php @@ -80,7 +80,7 @@ $urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than curren // Security check if (empty($conf->recruitment->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Recruitment not enabled'); } diff --git a/htdocs/public/recruitment/view.php b/htdocs/public/recruitment/view.php index 2eaa51ac2fe..0875f33ebdd 100644 --- a/htdocs/public/recruitment/view.php +++ b/htdocs/public/recruitment/view.php @@ -77,7 +77,7 @@ $urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than curren // Security check if (empty($conf->recruitment->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Recruitment not enabled'); } diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 29e22c72de7..f1571557d83 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -49,11 +49,6 @@ require_once DOL_DOCUMENT_ROOT.'/includes/stripe/stripe-php/init.php'; require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; -if (empty($conf->stripe->enabled)) { - accessforbidden('', 0, 0, 1); -} - - // You can find your endpoint's secret in your webhook settings if (isset($_GET['connect'])) { if (isset($_GET['test'])) { @@ -77,10 +72,12 @@ if (isset($_GET['connect'])) { } } +if (empty($conf->stripe->enabled)) { + httponly_accessforbidden('Module Stripe not enabled'); +} + if (empty($endpoint_secret)) { - print 'Error: Setup of module Stripe not complete for mode '.$service.'. The WEBHOOK_KEY is not defined.'; - http_response_code(400); // PHP 5.4 or greater - exit(); + httponly_accessforbidden('Error: Setup of module Stripe not complete for mode '.dol_escape_htmltag($service).'. The WEBHOOK_KEY is not defined.', 400, 1); } if (!empty($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS)) { @@ -89,9 +86,7 @@ if (!empty($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS)) { $user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS); $user->getrights(); } else { - print 'Error: Setup of module Stripe not complete for mode '.$service.'. The STRIPE_USER_ACCOUNT_FOR_ACTIONS is not defined.'; - http_response_code(400); // PHP 5.4 or greater - exit(); + httponly_accessforbidden('Error: Setup of module Stripe not complete for mode '.dol_escape_htmltag($service).'. The STRIPE_USER_ACCOUNT_FOR_ACTIONS is not defined.', 400, 1); } @@ -113,12 +108,9 @@ try { $event = \Stripe\Webhook::constructEvent($payload, $sig_header, $endpoint_secret); } catch (\UnexpectedValueException $e) { // Invalid payload - http_response_code(400); // PHP 5.4 or greater - exit(); + httponly_accessforbidden('Invalid payload', 400); } catch (\Stripe\Error\SignatureVerification $e) { - // Invalid signature - http_response_code(400); // PHP 5.4 or greater - exit(); + httponly_accessforbidden('Invalid signature', 400); } // Do something with $event @@ -155,6 +147,7 @@ if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { $societeName = $conf->global->MAIN_APPLICATION_TITLE; } +top_httphead(); dol_syslog("***** Stripe IPN was called with event->type = ".$event->type); @@ -195,11 +188,10 @@ if ($event->type == 'payout.created') { $ret = $mailfile->sendfile(); - http_response_code(200); // PHP 5.4 or greater return 1; } else { $error++; - http_response_code(500); // PHP 5.4 or greater + http_response_code(500); return -1; } } elseif ($event->type == 'payout.paid') { @@ -287,7 +279,6 @@ if ($event->type == 'payout.created') { $ret = $mailfile->sendfile(); - http_response_code(200); return 1; } else { $error++; @@ -396,4 +387,4 @@ if ($event->type == 'payout.created') { // This event is deprecated. } -http_response_code(200); +// End of page. Default return HTTP code will be 200 diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 7ebbdb05af3..59f12a64482 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -91,7 +91,7 @@ if (!empty($conf->global->TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST)) $extrafields->fetch_name_optionals_label($object->table_element); if (empty($conf->ticket->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Ticket not enabled'); } diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 6332f063541..ae9b281900e 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -59,7 +59,7 @@ $action = GETPOST('action', 'aZ09'); $suffix = ""; if (empty($conf->ticket->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Ticket not enabled'); } diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 7af60f50e83..5730ac424df 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -79,7 +79,7 @@ $object = new Ticket($db); $hookmanager->initHooks(array('ticketpubliclist', 'globalcard')); if (empty($conf->ticket->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Ticket not enabled'); } diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index de76e2f9904..d46944ebd82 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -73,7 +73,7 @@ if (isset($_SESSION['email_customer'])) { $object = new ActionsTicket($db); if (empty($conf->ticket->enabled)) { - accessforbidden('', 0, 0, 1); + httponly_accessforbidden('Module Ticket not enabled'); } diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 92c7efb63d9..fccb1ae3044 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -92,7 +92,9 @@ if ($user->socid > 0) { } $result = restrictedArea($user, 'societe', $object->id, '&societe'); -$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles +if (empty($object->id)) { + accessforbidden(); +} /* @@ -115,88 +117,80 @@ if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url); -if ($object->id) { - /* - * Show tabs - */ - if (!empty($conf->notification->enabled)) { - $langs->load("mails"); - } - $head = societe_prepare_head($object); - - $form = new Form($db); - - print dol_get_fiche_head($head, 'document', $langs->trans("ThirdParty"), -1, 'company'); - - - // Build file list - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); - $totalsize = 0; - foreach ($filearray as $key => $file) { - $totalsize += $file['size']; - } - - $linkback = ''.$langs->trans("BackToList").''; - - dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); - - print '
'; - - print '
'; - print ''; - - // Type Prospect/Customer/Supplier - print ''; - - // Prefix - if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field - print ''; - } - - if ($object->client) { - print ''; - } - - if ($object->fournisseur) { - print ''; - } - - // Number of files - print ''; - - // Total size - print ''; - - print '
'.$langs->trans('NatureOfThirdParty').''; - print $object->getTypeUrl(1); - print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; - print $langs->trans('CustomerCode').''; - print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); - $tmpcheck = $object->check_codeclient(); - if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongCustomerCode").')'; - } - print '
'; - print $langs->trans('SupplierCode').''; - print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); - $tmpcheck = $object->check_codefournisseur(); - if ($tmpcheck != 0 && $tmpcheck != -5) { - print ' ('.$langs->trans("WrongSupplierCode").')'; - } - print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; - - print '
'; - - print dol_get_fiche_end(); - - $modulepart = 'societe'; - $permissiontoadd = $user->rights->societe->creer; - $permtoedit = $user->rights->societe->creer; - $param = '&id='.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} else { - accessforbidden('', 0, 0); +// Show tabs +if (!empty($conf->notification->enabled)) { + $langs->load("mails"); } +$head = societe_prepare_head($object); + +print dol_get_fiche_head($head, 'document', $langs->trans("ThirdParty"), -1, 'company'); + + +// Build file list +$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); +$totalsize = 0; +foreach ($filearray as $key => $file) { + $totalsize += $file['size']; +} + +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); + +print '
'; + +print '
'; +print ''; + +// Type Prospect/Customer/Supplier +print ''; + +// Prefix +if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field + print ''; +} + +if ($object->client) { + print ''; +} + +if ($object->fournisseur) { + print ''; +} + +// Number of files +print ''; + +// Total size +print ''; + +print '
'.$langs->trans('NatureOfThirdParty').''; +print $object->getTypeUrl(1); +print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; + print $langs->trans('CustomerCode').''; + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client)); + $tmpcheck = $object->check_codeclient(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongCustomerCode").')'; + } + print '
'; + print $langs->trans('SupplierCode').''; + print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur)); + $tmpcheck = $object->check_codefournisseur(); + if ($tmpcheck != 0 && $tmpcheck != -5) { + print ' ('.$langs->trans("WrongSupplierCode").')'; + } + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; + +print '
'; + +print dol_get_fiche_end(); + +$modulepart = 'societe'; +$permissiontoadd = $user->rights->societe->creer; +$permtoedit = $user->rights->societe->creer; +$param = '&id='.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; // End of page llxFooter(); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 12b2a52742d..cb61ab6c1b1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -753,7 +753,7 @@ class User extends CommonObject //var_dump($module); //var_dump($this->rights->$rightsPath); //var_dump($conf->modules); - if (!in_array($module, $conf->modules)) { + if (!isModEnabled($module)) { return 0; } diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index f297fed62b4..3b1d60e0e90 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -138,10 +138,10 @@ $entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; // Security check if (empty($modulepart) && empty($hashp)) { - accessforbidden('Bad link. Bad value for parameter modulepart', 0, 0, 1); + httponly_accessforbidden('Bad link. Bad value for parameter modulepart', 400); } if (empty($original_file) && empty($hashp) && $modulepart != 'barcode') { - accessforbidden('Bad link. Missing identification to find file (param file or hashp)', 0, 0, 1); + httponly_accessforbidden('Bad link. Missing identification to find file (param file or hashp)', 400); } if ($modulepart == 'fckeditor') { $modulepart = 'medias'; // For backward compatibility @@ -192,7 +192,7 @@ if (!empty($hashp)) { $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir //var_dump($original_file); exit; } else { - accessforbidden('Bad link. File is from another module part.', 0, 0, 1); + httponly_accessforbidden('Bad link. File is from another module part.', 403); } } else { $modulepart = $moduleparttocheck; @@ -200,7 +200,7 @@ if (!empty($hashp)) { } } else { $langs->load("errors"); - accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1); + httponly_accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 403, 1); } } @@ -214,11 +214,11 @@ if (GETPOST('type', 'alpha')) { // Security: This wrapper is for images. We do not allow type/html if (preg_match('/html/i', $type)) { - accessforbidden('Error: Using the image wrapper to output a file with a mime type HTML is not possible.', 0, 0, 1); + httponly_accessforbidden('Error: Using the image wrapper to output a file with a mime type HTML is not possible.'); } // Security: This wrapper is for images. We do not allow files ending with .noexe if (preg_match('/\.noexe$/i', $original_file)) { - accessforbidden('Error: Using the image wrapper to output a file ending with .noexe is not allowed.', 0, 0, 1); + httponly_accessforbidden('Error: Using the image wrapper to output a file ending with .noexe is not allowed.'); } // Security: Delete string ../ or ..\ into $original_file @@ -231,12 +231,12 @@ $refname = basename(dirname($original_file)."/"); // Check that file is allowed for view with viewimage.php if (!empty($original_file) && !dolIsAllowedForPreview($original_file)) { - accessforbidden('This file is not qualified for preview', 0, 0, 1); + httponly_accessforbidden('This file is not qualified for preview', 403); } // Security check if (empty($modulepart)) { - accessforbidden('Bad value for parameter modulepart', 0, 0, 1); + httponly_accessforbidden('Bad value for parameter modulepart', 400); } // When logged in a different entity, medias cannot be accessed because $conf->$module->multidir_output diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index 2b79fd3fced..a2251d7d4a9 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -191,7 +191,7 @@ llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { if (empty($permissiontoadd)) { - accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1); + accessforbidden('NotEnoughPermissions', 0, 1); exit; } From f60ea48d75c6dd9a7421cbe7642445ae0e9a68c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 14:02:55 +0200 Subject: [PATCH 374/453] Update doc --- COPYRIGHT | 1 + 1 file changed, 1 insertion(+) diff --git a/COPYRIGHT b/COPYRIGHT index 83d054d63be..8c8a1f56355 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -33,6 +33,7 @@ PEAR Mail_MIME 1.8.9 BSD Yes ParseDown 1.6 MIT License Yes Markdown parser PCLZip 2.8.4 LGPL-3+ Yes Library to zip/unzip files PHPDebugBar 1.15.1 MIT License Yes Used only by the module "debugbar" for developers +PHP-Imap 2.7.2 MIT License Yes Library to use IMAP with OAuth PHPSpreadSheet 1.8.2 LGPL-2.1+ Yes Read/Write XLS files, read ODS files php-iban 4.1 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP PHPoAuthLib 0.8.2 MIT License Yes Library to provide oauth1 and oauth2 to different service From 26ad6199e55d56a22ccf43f4693aa3732271bd64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Sep 2022 15:33:55 +0200 Subject: [PATCH 375/453] NEW The purge of iles can purge only if older than a number of seconds --- htdocs/admin/tools/purge.php | 15 ++++++++---- htdocs/core/class/utils.class.php | 36 +++++++++++++++++++---------- htdocs/core/lib/files.lib.php | 38 +++++++++++++++++-------------- 3 files changed, 55 insertions(+), 34 deletions(-) diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index f6ce58a40c0..4b31d98490e 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -33,7 +33,7 @@ $langs->load("admin"); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $choice = GETPOST('choice', 'aZ09'); - +$nbsecondsold = GETPOSTINT('nbsecondsold'); // Define filelog to discard it from purge $filelog = ''; @@ -42,6 +42,7 @@ if (!empty($conf->syslog->enabled)) { $filelog = preg_replace('/DOL_DATA_ROOT/i', DOL_DATA_ROOT, $filelog); } +// Security if (!$user->admin) { accessforbidden(); } @@ -64,7 +65,8 @@ if ($action == 'purge' && !preg_match('/^confirm/i', $choice) && ($choice != 'al require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php'; $utils = new Utils($db); - $result = $utils->purgeFiles($choice); + + $result = $utils->purgeFiles($choice, $nbsecondsold); $mesg = $utils->output; setEventMessages($mesg, null, 'mesgs'); @@ -114,8 +116,11 @@ print '>