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

Conflicts:
	htdocs/core/class/commondocgenerator.class.php
	htdocs/core/menus/standard/eldy.lib.php
This commit is contained in:
Laurent Destailleur 2024-04-11 22:19:08 +02:00
commit c575d26703
4 changed files with 42 additions and 10 deletions

View File

@ -77,7 +77,7 @@ if (!empty($user->socid)) {
// We check permission.
// Check is done on $user->rights->element->create or $user->rights->element->subelement->create (because $action = 'set')
if (preg_match('/status$/', $field) || ($field == 'evenunsubscribe' && $object->table_element == 'mailing')) {
if (preg_match('/statu[st]$/', $field) || ($field == 'evenunsubscribe' && $object->table_element == 'mailing')) {
restrictedArea($user, $object->module, $object, $object->table_element, $usesublevelpermission);
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
restrictedArea($user, 'produit|service', $object, 'product&product', '', '', 'rowid');

View File

@ -802,16 +802,20 @@ abstract class CommonDocGenerator
if (isset($line->fk_product) && $line->fk_product > 0) {
$tmpproduct = new Product($this->db);
$result = $tmpproduct->fetch($line->fk_product);
foreach ($tmpproduct->array_options as $key => $label) {
$resarray["line_product_".$key] = $label;
if (!empty($tmpproduct->array_options) && is_array($tmpproduct->array_options)) {
foreach ($tmpproduct->array_options as $key => $label) {
$resarray["line_product_".$key] = $label;
}
}
} else {
// Set unused placeholders as blank
$extrafields->fetch_name_optionals_label("product");
$extralabels = $extrafields->attributes["product"]['label'];
foreach ($extralabels as $key => $label) {
$resarray['line_product_options_'.$key] = '';
if (!empty($extralabels) && is_array($extralabels)) {
foreach ($extralabels as $key => $label) {
$resarray['line_product_options_'.$key] = '';
}
}
}
@ -908,13 +912,17 @@ abstract class CommonDocGenerator
$array_other['object_'.$key] = $value;
} elseif (is_array($value) && $recursive) {
$tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0);
foreach ($tmparray as $key2 => $value2) {
$array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2;
if (!empty($tmparray) && is_array($tmparray)) {
foreach ($tmparray as $key2 => $value2) {
$array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2;
}
}
} elseif (is_object($value) && $recursive) {
$tmparray = $this->get_substitutionarray_each_var_object($value, $outputlangs, 0);
foreach ($tmparray as $key2 => $value2) {
$array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2;
if (!empty($tmparray) && is_array($tmparray)) {
foreach ($tmparray as $key2 => $value2) {
$array_other['object_'.$key.'_'.preg_replace('/^object_/', '', $key2)] = $value2;
}
}
}
}

View File

@ -2817,7 +2817,7 @@ class EmailCollector extends CommonObject
$sql .= ' FROM ' . MAIN_DB_PREFIX . $objectdesc['table'] . ' AS t';
$sql .= ' WHERE ';
foreach ($objectdesc['fields'] as $field) {
$sql .= "'" .$this->db->escape($subject) . "' LIKE CONCAT('%', t." . $field . ", '%') OR ";
$sql .= "('" .$this->db->escape($subject) . "' LIKE CONCAT('%', t." . $field . ", '%') AND t." . $field . "<>'') OR ";
}
$sql = substr($sql, 0, -4);

View File

@ -1124,6 +1124,30 @@ class ConferenceOrBoothAttendee extends CommonObject
return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables);
}
/**
* Return full name ('name+' '+lastname)
*
* @param Translate $langs Language object for translation of civility (used only if option is 1)
* @param int $option 0=No option
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname
* @param int $maxlen Maximum length
* @return string String with full name
*/
public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
{
$lastname = $this->lastname;
$firstname = $this->firstname;
if (empty($lastname)) {
$lastname = (isset($this->lastname) ? $this->lastname : (isset($this->name) ? $this->name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company : '')))));
}
$ret = '';
$ret .= dolGetFirstLastname($firstname, $lastname, $nameorder);
return dol_trunc($ret, $maxlen);
}
}