From 8aabe1efb7874efac9c7fa2c3374baf7d8205ea4 Mon Sep 17 00:00:00 2001 From: noec764 <58433943+noec764@users.noreply.github.com> Date: Tue, 21 Oct 2025 02:16:49 +0200 Subject: [PATCH 01/15] Fix load all line unecessary (#35783) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FIX: Unecessary load of all order lines * FIX: Unecessary load of all order lines * FIX: Tabs indent instead of space --------- Co-authored-by: Noé --- htdocs/commande/list_det.php | 58 ++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index 00b43fbfe59..21ba3a490d2 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -384,37 +384,41 @@ $title = $langs->trans("Orders"); $help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes"; // llxHeader('',$title,$help_url); -$sql = 'SELECT'; -if ($search_all || $search_product_category_array > 0 || $search_user > 0) { - $sql = 'SELECT DISTINCT'; +$sql = ''; +$sqlSelect = 'SELECT'; + +if ($search_all || !empty($search_product_category_array) || $search_user > 0) { + $sqlSelect = 'SELECT DISTINCT'; } -$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; -$sql .= " typent.code as typent_code,"; -$sql .= " state.code_departement as state_code, state.nom as state_name,"; -$sql .= " country.code as country_code,"; -$sql .= ' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,'; -$sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,'; -$sql .= ' c.total_ht as c_total_ht, c.total_tva as c_total_tva, c.total_ttc as c_total_ttc, c.fk_warehouse as warehouse,'; -$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as delivery_date, c.fk_statut, c.facture as billed,'; -$sql .= ' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,'; -$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; -$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; -$sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,'; -$sql .= ' c.fk_input_reason, c.import_key,'; +$sqlSelect .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,'; +$sqlSelect .= " typent.code as typent_code,"; +$sqlSelect .= " state.code_departement as state_code, state.nom as state_name,"; +$sqlSelect .= " country.code as country_code,"; +$sqlSelect .= ' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,'; +$sqlSelect .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,'; +$sqlSelect .= ' c.total_ht as c_total_ht, c.total_tva as c_total_tva, c.total_ttc as c_total_ttc, c.fk_warehouse as warehouse,'; +$sqlSelect .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as delivery_date, c.fk_statut, c.facture as billed,'; +$sqlSelect .= ' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,'; +$sqlSelect .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,'; +$sqlSelect .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,'; +$sqlSelect .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,'; +$sqlSelect .= ' c.fk_input_reason, c.import_key,'; // Lines or order -$sql .= ' cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc,'; -$sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; +$sqlSelect .= ' cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc,'; +$sqlSelect .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy'; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); + $sqlSelect .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } + // Add fields from hooks $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.'societe as s'; +$sqlSelect .= $hookmanager->resPrint; + +$sql = ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; @@ -672,8 +676,13 @@ $sql .= $db->order($sortfield, $sortorder); // Count total nb of records $nbtotalofrecords = ''; if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); + $result = $db->query('SELECT COUNT(*) as numrows ' . $sql); + $obj = $db->fetch_object($result); + if (empty($obj)) { + $nbtotalofrecords = 0; + } else { + $nbtotalofrecords = $obj->numrows; + } if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; @@ -683,8 +692,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { $sql .= $db->plimit($limit + 1, $offset); //print $sql; - -$resql = $db->query($sql); +$resql = $db->query($sqlSelect . $sql); if ($resql) { if ($socid > 0) { $soc = new Societe($db); From 4d88608f1f07e5040c2777f71a17cee7fb677cb4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Oct 2025 00:50:34 +0200 Subject: [PATCH 02/15] FIX check if zip file of website exists (#35879) --- htdocs/website/class/website.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 9751b464045..3db29e26907 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1282,6 +1282,11 @@ class Website extends CommonObject $error = 0; $pathtofile = dol_sanitizePathName($pathtofile); + if (!file_exists($pathtofile)) { + $this->error = 'The zip file "'.$pathtofile.'" is not found'; + return -9; + } + $object = $this; if (empty($object->ref)) { $this->error = 'Function importWebSite called on object not loaded (object->ref is empty)'; From c80858e71285362dd7f0d0b73817d70a08653163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 22 Oct 2025 00:51:20 +0200 Subject: [PATCH 03/15] fix CI branch v21 (#35876) * fix CI * add same fix than in develop --- .github/workflows/ci-on-pull_request.yml | 18 +++++++++--------- htdocs/core/class/CMailFile.class.php | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-on-pull_request.yml b/.github/workflows/ci-on-pull_request.yml index 4e118d8bff9..201e91cb8c6 100644 --- a/.github/workflows/ci-on-pull_request.yml +++ b/.github/workflows/ci-on-pull_request.yml @@ -25,15 +25,15 @@ jobs: # uses: ./.github/workflows/windows-ci.yml # with: # gh_event: ${{ github.event_name }} - gh-travis: # Runs travis script on github runner (not on travis) - if: false - # needs: [pre-commit, phan] - # needs: [windows-ci] - secrets: inherit - needs: [pre-commit, phan, phpstan] - uses: ./.github/workflows/gh-travis.yml - with: - gh_event: ${{ github.event_name }} + #gh-travis: # Runs travis script on github runner (not on travis) + # if: false + # # needs: [pre-commit, phan] + # # needs: [windows-ci] + # secrets: inherit + # needs: [pre-commit, phan, phpstan] + # uses: ./.github/workflows/gh-travis.yml + # with: + # gh_event: ${{ github.event_name }} # Note (not tested, from https://github.com/orgs/community/discussions/38361) # To cancel jobs if one fails, the following action may help diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 89a3b921328..bc812485d2f 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1863,6 +1863,7 @@ class CMailFile } // Skip files that have a CID (they will be added as inline images instead) + // @phpstan-ignore-next-line if (!empty($cidlist) && is_array($cidlist) && isset($cidlist[$i]) && $cidlist[$i] !== null && $cidlist[$i] !== '') { continue; // Skip this file as it will be processed as inline image } From 111dcd174fbff6c9566de6503446705070050d0f Mon Sep 17 00:00:00 2001 From: Florian Mortgat <50440633+atm-florianm@users.noreply.github.com> Date: Wed, 22 Oct 2025 00:56:01 +0200 Subject: [PATCH 04/15] FIX: no emails sent when closing a ticket (#35874) --- .../core/triggers/interface_50_modTicket_TicketEmail.class.php | 2 +- htdocs/ticket/card.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 1e5e81f38f6..39cee230d3e 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -276,7 +276,7 @@ class InterfaceTicketEmail extends DolibarrTriggers // Refuse email if not $contactObj = new Contact($this->db); $res = $contactObj->fetch($contactid); - if (! in_array($contactObj, $linked_contacts)) { + if (! in_array($contactObj->id, array_column($linked_contacts, 'id'))) { $error_msg = $langs->trans('Error'). ': '; $error_msg .= $langs->transnoentities('TicketWrongContact'); setEventMessages($error_msg, [], 'errors'); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 4a238b15cf7..4e6555eaff1 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -451,6 +451,9 @@ if (empty($reshook)) { if (($action == "confirm_close" || $action == "confirm_abandon") && GETPOST('confirm', 'alpha') == 'yes' && $permissiontoadd) { $object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha')); + if (GETPOSTISSET('contactid')) { + $object->context['contactid'] = GETPOSTINT('contactid'); + } if ($object->close($user, ($action == "confirm_abandon" ? 1 : 0))) { setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs'); From c04359f99579cd17d3bc38834012deb764c99f6c Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 22 Oct 2025 00:56:57 +0200 Subject: [PATCH 05/15] FIX missing entity filters + wrong widget name (#35873) --- htdocs/admin/boxes.php | 2 +- htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php | 3 ++- htdocs/core/boxes/box_graph_nb_tickets_type.php | 6 ++++-- htdocs/core/boxes/box_graph_ticket_by_severity.php | 8 +++++--- htdocs/core/modules/modTicket.class.php | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 07f6779fd90..017a355d527 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -238,7 +238,7 @@ $sql .= " bd.rowid as boxid"; $sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd"; $sql .= " WHERE b.box_id = bd.rowid"; $sql .= " AND b.entity IN (0,".$conf->entity.")"; -$sql .= " AND b.fk_user=0"; +$sql .= " AND b.fk_user = 0"; $sql .= " ORDER by b.position, b.box_order"; //print $sql; diff --git a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php index 55ba0451351..6fad3295598 100644 --- a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php +++ b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php @@ -109,7 +109,8 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes if ($user->hasRight('ticket', 'read')) { $sql = "SELECT CAST(t.datec AS DATE) as datec, COUNT(t.datec) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; - $sql .= " WHERE CAST(t.datec AS DATE) > '".$this->db->idate($minimumdatec)."'"; + $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; + $sql .= " AND CAST(t.datec AS DATE) > '".$this->db->idate($minimumdatec)."'"; $sql .= " GROUP BY CAST(t.datec AS DATE)"; $resql = $this->db->query($sql); diff --git a/htdocs/core/boxes/box_graph_nb_tickets_type.php b/htdocs/core/boxes/box_graph_nb_tickets_type.php index adbf831c989..09e2b543cdb 100644 --- a/htdocs/core/boxes/box_graph_nb_tickets_type.php +++ b/htdocs/core/boxes/box_graph_nb_tickets_type.php @@ -84,7 +84,8 @@ class box_graph_nb_tickets_type extends ModeleBoxes if ($user->hasRight('ticket', 'read')) { $sql = "SELECT ctt.rowid, ctt.label, ctt.code"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_ticket_type as ctt"; - $sql .= " WHERE ctt.active = 1"; + $sql .= " WHERE ctt.entity IN (".getEntity('c_ticket_type').")"; + $sql .= " AND ctt.active = 1"; $sql .= $this->db->order('ctt.rowid', 'ASC'); $resql = $this->db->query($sql); @@ -116,7 +117,8 @@ class box_graph_nb_tickets_type extends ModeleBoxes $data = array(); $sql = "SELECT t.type_code, COUNT(t.type_code) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; - $sql .= " WHERE t.fk_statut <> 8"; + $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; + $sql .= " AND t.fk_statut <> 8"; $sql .= " GROUP BY t.type_code"; $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php index e45e114cc73..e168aaf3ed2 100644 --- a/htdocs/core/boxes/box_graph_ticket_by_severity.php +++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; */ class box_graph_ticket_by_severity extends ModeleBoxes { - public $boxcode = "box_ticket_by_severity"; + public $boxcode = "box_graph_ticket_by_severity"; public $boximg = "ticket"; /** * @var string @@ -96,7 +96,8 @@ class box_graph_ticket_by_severity extends ModeleBoxes if ($user->hasRight('ticket', 'read')) { $sql = "SELECT cts.rowid, cts.label, cts.code"; $sql .= " FROM " . MAIN_DB_PREFIX . "c_ticket_severity as cts"; - $sql .= " WHERE cts.active = 1"; + $sql .= " WHERE cts.entity IN (".getEntity('c_ticket_severity').")"; + $sql .= " AND cts.active = 1"; $sql .= $this->db->order('cts.rowid', 'ASC'); $resql = $this->db->query($sql); @@ -133,7 +134,8 @@ class box_graph_ticket_by_severity extends ModeleBoxes $data = array(); $sql = "SELECT t.severity_code, COUNT(t.severity_code) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t"; - $sql .= " WHERE t.fk_statut <> 8"; + $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; + $sql .= " AND t.fk_statut <> 8"; $sql .= " GROUP BY t.severity_code"; $resql = $this->db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 3560fbea5ef..6c8079649eb 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -211,7 +211,7 @@ class modTicket extends DolibarrModules $this->boxes = array( 0 => array('file' => 'box_last_ticket.php', 'enabledbydefaulton' => 'Home'), 1 => array('file' => 'box_last_modified_ticket.php', 'enabledbydefaulton' => 'Home'), - 2 => array('file' => 'box_ticket_by_severity.php', 'enabledbydefaulton' => 'ticketindex'), + 2 => array('file' => 'box_graph_ticket_by_severity.php', 'enabledbydefaulton' => 'ticketindex'), 3 => array('file' => 'box_graph_nb_ticket_last_x_days.php', 'enabledbydefaulton' => 'ticketindex'), 4 => array('file' => 'box_graph_nb_tickets_type.php', 'enabledbydefaulton' => 'ticketindex'), 5 => array('file' => 'box_new_vs_close_ticket.php', 'enabledbydefaulton' => 'ticketindex') From 7aa9633901979c742093b401107fd023f0d6e97b Mon Sep 17 00:00:00 2001 From: VIAL-GOUTEYRON Quentin Date: Wed, 22 Oct 2025 00:58:55 +0200 Subject: [PATCH 06/15] FIX : Perf for bom select (#35871) * ADD: Option to optimize BOM combo list performance with search-based loading * FIX: Remove debug backtrace and exit statement in security.lib.php * FIX: Use dynamic database prefix in BOM combo list query * FIX: Correct spacing issue in 'elseif' condition in bom.php --- htdocs/admin/bom.php | 34 +++++++++++++++++++++++++++ htdocs/admin/system/perf.php | 23 +++++++++++++++++- htdocs/core/ajax/selectobject.php | 3 ++- htdocs/core/class/html.form.class.php | 3 ++- htdocs/langs/en_US/mrp.lang | 1 + htdocs/langs/fr_FR/mrp.lang | 1 + 6 files changed, 62 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index ae657998bba..0ae647ef7b6 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -171,6 +171,13 @@ if ($action == 'updateMask') { } else { setEventMessages($langs->trans("Error"), null, 'errors'); } +} elseif ($action == 'updateoptions') { + if (GETPOST('BOM_USE_SEARCH_TO_SELECT')) { + $bomsearch = GETPOST('activate_BOM_USE_SEARCH_TO_SELECT', 'alpha'); + if (dolibarr_set_const($db, "BOM_USE_SEARCH_TO_SELECT", $bomsearch, 'chaine', 0, '', $conf->entity)) { + $conf->global->BOM_USE_SEARCH_TO_SELECT = $bomsearch; + } + } } @@ -463,6 +470,31 @@ print ''; print " \n"; print "\n"; + +print ''; +print '
'; +print ''; +print ''; +print ''.$langs->trans("UseSearchToSelectBom").''; +if (!$conf->use_javascript_ajax) { + print ''; + print ''; + print $langs->trans("NotAvailableWhenAjaxDisabled"); + print ""; +} else { + print ''; + $arrval = array('0' => $langs->trans("No"), + '1' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', + '2' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')', + '3' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')', + ); + print $form->selectarray("activate_BOM_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalString("BOM_USE_SEARCH_TO_SELECT")).''; + print ''; + print ""; +} +print '
'; +print ''; + $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; @@ -508,6 +540,8 @@ print ''; print '
'; + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index 61a91db6d66..27fc69bfc4c 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; */ // Load translation files required by the page -$langs->loadLangs(array("install", "other", "admin", "products")); +$langs->loadLangs(array("install", "other", "admin", "products", "mrp")); if (!$user->admin) { accessforbidden(); @@ -614,6 +614,27 @@ if ($resql) { print '
'; $db->free($resql); } +// Bom combo list +$sql = "SELECT COUNT(*) as nb"; +$sql .= " FROM ".$db->prefix()."bom_bom as s"; +$resql = $db->query($sql); +if ($resql) { + $limitforoptim = 5000; + $num = $db->num_rows($resql); + $obj = $db->fetch_object($resql); + $nb = $obj->nb; + if ($nb > $limitforoptim) { + if (!getDolGlobalString('BOM_USE_SEARCH_TO_SELECT')) { + print img_picto('', 'warning.png', 'class="pictofixedwidth"').' '.$langs->trans("YouHaveXObjectUseComboOptim", $nb, $langs->transnoentitiesnoconv("Bom"), 'BOM_USE_SEARCH_TO_SELECT'); + } else { + print img_picto('', 'tick.png', 'class="pictofixedwidth"').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("Bom"), 'BOM_USE_SEARCH_TO_SELECT', getDolGlobalString('BOM_USE_SEARCH_TO_SELECT')); + } + } else { + print img_picto('', 'tick.png', 'class="pictofixedwidth"').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("Bom")); + } + print '
'; + $db->free($resql); +} print ''; diff --git a/htdocs/core/ajax/selectobject.php b/htdocs/core/ajax/selectobject.php index 0176203b55a..f00e5785c2a 100644 --- a/htdocs/core/ajax/selectobject.php +++ b/htdocs/core/ajax/selectobject.php @@ -147,7 +147,8 @@ if ($usesublevelpermission && !isset($user->rights->$module->$element)) { // The $searchkey = (($id && GETPOST((string) $id, 'alpha')) ? GETPOST((string) $id, 'alpha') : (($htmlname && GETPOST($htmlname, 'alpha')) ? GETPOST($htmlname, 'alpha') : '')); // Add a security test to avoid to get content of all tables -if ($objecttmp !== null && !empty($objecttmp->module)) { +$allowModules = ['bom']; +if ($objecttmp !== null && !empty($objecttmp->module) && !in_array($objecttmp->module, $allowModules)) { restrictedArea($user, $objecttmp->module, $id, $objecttmp->table_element, $objecttmp->element); } else { restrictedArea($user, $objecttmp !== null ? $objecttmp->element : '', $id); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e69a0eb0bdc..a01fd60f567 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2989,7 +2989,7 @@ class Form if (!$forcecombo) { include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; $events = array(); - $out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT")); + $out .= ajax_combobox($htmlname, $events, getDolGlobalInt("BOM_USE_SEARCH_TO_SELECT")); } $out .= ''; print ''; + print '
'; print ''; print ''; @@ -793,6 +794,7 @@ if ($id > 0 || !empty($ref)) { } print '
'; + print '
'; /*if($user->rights->produit->creer || $user->hasRight('service', 'creer')) { print '';