diff --git a/htdocs/admin/ticket_public.php b/htdocs/admin/ticket_public.php index 1f32fec97aa..2bd16271650 100644 --- a/htdocs/admin/ticket_public.php +++ b/htdocs/admin/ticket_public.php @@ -379,6 +379,20 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) { print ''; print ''; + // Show progression + print ''.$langs->trans("TicketsShowProgression").''; + print ''; + if (empty(getDolGlobalInt('TICKET_SHOW_PROGRESSION'))) { + print '' . img_picto($langs->trans('Disabled'), 'switch_off') . ''; + } else { + print '' . img_picto($langs->trans('Enabled'), 'switch_on') . ''; + } + print ''; + print ''; + print $form->textwithpicto('', $langs->trans("TicketsShowProgressionHelp"), 1, 'help'); + print ''; + print ''; + // Also send to main email address if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ''.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index cec7408f1ca..5b8cc47a6d1 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1582,7 +1582,7 @@ abstract class CommonDocGenerator $colDef['title']['label'] = !empty($colDef['title']['label']) ? $colDef['title']['label'] : $outputlangs->transnoentities($colDef['title']['textkey']); // Add column separator - if (!empty($colDef['border-left'])) { + if (!empty($colDef['border-left']) && isset($colDef['xStartPos'])) { $pdf->line($colDef['xStartPos'], $tab_top, $colDef['xStartPos'], $tab_top + $tab_height); } diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 3630d137136..2965db0f7c5 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -49,6 +49,11 @@ class Menubase */ public $id; + /** + * @var int Entity + */ + public $entity; + /** * @var string Menu handler */ @@ -185,6 +190,7 @@ class Menubase if (!isset($this->enabled)) { $this->enabled = '1'; } + $this->entity = (isset($this->entity) && (int) $this->entity >= 0 ? (int) $this->entity : $conf->entity); $this->menu_handler = trim((string) $this->menu_handler); $this->module = trim((string) $this->module); $this->type = trim((string) $this->type); @@ -246,7 +252,7 @@ class Menubase $sql .= " AND fk_menu = ".((int) $this->fk_menu); $sql .= " AND position = ".((int) $this->position); $sql .= " AND url = '".$this->db->escape($this->url)."'"; - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity IN (0, ".$conf->entity.")"; $result = $this->db->query($sql); if ($result) { @@ -275,7 +281,7 @@ class Menubase $sql .= "usertype"; $sql .= ") VALUES ("; $sql .= " '".$this->db->escape($this->menu_handler)."',"; - $sql .= " '".$this->db->escape($conf->entity)."',"; + $sql .= " '".$this->db->escape($this->entity)."',"; $sql .= " '".$this->db->escape($this->module)."',"; $sql .= " '".$this->db->escape($this->type)."',"; $sql .= " ".($this->mainmenu ? "'".$this->db->escape($this->mainmenu)."'" : "''").","; // Can't be null diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 6c43c945b65..62dbd494082 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1986,7 +1986,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it public function insert_menus() { // phpcs:enable - global $user; + global $conf, $user; if (!is_array($this->menu) || empty($this->menu)) { return 0; @@ -1998,6 +1998,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $err = 0; + // Common module + $entity = ((!empty($this->always_enabled) || !empty($this->core_enabled)) ? 0 : $conf->entity); + $this->db->begin(); foreach ($this->menu as $key => $value) { @@ -2049,6 +2052,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $menu->user = $this->menu[$key]['user']; $menu->enabled = isset($this->menu[$key]['enabled']) ? $this->menu[$key]['enabled'] : 0; $menu->position = $this->menu[$key]['position']; + $menu->entity = $entity; if (!$err) { $result = $menu->create($user); // Save menu entry into table llx_menu @@ -2092,7 +2096,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu"; $sql .= " WHERE module = '".$this->db->escape($module)."'"; - $sql .= " AND entity = ".$conf->entity; + $sql .= " AND entity IN (0, ".$conf->entity.")"; dol_syslog(get_class($this)."::delete_menus", LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 570e7c127aa..cb261bbc378 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -103,6 +103,8 @@ TicketNewEmailBodyHelp=The text specified here will be inserted into the email c TicketParamPublicInterface=Public interface setup TicketsEmailMustExist=Require an existing email address to create a ticket TicketsEmailMustExistHelp=In the public interface, the email address should already be filled in the database to create a new ticket. +TicketsShowProgression=Display the ticket progress in the public interface +TicketsShowProgressionHelp=Enable this option to hide the progress of the ticket in the public interface pages TicketCreateThirdPartyWithContactIfNotExist=Ask name and company name for unknown emails. TicketCreateThirdPartyWithContactIfNotExistHelp=Check if a thirdparty or a contact exists for the email entered. If not, ask a name and a company name to create a third party with contact. PublicInterface=Public interface diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index beb84f3e455..f9ea6b54beb 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -865,6 +865,28 @@ class FormProduct // clear cache $this->cache_lot = array(); $productIdList = implode(',', $productIdArray); + + $batch_count = 0; + global $hookmanager; + if (empty($hookmanager)) { + include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($this->db); + } + $hookmanager->initHooks(array('productdao')); + $parameters = array('productIdList' => $productIdList); + $reshook = $hookmanager->executeHooks('loadLotStock', $parameters, $this); + if ($reshook < 0) { + $this->error = $hookmanager->error; + return -1; + } + if (!empty($hookmanager->resArray['batch_list']) && is_array($hookmanager->resArray['batch_list'])) { + $this->cache_lot = $hookmanager->resArray['batch_list']; + $batch_count = (int) $hookmanager->resArray['batch_count']; + } + if ($reshook > 0) { + return $batch_count; + } + $sql = "SELECT pb.batch, pb.rowid, ps.fk_entrepot, pb.qty, e.ref as label, ps.fk_product"; $sql .= " FROM ".$this->db->prefix()."product_batch as pb"; $sql .= " LEFT JOIN ".$this->db->prefix()."product_stock as ps on ps.rowid = pb.fk_product_stock"; @@ -889,7 +911,7 @@ class FormProduct $i++; } - return $num; + return $batch_count + $num; } else { dol_print_error($this->db); return -1; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index f7ad050df96..c0835829e6f 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -257,6 +257,9 @@ if ($action == "view_ticketlist") { //'t.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), ); + if (empty($conf->global->TICKET_SHOW_PROGRESSION)) + unset($arrayfields['t.progress']); + // Extra fields if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { @@ -340,7 +343,8 @@ if ($action == "view_ticketlist") { $sql .= " t.message,"; $sql .= " t.fk_statut,"; $sql .= " t.resolution,"; - $sql .= " t.progress,"; + if (!empty($conf->global->TICKET_SHOW_PROGRESSION)) + $sql .= " t.progress,"; $sql .= " t.timing,"; $sql .= " t.type_code,"; $sql .= " t.category_code,"; @@ -470,7 +474,7 @@ if ($action == "view_ticketlist") { print ''; } - if (!empty($arrayfields['t.progress']['checked'])) { + if ((!empty($conf->global->TICKET_SHOW_PROGRESSION)) && !empty($arrayfields['t.progress']['checked'])) { print ''; } @@ -535,7 +539,7 @@ if ($action == "view_ticketlist") { if (!empty($arrayfields['severity.code']['checked'])) { print_liste_field_titre($arrayfields['severity.code']['label'], $url_page_current, 'severity.code', '', $param, '', $sortfield, $sortorder); } - if (!empty($arrayfields['t.progress']['checked'])) { + if ((!empty($conf->global->TICKET_SHOW_PROGRESSION)) && !empty($arrayfields['t.progress']['checked'])) { print_liste_field_titre($arrayfields['t.progress']['label'], $url_page_current, 't.progress', '', $param, '', $sortfield, $sortorder); } if (!empty($arrayfields['t.fk_user_create']['checked'])) { @@ -627,7 +631,7 @@ if ($action == "view_ticketlist") { } // Progression - if (!empty($arrayfields['t.progress']['checked'])) { + if ((!empty($conf->global->TICKET_SHOW_PROGRESSION)) && !empty($arrayfields['t.progress']['checked'])) { print ''; print $obj->progress; print ''; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 3364a3b7850..12b319b7589 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -331,9 +331,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print ''; // Progression - print ''.$langs->trans("Progression").''; - print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%'; - print ''; + if (!empty($conf->global->TICKET_SHOW_PROGRESSION)) { + print ''.$langs->trans("Progression").''; + print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%'; + print ''; + } // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index f2aeecec444..464a127ce15 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -87,7 +87,7 @@ if (!isModEnabled('mailing')) { print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; if (!empty($conf->global->MAILING_DELAY)) { - print 'A delay of '.((float) $conf->global->MAILING_DELAY * 1000000).' seconds has been set between each email'."\n"; + print 'A delay of '.((float) $conf->global->MAILING_DELAY).' seconds has been set between each email'."\n"; } if ($conf->global->MAILING_LIMIT_SENDBYCLI == '-1') {