Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2023-03-31 02:55:01 +02:00
commit 0c30a423ab
9 changed files with 68 additions and 14 deletions

View File

@ -379,6 +379,20 @@ if (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
print '</td>';
print '</tr>';
// Show progression
print '<tr class="oddeven"><td>'.$langs->trans("TicketsShowProgression").'</td>';
print '<td class="left">';
if (empty(getDolGlobalInt('TICKET_SHOW_PROGRESSION'))) {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=set_TICKET_SHOW_PROGRESSION">' . img_picto($langs->trans('Disabled'), 'switch_off') . '</a>';
} else {
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_TICKET_SHOW_PROGRESSION">' . img_picto($langs->trans('Enabled'), 'switch_on') . '</a>';
}
print '</td>';
print '<td class="center width75">';
print $form->textwithpicto('', $langs->trans("TicketsShowProgressionHelp"), 1, 'help');
print '</td>';
print '</tr>';
// Also send to main email address
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print '<tr class="oddeven"><td>'.$langs->trans("TicketsEmailAlsoSendToMainAddress").'</td>';

View File

@ -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);
}

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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 '</td>';
}
if (!empty($arrayfields['t.progress']['checked'])) {
if ((!empty($conf->global->TICKET_SHOW_PROGRESSION)) && !empty($arrayfields['t.progress']['checked'])) {
print '<td class="liste_titre"></td>';
}
@ -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 '<td>';
print $obj->progress;
print '</td>';

View File

@ -331,9 +331,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a
print '</td></tr>';
// Progression
print '<tr><td>'.$langs->trans("Progression").'</td><td>';
print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%';
print '</td></tr>';
if (!empty($conf->global->TICKET_SHOW_PROGRESSION)) {
print '<tr><td>'.$langs->trans("Progression").'</td><td>';
print ($object->dao->progress > 0 ? dol_escape_htmltag($object->dao->progress) : '0').'%';
print '</td></tr>';
}
// Other attributes
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';

View File

@ -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') {