', we will keep 'ccc.com'
$hosth = $this->getFrom('addr');
$hosth = preg_replace('/^.*', '', $hosth);
$hosth = preg_replace('/>.*$/', '', $hosth);
$hosth = preg_replace('/.*@/', '', $hosth);
+ } elseif ($conf->global->MAIL_SMTP_USE_FROM_FOR_HELO == 2) {
+ // If value of MAIL_SMTP_USE_FROM_FOR_HELO is 2, we use the domain in the $dolibarr_main_url_root.
+ global $dolibarr_main_url_root;
+ $hosth = getDomainFromURL($dolibarr_main_url_root, 1);
}
}
diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php
index 043d9e6e18e..3a95809e6d4 100644
--- a/htdocs/core/lib/ajax.lib.php
+++ b/htdocs/core/lib/ajax.lib.php
@@ -690,29 +690,33 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof
}
/**
- * On/off button to change status of an object
- * This is called when MAIN_DIRECT_STATUS_UPDATE is set and it use tha ajax service objectonoff.php
+ * On/off button to change a property status of an object
+ * This uses the ajax service objectonoff.php (May be called when MAIN_DIRECT_STATUS_UPDATE is set for some pages)
*
* @param Object $object Object to set
* @param string $code Name of property in object : 'status' or 'status_buy' for product by example
* @param string $field Name of database field : 'tosell' or 'tobuy' for product by example
- * @param string $text_on Text if on ('Text' or 'Text:css picto on')
- * @param string $text_off Text if off ('Text' or 'Text:css picto on')
+ * @param string $text_on Text if on ('Text' or 'Text:Picto on:Css picto on')
+ * @param string $text_off Text if off ('Text' or 'Text:Picto off:Css picto off')
* @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid'))
* @param string $morecss More CSS
- * @param string $htmlname Name of HTML component. Keep '' or use a different value if you need to use this component several time on same page for same property.
+ * @param string $htmlname Name of HTML component. Keep '' or use a different value if you need to use this component several time on the same page for the same field.
+ * @param int $forcenojs Force the component to work as link post (without javascript) instead of ajax call
* @return string html for button on/off
*/
-function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '', $htmlname = '')
+function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = array(), $morecss = '', $htmlname = '', $forcenojs = 0)
{
- global $langs;
+ global $conf, $langs;
if (empty($htmlname)) {
$htmlname = $code;
}
//var_dump($object->module); var_dump($object->element);
- $out = '';
+ }
$switchon = 'switch_on';
$switchoff = 'switch_off';
+ $cssswitchon = '';
+ $cssswitchoff = '';
$tmparray = explode(':', $text_on);
if (!empty($tmparray[1])) {
$text_on = $tmparray[0];
$switchon = $tmparray[1];
+ if (!empty($tmparray[2])) {
+ $cssswitchon = $tmparray[2];
+ }
}
$tmparray = explode(':', $text_off);
if (!empty($tmparray[1])) {
$text_off = $tmparray[0];
$switchoff = $tmparray[1];
+ if (!empty($tmparray[2])) {
+ $cssswitchoff = $tmparray[2];
+ }
}
- $out .= ''.img_picto($langs->trans($text_off), $switchoff).'';
- $out .= ''.img_picto($langs->trans($text_on), $switchon).'';
+ if (empty($conf->use_javascript_ajax) || $forcenojs) {
+ $out .= 'id).'">'.img_picto($langs->trans($text_off), $switchoff, '', false, 0, 0, '', $cssswitchoff).'';
+ $out .= 'id).'">'.img_picto($langs->trans($text_on), $switchon, '', false, 0, 0, '', $cssswitchon).'';
+ } else {
+ $out .= ''.img_picto($langs->trans($text_off), $switchoff, '', false, 0, 0, '', $cssswitchoff).'';
+ $out .= ''.img_picto($langs->trans($text_on), $switchon, '', false, 0, 0, '', $cssswitchon).'';
+ }
return $out;
}
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 18306842df6..c3fdbf377a3 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9884,10 +9884,10 @@ function dol_getmypid()
* like "keyword1 keyword2" = We want record field like keyword1 AND field like keyword2
* or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < -1000"
- * If param $mode is 2, can contains a list of int id separated by comma like "1,3,4"
- * If param $mode is 3, can contains a list of string separated by comma like "a,b,c"
- * @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of ID separated with comma (Example '1,3,4')
- * 3=value is list of string separated with comma (Example 'text 1,text 2'), 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4'
+ * If param $mode is 2 or -2, can contains a list of int id separated by comma like "1,3,4"
+ * If param $mode is 3 or -3, can contains a list of string separated by comma like "a,b,c".
+ * @param integer $mode 0=value is list of keyword strings, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of ID separated with comma (Example '1,3,4'), -2 is for exclude list,
+ * 3=value is list of string separated with comma (Example 'text 1,text 2'), -3 if for exclude list, 4=value is a list of ID separated with comma (Example '2,7') to be used to search into a multiselect string '1,2,3,4'
* @param integer $nofirstand 1=Do not output the first 'AND'
* @return string $res The statement to append to the SQL query
* @see dolSqlDateFilter()
@@ -9902,7 +9902,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$value = preg_replace('/\*/', '%', $value); // Replace * with %
}
if ($mode == 1) {
- $value = preg_replace('/([!<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
+ $value = preg_replace('/([!<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can then explode on space to get all tests to do
}
$value = preg_replace('/\s*\|\s*/', '|', $value);
@@ -9913,16 +9913,15 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$fields = array($fields);
}
- $j = 0;
- foreach ($crits as $crit) {
+ $i1 = 0; // count the nb of and criteria added (all fields / criterias)
+ foreach ($crits as $crit) { // Loop on each AND criteria
$crit = trim($crit);
- $i = 0;
- $i2 = 0;
+ $i2 = 0; // count the nb of valid criteria added for this this first criteria
$newres = '';
foreach ($fields as $field) {
if ($mode == 1) {
$tmpcrits = explode('|', $crit);
- $i3 = 0; // count the nb of valid criteria added for this field
+ $i3 = 0; // count the nb of valid criteria added for this current field
foreach ($tmpcrits as $tmpcrit) {
if ($tmpcrit !== '0' && empty($tmpcrit)) {
continue;
@@ -9949,7 +9948,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$i3++; // a criteria was added to string
}
}
- $i2++;
+ $i2++; // a criteria for 1 more field was added to string
} elseif ($mode == 2 || $mode == -2) {
$crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : '');
@@ -9957,7 +9956,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
if ($mode == -2) {
$newres .= ' OR '.$field.' IS NULL';
}
- $i2++; // a criteria was added to string
+ $i2++; // a criteria for 1 more field was added to string
} elseif ($mode == 3 || $mode == -3) {
$tmparray = explode(',', $crit);
if (count($tmparray)) {
@@ -9970,7 +9969,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
}
}
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -3 ? 'NOT ' : '')."IN (".$db->sanitize($listofcodes, 1).")";
- $i2++; // a criteria was added to string
+ $i2++; // a criteria for 1 more field was added to string
}
if ($mode == -3) {
$newres .= ' OR '.$field.' IS NULL';
@@ -9987,20 +9986,20 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$newres .= ' OR '.$field." LIKE '%,".$db->escape($val)."'";
$newres .= ' OR '.$field." LIKE '%,".$db->escape($val).",%'";
$newres .= ')';
- $i2++;
+ $i2++; // a criteria for 1 more field was added to string (we can add several citeria for the same field as it is a multiselect search criteria)
}
}
}
} else { // $mode=0
$tmpcrits = explode('|', $crit);
- $i3 = 0; // count the nb of valid criteria added for this field
- foreach ($tmpcrits as $tmpcrit) {
+ $i3 = 0; // count the nb of valid criteria added for the current couple criteria/field
+ foreach ($tmpcrits as $tmpcrit) { // loop on each OR criteria
if ($tmpcrit !== '0' && empty($tmpcrit)) {
continue;
}
$tmpcrit = trim($tmpcrit);
- if ($tmpcrit == '^$') { // If we search empty, we must combined different fields with AND
+ if ($tmpcrit == '^$' || strpos($crit, '!') === 0) { // If we search empty, we must combined different OR fields with AND
$newres .= (($i2 > 0 || $i3 > 0) ? ' AND ' : '');
} else {
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '');
@@ -10046,15 +10045,15 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
$i3++;
}
- $i2++; // a criteria was added to string
+
+ $i2++; // a criteria for 1 more field was added to string
}
- $i++;
}
if ($newres) {
$res = $res.($res ? ' AND ' : '').($i2 > 1 ? '(' : '').$newres.($i2 > 1 ? ')' : '');
}
- $j++;
+ $i1++;
}
$res = ($nofirstand ? "" : " AND ")."(".$res.")";
@@ -11329,6 +11328,12 @@ function getElementProperties($element_type)
$classpath = 'contrat/class';
$module = 'contrat';
$subelement = 'contrat';
+ } elseif ($element_type == 'mailing') {
+ $classpath = 'comm/mailing/class';
+ $module = 'mailing';
+ $classfile = 'mailing';
+ $classname = 'Mailing';
+ $subelement = '';
} elseif ($element_type == 'member') {
$classpath = 'adherents/class';
$module = 'adherent';
@@ -11425,7 +11430,6 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '')
$ret = 0;
$element_prop = getElementProperties($element_type);
- //var_dump($element_prop);
if (is_array($element_prop) && isModEnabled($element_prop['module'])) {
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
diff --git a/htdocs/core/modules/action/rapport.class.php b/htdocs/core/modules/action/rapport.class.php
index d4805143e59..a880b894b73 100644
--- a/htdocs/core/modules/action/rapport.class.php
+++ b/htdocs/core/modules/action/rapport.class.php
@@ -238,7 +238,7 @@ class CommActionRapport
$sql = "SELECT s.nom as thirdparty, s.rowid as socid, s.client,";
$sql .= " a.id, a.datep as dp, a.datep2 as dp2,";
$sql .= " a.fk_contact, a.note, a.percent as percent, a.fulldayevent, a.label, a.fk_project,";
- $sql .= " c.code, c.libelle,";
+ $sql .= " c.code, c.libelle as label_type,";
$sql .= " u.login";
$sql .= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON a.fk_soc = s.rowid";
diff --git a/htdocs/core/modules/export/modules_export.php b/htdocs/core/modules/export/modules_export.php
index 31b137f6465..0cad4f76509 100644
--- a/htdocs/core/modules/export/modules_export.php
+++ b/htdocs/core/modules/export/modules_export.php
@@ -107,7 +107,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
}
/**
- * Renvoi libelle d'un driver export
+ * Return label of driver export
*
* @param string $key Key of driver
* @return string Label
@@ -140,7 +140,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
}
/**
- * Renvoi libelle de librairie externe du driver
+ * Renvoi label of driver lib
*
* @param string $key Key of driver
* @return string Label of library
@@ -151,7 +151,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac
}
/**
- * Renvoi version de librairie externe du driver
+ * Return version of driver lib
*
* @param string $key Key of driver
* @return string Version of library
diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php
index 5fe408f6dd5..4ead826d27f 100644
--- a/htdocs/core/modules/import/modules_import.php
+++ b/htdocs/core/modules/import/modules_import.php
@@ -253,7 +253,7 @@ class ModeleImports
}
/**
- * Renvoi libelle d'un driver import
+ * Return label of driver import
*
* @param string $key Key
* @return string
@@ -264,7 +264,7 @@ class ModeleImports
}
/**
- * Renvoi la description d'un driver import
+ * Return description of import drivervoi la description d'un driver import
*
* @param string $key Key
* @return string
diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php
index 7649c255d04..6137bcca2ff 100644
--- a/htdocs/core/modules/mailings/advthirdparties.modules.php
+++ b/htdocs/core/modules/mailings/advthirdparties.modules.php
@@ -82,6 +82,9 @@ class mailing_advthirdparties extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s LEFT OUTER JOIN ".MAIN_DB_PREFIX."societe_extrafields se ON se.fk_object=s.rowid";
$sql .= " WHERE s.entity IN (".getEntity('societe').")";
$sql .= " AND s.rowid IN (".$this->db->sanitize(implode(',', $socid)).")";
+ if (empty($this->evenunsubscribe)) {
+ $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).")";
+ }
$sql .= " ORDER BY email";
// Stock recipients emails into targets table
@@ -132,6 +135,9 @@ class mailing_advthirdparties extends MailingTargets
if (count($socid) > 0) {
$sql .= " AND socp.fk_soc IN (".$this->db->sanitize(implode(',', $socid)).")";
}
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = socp.email and mu.entity = ".((int) $conf->entity).")";
+ }
$sql .= " ORDER BY email";
// Stock recipients emails into targets table
@@ -211,6 +217,9 @@ class mailing_advthirdparties extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.email != ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
+ if (empty($this->evenunsubscribe)) {
+ $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);
diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php
index 2b8d17723cb..80db8513395 100644
--- a/htdocs/core/modules/mailings/contacts1.modules.php
+++ b/htdocs/core/modules/mailings/contacts1.modules.php
@@ -82,7 +82,6 @@ class mailing_contacts1 extends MailingTargets
$statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$statssql[0] .= " WHERE c.entity IN (".getEntity('contact').")";
$statssql[0] .= " AND c.email <> ''"; // Note that null != '' is false
- $statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
$statssql[0] .= " AND c.statut = 1";
return $statssql;
@@ -104,7 +103,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
$sql .= " WHERE c.entity IN (".getEntity('contact').")";
$sql .= " AND c.email <> ''"; // Note that null != '' is false
- $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = c.email and mu.entity = ".((int) $conf->entity).")";
+ }
// exclude unsubscribed users
$sql .= " AND c.statut = 1";
@@ -331,7 +332,7 @@ class mailing_contacts1 extends MailingTargets
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Ajoute destinataires dans table des cibles
+ * Add some recipients into target table
*
* @param int $mailing_id Id of emailing
* @return int <0 si erreur, nb ajout si ok
@@ -389,7 +390,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " WHERE sp.entity IN (".getEntity('contact').")";
$sql .= " AND sp.email <> ''";
- $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0";
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = sp.email and mu.entity = ".((int) $conf->entity).")";
+ }
// Exclude unsubscribed email adresses
$sql .= " AND sp.statut = 1";
$sql .= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
diff --git a/htdocs/core/modules/mailings/eventorganization.modules.php b/htdocs/core/modules/mailings/eventorganization.modules.php
index 0d0ffb63c3a..27af7ab52d8 100644
--- a/htdocs/core/modules/mailings/eventorganization.modules.php
+++ b/htdocs/core/modules/mailings/eventorganization.modules.php
@@ -85,6 +85,9 @@ class mailing_eventorganization extends MailingTargets
$sql .= " AND p.entity IN (".getEntity('project').")";
$sql .= " AND e.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND e.fk_project = ".((int) GETPOST('filter_eventorganization', 'int'));
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = e.email and mu.entity = ".((int) $conf->entity).")";
+ }
$sql .= " ORDER BY e.email";
// Stock recipients emails into targets table
@@ -159,14 +162,15 @@ class mailing_eventorganization extends MailingTargets
*/
public function getNbOfRecipients($sql = '')
{
- global $conf;
-
$sql = "SELECT COUNT(DISTINCT(e.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee as e, ";
$sql .= " ".MAIN_DB_PREFIX."projet as p";
$sql .= " WHERE e.email <> ''";
$sql .= " AND e.fk_project = p.rowid";
$sql .= " AND p.entity IN (".getEntity('project').")";
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = e.email and mu.entity = ".((int) $conf->entity).")";
+ }
//print $sql;
diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php
index 8d55ac65864..65bb106ceb4 100644
--- a/htdocs/core/modules/mailings/fraise.modules.php
+++ b/htdocs/core/modules/mailings/fraise.modules.php
@@ -101,6 +101,9 @@ class mailing_fraise extends MailingTargets
$sql = "SELECT count(distinct(a.email)) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
$sql .= " WHERE (a.email IS NOT NULL AND a.email != '') AND a.entity IN (".getEntity('member').")";
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = a.email and mu.entity = ".((int) $conf->entity).")";
+ }
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
return parent::getNbOfRecipients($sql);
@@ -278,6 +281,9 @@ class mailing_fraise extends MailingTargets
if (GETPOST('filter_type', 'int') > 0) {
$sql .= " AND ta.rowid = ".((int) GETPOST('filter_type', 'int'));
}
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = a.email and mu.entity = ".((int) $conf->entity).")";
+ }
$sql .= " ORDER BY a.email";
//print $sql;
diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php
index b745934d94d..5a99a44dc0f 100644
--- a/htdocs/core/modules/mailings/modules_mailings.php
+++ b/htdocs/core/modules/mailings/modules_mailings.php
@@ -53,6 +53,12 @@ class MailingTargets // This can't be abstract as it is used for some method
*/
public $sql;
+ public $desc;
+
+ public $name;
+
+ public $evenunsubscribe = 0; // Set this to 1 if you want to flag you also want to include email in target that has opt-out.
+
/**
* Constructor
@@ -111,8 +117,11 @@ class MailingTargets // This can't be abstract as it is used for some method
{
$result = $this->db->query($sql);
if ($result) {
- $obj = $this->db->fetch_object($result);
- return $obj->nb;
+ $total = 0;
+ while ($obj = $this->db->fetch_object($result)) {
+ $total += $obj->nb;
+ }
+ return $total;
} else {
$this->error = $this->db->lasterror();
return -1;
@@ -149,7 +158,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$nb = $obj->nb;
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing";
- $sql .= " SET nbemail = ".$nb." WHERE rowid = ".((int) $mailing_id);
+ $sql .= " SET nbemail = ".((int) $nb)." WHERE rowid = ".((int) $mailing_id);
if (!$this->db->query($sql)) {
dol_syslog($this->db->error());
$this->error = $this->db->error();
@@ -162,11 +171,11 @@ class MailingTargets // This can't be abstract as it is used for some method
}
/**
- * Add a list of targets int the database
+ * Add a list of targets into the database
*
* @param int $mailing_id Id of emailing
* @param array $cibles Array with targets
- * @return int < 0 si erreur, nb ajout si ok
+ * @return int < 0 if error, nb added if OK
*/
public function addTargetsToDatabase($mailing_id, $cibles)
{
@@ -186,15 +195,15 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql .= " lastname, firstname, email, other, source_url, source_id,";
$sql .= " tag,";
$sql .= " source_type)";
- $sql .= " VALUES (".$mailing_id.",";
- $sql .= (empty($targetarray['fk_contact']) ? '0' : "'".$this->db->escape($targetarray['fk_contact'])."'").",";
+ $sql .= " VALUES (".((int) $mailing_id).",";
+ $sql .= (empty($targetarray['fk_contact']) ? '0' : (int) $targetarray['fk_contact']).",";
$sql .= "'".$this->db->escape($targetarray['lastname'])."',";
$sql .= "'".$this->db->escape($targetarray['firstname'])."',";
$sql .= "'".$this->db->escape($targetarray['email'])."',";
$sql .= "'".$this->db->escape($targetarray['other'])."',";
$sql .= "'".$this->db->escape($targetarray['source_url'])."',";
$sql .= (empty($targetarray['source_id']) ? 'null' : "'".$this->db->escape($targetarray['source_id'])."'").",";
- $sql .= "'".$this->db->escape(dol_hash($dolibarr_main_instance_unique_id.";".$targetarray['email'].";".$targetarray['lastname'].";".$mailing_id.";".$conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY, 'md5'))."',";
+ $sql .= "'".$this->db->escape(dol_hash($dolibarr_main_instance_unique_id.";".$targetarray['email'].";".$targetarray['lastname'].";".((int) $mailing_id).";".getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY'), 'md5'))."',";
$sql .= "'".$this->db->escape($targetarray['source_type'])."')";
dol_syslog(__METHOD__, LOG_DEBUG);
$result = $this->db->query($sql);
@@ -232,16 +241,20 @@ class MailingTargets // This can't be abstract as it is used for some method
$result=$this->db->query($sql);
*/
- $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
- $sql .= " SET statut=3";
- $sql .= " WHERE fk_mailing = ".((int) $mailing_id)." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
+ if (empty($this->evenunsubscribe)) {
+ $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles as mc";
+ $sql .= " SET mc.statut = 3";
+ $sql .= " WHERE mc.fk_mailing = ".((int) $mailing_id);
+ $sql .= " AND EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = mc.email and mu.entity = ".((int) $conf->entity).")";
- dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
- $result = $this->db->query($sql);
- if (!$result) {
- dol_print_error($this->db);
+ dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
+ $result = $this->db->query($sql);
+ if (!$result) {
+ dol_print_error($this->db);
+ }
}
+ // Update nb of recipient into emailing record
$this->update_nb($mailing_id);
$this->db->commit();
diff --git a/htdocs/core/modules/mailings/partnership.modules.php b/htdocs/core/modules/mailings/partnership.modules.php
index b4a8e9d8fd9..07405c9f7ad 100644
--- a/htdocs/core/modules/mailings/partnership.modules.php
+++ b/htdocs/core/modules/mailings/partnership.modules.php
@@ -86,6 +86,9 @@ class mailing_partnership extends MailingTargets
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
}
+ if (empty($this->evenunsubscribe)) {
+ $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).")";
+ }
$sql .= " UNION ";
@@ -99,6 +102,9 @@ class mailing_partnership extends MailingTargets
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND pt.rowid=".((int) GETPOST('filter', 'int'));
}
+ if (empty($this->evenunsubscribe)) {
+ $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).")";
+ }
$sql .= " ORDER BY email";
@@ -180,6 +186,9 @@ class mailing_partnership extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.rowid = p.fk_soc AND s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
+ if (empty($this->evenunsubscribe)) {
+ $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).")";
+ }
$sql .= " UNION ";
@@ -187,6 +196,9 @@ class mailing_partnership extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p, ".MAIN_DB_PREFIX."adherent as s";
$sql .= " WHERE s.rowid = p.fk_member AND s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('member').")";
+ if (empty($this->evenunsubscribe)) {
+ $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).")";
+ }
//print $sql;
diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php
index 907028ca881..2d2dd7e1809 100644
--- a/htdocs/core/modules/mailings/pomme.modules.php
+++ b/htdocs/core/modules/mailings/pomme.modules.php
@@ -78,6 +78,7 @@ class mailing_pomme extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.email != ''"; // u.email IS NOT NULL est implicite dans ce test
$sql .= " AND u.entity IN (0,".$conf->entity.")";
+
$statssql[0] = $sql;
return $statssql;
@@ -100,6 +101,9 @@ class mailing_pomme extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.email != ''"; // u.email IS NOT NULL est implicite dans ce test
$sql .= " AND u.entity IN (0,".$conf->entity.")";
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = u.email and mu.entity = ".((int) $conf->entity).")";
+ }
// La requete doit retourner un champ "nb" pour etre comprise par parent::getNbOfRecipients
return parent::getNbOfRecipients($sql);
@@ -183,6 +187,9 @@ class mailing_pomme extends MailingTargets
if (GETPOSTISSET("filteremployee") && GETPOST("filteremployee") == '0') {
$sql .= " AND u.employee=0";
}
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = u.email and mu.entity = ".((int) $conf->entity).")";
+ }
$sql .= " ORDER BY u.email";
// Stocke destinataires dans cibles
diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php
index fd91e5e849f..f34eb600228 100644
--- a/htdocs/core/modules/mailings/thirdparties.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties.modules.php
@@ -142,6 +142,9 @@ class mailing_thirdparties extends MailingTargets
$sql .= " WHERE s.email <> ''";
$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 (empty($this->evenunsubscribe)) {
+ $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0";
+ }
$sql .= $addFilter;
} else {
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
@@ -154,6 +157,9 @@ class mailing_thirdparties extends MailingTargets
if (GETPOST('filter_thirdparties', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter_thirdparties', 'int'));
}
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0";
+ }
$sql .= $addFilter;
$sql .= " UNION ";
$sql .= "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
@@ -166,6 +172,9 @@ class mailing_thirdparties extends MailingTargets
if (GETPOST('filter_thirdparties', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter_thirdparties', 'int'));
}
+ if (empty($this->evenunsubscribe)) {
+ $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = s.email) = 0";
+ }
$sql .= $addFilter;
}
$sql .= " ORDER BY email";
@@ -250,7 +259,10 @@ 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 NOT EXISTS (SELECT rowid FROM ".MAIN_DB_PREFIX."mailing_unsubscribe as mu WHERE mu.email = s.email and mu.entity = ".((int) $conf->entity).")";
+ if (empty($this->evenunsubscribe)) {
+ $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);
}
diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
index 9fc43e37388..acbbe4db46c 100644
--- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
+++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php
@@ -116,6 +116,9 @@ class mailing_thirdparties_services_expired extends MailingTargets
$sql .= " AND s.rowid = c.fk_soc AND cd.fk_contrat = c.rowid AND s.email != ''";
$sql .= " AND cd.statut= 4 AND cd.fk_product=p.rowid AND p.ref = '".$this->db->escape($product)."'";
$sql .= " AND cd.date_fin_validite < '".$this->db->idate($now)."'";
+ if (empty($this->evenunsubscribe)) {
+ $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).")";
+ }
$sql .= " ORDER BY s.email";
// Stocke destinataires dans cibles
@@ -201,6 +204,9 @@ class mailing_thirdparties_services_expired extends MailingTargets
$sql .= " AND cd.statut= 4 AND cd.fk_product=p.rowid";
$sql .= " AND p.ref IN (".$this->db->sanitize("'".join("','", $this->arrayofproducts)."'", 1).")";
$sql .= " AND cd.date_fin_validite < '".$this->db->idate($now)."'";
+ if (empty($this->evenunsubscribe)) {
+ $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).")";
+ }
$a = parent::getNbOfRecipients($sql);
diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php
index 7e288f265ba..010ea7b6f32 100644
--- a/htdocs/cron/class/cronjob.class.php
+++ b/htdocs/cron/class/cronjob.class.php
@@ -1479,7 +1479,7 @@ class Cronjob extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un statut donne
+ * Return label of a giver status
*
* @param int $status Id statut
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php
index bf8f68b3bbf..472db131563 100644
--- a/htdocs/delivery/class/delivery.class.php
+++ b/htdocs/delivery/class/delivery.class.php
@@ -899,10 +899,10 @@ class Delivery extends CommonObject
/**
- * Retourne le libelle du statut d'une expedition
+ * Return the label of the status
*
- * @param int $mode Mode
- * @return string Label
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@@ -911,11 +911,11 @@ class Delivery extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un statut donne
+ * Return the label of a given status
*
- * @param int $status Id status
- * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
- * @return string Label
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function LibStatut($status, $mode)
{
diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php
index 1769033df28..ca7ee4f3399 100644
--- a/htdocs/don/class/paymentdonation.class.php
+++ b/htdocs/don/class/paymentdonation.class.php
@@ -507,10 +507,10 @@ class PaymentDonation extends CommonObject
/**
- * Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
- * @return string Libelle
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@@ -519,11 +519,11 @@ class PaymentDonation extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un statut donne
+ * Return the label of a given status
*
- * @param int $status Id status
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Libelle du statut
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index 21a43565a25..d0c3657ca07 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -589,9 +589,9 @@ class EcmDirectory extends CommonObject
/**
- * Retourne le libelle du status d'un user (actif, inactif)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php
index e9015c08acb..6851abd0b81 100644
--- a/htdocs/ecm/class/ecmfiles.class.php
+++ b/htdocs/ecm/class/ecmfiles.class.php
@@ -918,9 +918,9 @@ class EcmFiles extends CommonObject
}
/**
- * Retourne le libelle du status d'un user (actif, inactif)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 550ebeca35b..b0e283fc17a 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -2228,6 +2228,8 @@ class EmailCollector extends CommonObject
}
}
}
+ } else {
+ dol_syslog("One and only one existing third party has been found");
}
}
}
@@ -2723,6 +2725,8 @@ class EmailCollector extends CommonObject
}
}
}
+ } else {
+ $operationslog .= '
Project already exists for msgid ='.dol_escape_htmltag($msgid);
}
} elseif ($operation['type'] == 'ticket') {
// Create ticket
diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php
index 8f024665a77..0f7bedc19d3 100644
--- a/htdocs/expedition/class/expedition.class.php
+++ b/htdocs/expedition/class/expedition.class.php
@@ -1874,7 +1874,7 @@ class Expedition extends CommonObject
* Return status label
*
* @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto
- * @return string Libelle
+ * @return string Label
*/
public function getLibStatut($mode = 0)
{
diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php
index 4fe23ae589c..b065bbb5f16 100644
--- a/htdocs/expensereport/class/paymentexpensereport.class.php
+++ b/htdocs/expensereport/class/paymentexpensereport.class.php
@@ -445,10 +445,10 @@ class PaymentExpenseReport extends CommonObject
/**
- * Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
- * @return string Libelle
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@@ -457,16 +457,16 @@ class PaymentExpenseReport extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un statut donne
+ * Return the label of a given status
*
- * @param int $status Id status
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Libelle du statut
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
// phpcs:enable
- global $langs;
+ //global $langs;
return '';
}
diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
index 02fbff5b363..e4bccaa0980 100644
--- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
+++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php
@@ -86,6 +86,7 @@ class CommandeFournisseurDispatch extends CommonObjectLine
public $qty_asked;
public $libelle;
+ public $label;
public $desc;
public $tva_tx;
public $vat_src_code;
diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php
index b587922b71d..816580d3167 100644
--- a/htdocs/fourn/class/paiementfourn.class.php
+++ b/htdocs/fourn/class/paiementfourn.class.php
@@ -581,10 +581,10 @@ class PaiementFourn extends Paiement
}
/**
- * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Libelle
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function getLibStatut($mode = 0)
{
@@ -593,11 +593,11 @@ class PaiementFourn extends Paiement
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un statut donne
+ * Return the label of a given status
*
- * @param int $status Statut
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Libelle du statut
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php
index 8eb628d697f..fb8179f2042 100644
--- a/htdocs/fourn/facture/card-rec.php
+++ b/htdocs/fourn/facture/card-rec.php
@@ -947,7 +947,7 @@ if ($action == 'create') {
}
$htmltext .= '';
- // Libelle
+ // Label
print '| ' . $langs->trans("Label") . ' | ';
print '';
print ' |
';
diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php
index 44ec5935d49..61ac4929d40 100644
--- a/htdocs/imports/class/import.class.php
+++ b/htdocs/imports/class/import.class.php
@@ -162,9 +162,9 @@ class Import
$this->array_import_perms[$i] = $user->rights->import->run;
// Icon
$this->array_import_icon[$i] = (isset($module->import_icon[$r]) ? $module->import_icon[$r] : $module->picto);
- // Code du dataset export
+ // Code of dataset export
$this->array_import_code[$i] = $module->import_code[$r];
- // Libelle du dataset export
+ // Label of dataset export
$this->array_import_label[$i] = $module->getImportDatasetLabel($r);
// Array of tables to import (key=alias, value=tablename)
$this->array_import_tables[$i] = $module->import_tables_array[$r];
diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql
index ca2db7924b4..a86404b105f 100644
--- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql
+++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql
@@ -386,9 +386,11 @@ ALTER TABLE llx_product_fournisseur_price_log ADD INDEX idx_product_fournisseur_
ALTER TABLE llx_bordereau_cheque ADD COLUMN label varchar(255) AFTER ref;
-ALTER TABLE llx_societe ADD COLUMN vat_reverse_charge tinyint DEFAULT 0 AFTER tva_assuj;
-ALTER TABLE llx_facture_fourn ADD COLUMN vat_reverse_charge tinyint DEFAULT 0 AFTER close_note;
+ALTER TABLE llx_societe ADD COLUMN vat_reverse_charge smallint DEFAULT 0 AFTER tva_assuj;
+ALTER TABLE llx_facture_fourn ADD COLUMN vat_reverse_charge smallint DEFAULT 0 AFTER close_note;
ALTER TABLE llx_c_email_templates add COLUMN defaultfortype smallint DEFAULT 0;
+ALTER TABLE llx_mailing ADD COLUMN fk_user_modif integer AFTER fk_user_creat;
ALTER TABLE llx_mailing ADD COLUMN evenunsubscribe smallint DEFAULT 0;
+ALTER TABLE llx_mailing ADD COLUMN name_from varchar(128) AFTER email_from;
diff --git a/htdocs/install/mysql/tables/llx_mailing-mailing.sql b/htdocs/install/mysql/tables/llx_mailing-mailing.sql
index 39392502053..f8ee1c567b9 100644
--- a/htdocs/install/mysql/tables/llx_mailing-mailing.sql
+++ b/htdocs/install/mysql/tables/llx_mailing-mailing.sql
@@ -18,10 +18,10 @@
-- ========================================================================
--- redaction : 0
--- valide : 1
--- approuve : 2
--- envoye : 3
+-- draft : 0
+-- valid : 1
+-- approved : 2
+-- sent : 3
create table llx_mailing
(
@@ -37,6 +37,7 @@ create table llx_mailing
cible varchar(60),
nbemail integer,
email_from varchar(160), -- Email address of sender
+ name_from varchar(128), -- Name to show of sender
email_replyto varchar(160), -- Email address for reply
email_errorsto varchar(160), -- Email addresse for errors
tag varchar(128) NULL,
@@ -46,6 +47,7 @@ create table llx_mailing
date_envoi datetime, -- date d'envoi
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
fk_user_creat integer, -- user creator
+ fk_user_modif integer, -- user of last modification
fk_user_valid integer, -- user validator
fk_user_appro integer, -- not used
extraparams varchar(255), -- for stock other parameters with json format
diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang
index ed2d1409d00..4c217677375 100644
--- a/htdocs/langs/en_US/mails.lang
+++ b/htdocs/langs/en_US/mails.lang
@@ -180,3 +180,6 @@ DefaultBlacklistMailingStatus=Default value for field '%s' when creating a new c
DefaultStatusEmptyMandatory=Empty but mandatory
WarningLimitSendByDay=WARNING: The setup or contract of your instance limits your number of emails per day to %s. Trying to send more may result in having your instance slow down or suspended. Please contact your support if you need a higher quota.
NoMoreRecipientToSendTo=No more recipient to send the email to
+EmailOptedOut=Email owner has requested to not contact him with this email anymore
+EvenUnsubscribe=Include opt-out emails
+EvenUnsubscribeDesc=Include opt-out emails when you select emails as targets. Usefull for mandatory service emails for example.
\ No newline at end of file
diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php
index be53fa38b3a..bd02374a24c 100644
--- a/htdocs/loan/class/paymentloan.class.php
+++ b/htdocs/loan/class/paymentloan.class.php
@@ -453,10 +453,10 @@ class PaymentLoan extends CommonObject
}
/**
- * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Libelle
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function getLibStatut($mode = 0)
{
diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php
index 0bcfa07c672..4a310d51cfb 100644
--- a/htdocs/modulebuilder/template/class/myobject.class.php
+++ b/htdocs/modulebuilder/template/class/myobject.class.php
@@ -753,13 +753,14 @@ class MyObject extends CommonObject
/**
* getTooltipContentArray
- * @param array $params params to construct tooltip data
- * @since v18
- * @return array
+ *
+ * @param array $params Params to construct tooltip data
+ * @since v18
+ * @return array
*/
public function getTooltipContentArray($params)
{
- global $conf, $langs, $user;
+ global $conf, $langs;
$datas = [];
@@ -959,7 +960,7 @@ class MyObject extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Return the status
+ * Return the label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php
index 770f16b07d2..18213acdb89 100644
--- a/htdocs/opensurvey/class/opensurveysondage.class.php
+++ b/htdocs/opensurvey/class/opensurveysondage.class.php
@@ -666,8 +666,8 @@ class Opensurveysondage extends CommonObject
/**
* Return status label of Order
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Libelle
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label if status
*/
public function getLibStatut($mode)
{
@@ -678,9 +678,9 @@ class Opensurveysondage extends CommonObject
/**
* Return label of status
*
- * @param int $status Id statut
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Label of status
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function LibStatut($status, $mode)
{
diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php
index 80189f29845..275b5272d9c 100644
--- a/htdocs/product/inventory/class/inventory.class.php
+++ b/htdocs/product/inventory/class/inventory.class.php
@@ -607,9 +607,9 @@ class Inventory extends CommonObject
}
/**
- * Retourne le libelle du status d'un user (actif, inactif)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php
index 8ab5ff77da4..083ea381015 100644
--- a/htdocs/product/stock/class/mouvementstock.class.php
+++ b/htdocs/product/stock/class/mouvementstock.class.php
@@ -1154,10 +1154,10 @@ class MouvementStock extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un status donne
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Label of status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function LibStatut($mode = 0)
{
diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php
index 1151890a4b1..1856b7b156d 100644
--- a/htdocs/product/stock/class/productstockentrepot.class.php
+++ b/htdocs/product/stock/class/productstockentrepot.class.php
@@ -532,9 +532,9 @@ class ProductStockEntrepot extends CommonObject
}
/**
- * Retourne le libelle du status d'un user (actif, inactif)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index 17c5811d716..26119927fda 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -506,7 +506,6 @@ if ($search_opp_percent) {
$sql .= dolSqlDateFilter('p.dateo', $search_sday, $search_smonth, $search_syear);
$sql .= dolSqlDateFilter('p.datee', $search_eday, $search_emonth, $search_eyear);
-
if ($search_date_start_start) {
$sql .= " AND p.dateo >= '".$db->idate($search_date_start_start)."'";
}
@@ -1469,7 +1468,7 @@ while ($i < $imaxinloop) {
}
// Project url
if (!empty($arrayfields['p.ref']['checked'])) {
- print '';
+ print ' | ';
print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':''));
if ($object->hasDelay()) {
print img_warning($langs->trans('Late'));
diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php
index 018d532a363..f2da87feab5 100644
--- a/htdocs/reception/class/reception.class.php
+++ b/htdocs/reception/class/reception.class.php
@@ -1383,7 +1383,8 @@ class Reception extends CommonObject
while ($xnbp < $nbp) {
$line = new CommandeFournisseurDispatch($this->db);
$line->desc = $langs->trans("Description")." ".$xnbp;
- $line->libelle = $langs->trans("Description")." ".$xnbp;
+ $line->libelle = $langs->trans("Description")." ".$xnbp; // deprecated
+ $line->label = $langs->trans("Description")." ".$xnbp;
$line->qty = 10;
$line->fk_product = $this->commande->lines[$xnbp]->fk_product;
diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php
index 578594538cb..b9050d190d2 100644
--- a/htdocs/resource/class/dolresource.class.php
+++ b/htdocs/resource/class/dolresource.class.php
@@ -750,7 +750,7 @@ class Dolresource extends CommonObject
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
+
$label = ($langs->trans("ResourceTypeShort".$obj->code) != ("ResourceTypeShort".$obj->code) ? $langs->trans("ResourceTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_code_type_resource[$obj->rowid]['code'] = $obj->code;
$this->cache_code_type_resource[$obj->rowid]['label'] = $label;
@@ -875,9 +875,9 @@ class Dolresource extends CommonObject
/**
- * Retourne le libelle du status d'un user (actif, inactif)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php
index 4fbf69fd5ee..6446e86655f 100644
--- a/htdocs/salaries/class/salary.class.php
+++ b/htdocs/salaries/class/salary.class.php
@@ -674,9 +674,9 @@ class Salary extends CommonObject
/**
- * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee)
+ * Return label of current status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=label long, 1=labels short, 2=Picto + Label short, 3=Picto, 4=Picto + Label long, 5=Label short + Picto
* @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
* @return string Label
*/
@@ -687,7 +687,7 @@ class Salary extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un statut donne
+ * Return label of a given status
*
* @param int $status Id status
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 685270a09e0..f85f03cf8d8 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -4643,7 +4643,7 @@ class Societe extends CommonObject
/**
* Return prostect level
*
- * @return string Libelle
+ * @return string Label of prospect status
*/
public function getLibProspLevel()
{
@@ -4673,9 +4673,9 @@ class Societe extends CommonObject
/**
* Return status of prospect
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
+ * @param int $mode 0=label long, 1=label short, 2=Picto + Label short, 3=Picto, 4=Picto + Label long
* @param string $label Label to use for status for added status
- * @return string Libelle
+ * @return string Label
*/
public function getLibProspCommStatut($mode = 0, $label = '')
{
diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php
index 4b39515a585..82ff5c41c11 100644
--- a/htdocs/societe/class/societeaccount.class.php
+++ b/htdocs/societe/class/societeaccount.class.php
@@ -467,10 +467,10 @@ class SocieteAccount extends CommonObject
}
/**
- * Retourne le libelle du status d'un user (actif, inactif)
+ * Return the label of a given status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Label of status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function getLibStatut($mode = 0)
{
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 2487547543b..92baa55ea89 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -685,17 +685,14 @@ class Ticket extends CommonObject
$this->timing = $obj->timing;
$this->type_code = $obj->type_code;
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_type = ($langs->trans("TicketTypeShort".$obj->type_code) != ("TicketTypeShort".$obj->type_code) ? $langs->trans("TicketTypeShort".$obj->type_code) : ($obj->type_label != '-' ? $obj->type_label : ''));
$this->type_label = $label_type;
$this->category_code = $obj->category_code;
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_category = ($langs->trans("TicketCategoryShort".$obj->category_code) != ("TicketCategoryShort".$obj->category_code) ? $langs->trans("TicketCategoryShort".$obj->category_code) : ($obj->category_label != '-' ? $obj->category_label : ''));
$this->category_label = $label_category;
$this->severity_code = $obj->severity_code;
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_severity = ($langs->trans("TicketSeverityShort".$obj->severity_code) != ("TicketSeverityShort".$obj->severity_code) ? $langs->trans("TicketSeverityShort".$obj->severity_code) : ($obj->severity_label != '-' ? $obj->severity_label : ''));
$this->severity_label = $label_severity;
@@ -855,17 +852,14 @@ class Ticket extends CommonObject
$line->progress = $obj->progress;
$line->timing = $obj->timing;
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_type = ($langs->trans("TicketTypeShort".$obj->type_code) != ("TicketTypeShort".$obj->type_code) ? $langs->trans("TicketTypeShort".$obj->type_code) : ($obj->type_label != '-' ? $obj->type_label : ''));
$line->type_label = $label_type;
$this->category_code = $obj->category_code;
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_category = ($langs->trans("TicketCategoryShort".$obj->category_code) != ("TicketCategoryShort".$obj->category_code) ? $langs->trans("TicketCategoryShort".$obj->category_code) : ($obj->category_label != '-' ? $obj->category_label : ''));
$line->category_label = $label_category;
$this->severity_code = $obj->severity_code;
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label_severity = ($langs->trans("TicketSeverityShort".$obj->severity_code) != ("TicketSeverityShort".$obj->severity_code) ? $langs->trans("TicketSeverityShort".$obj->severity_code) : ($obj->severity_label != '-' ? $obj->severity_label : ''));
$line->severity_label = $label_severity;
@@ -1254,7 +1248,6 @@ class Ticket extends CommonObject
$i = 0;
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($langs->trans("TicketTypeShort".$obj->code) != ("TicketTypeShort".$obj->code) ? $langs->trans("TicketTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_types_tickets[$obj->rowid]['code'] = $obj->code;
$this->cache_types_tickets[$obj->rowid]['label'] = $label;
@@ -1343,7 +1336,6 @@ class Ticket extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->cache_severity_tickets[$obj->rowid]['code'] = $obj->code;
- // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut
$label = ($langs->trans("TicketSeverityShort".$obj->code) != ("TicketSeverityShort".$obj->code) ? $langs->trans("TicketSeverityShort".$obj->code) : ($obj->label != '-' ? $obj->label : ''));
$this->cache_severity_tickets[$obj->rowid]['label'] = $label;
$this->cache_severity_tickets[$obj->rowid]['use_default'] = $obj->use_default;
diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php
index a93f7ccebfb..b077650846e 100644
--- a/htdocs/user/class/usergroup.class.php
+++ b/htdocs/user/class/usergroup.class.php
@@ -698,9 +698,9 @@ class UserGroup extends CommonObject
/**
- * Return label of status of user (active, inactive)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
@@ -710,11 +710,11 @@ class UserGroup extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un statut donne
+ * Return the label of a given status
*
- * @param int $status Id status
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Label of status
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php
index 7424f7474c0..84f47e8c0d9 100644
--- a/htdocs/variants/combinations.php
+++ b/htdocs/variants/combinations.php
@@ -305,12 +305,37 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST(
}
}
- if ($prodcomb->update($user) > 0) {
+ $error = 0;
+ $db->begin();
+
+ // Update product variant ref
+ $product_child = new Product($db);
+ $product_child->fetch($prodcomb->fk_product_child);
+ $product_child->oldcopy = clone $product_child;
+ $product_child->ref = $reference;
+
+ $result = $product_child->update($product_child->id, $user);
+ if ($result < 0) {
+ setEventMessages($product_child->error, $product_child->errors, 'errors');
+ $error++;
+ }
+
+ if (!$error) {
+ // Update product variant infos
+ $result = $prodcomb->update($user);
+ if ($result < 0) {
+ setEventMessages($prodcomb->error, $prodcomb->errors, 'errors');
+ $error++;
+ }
+ }
+
+ if (!$error) {
+ $db->commit();
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
- header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
+ header('Location: ' . dol_buildpath('/variants/combinations.php?id=' . $id, 2));
exit();
} else {
- setEventMessages($prodcomb->error, $prodcomb->errors, 'errors');
+ $db->rollback();
}
}
@@ -339,6 +364,9 @@ if ($action === 'confirm_deletecombination') {
exit();
}
+ $product_child = new Product($db);
+ $product_child->fetch($prodcomb->fk_product_child);
+ $reference = $product_child->ref;
$weight_impact = $prodcomb->variation_weight;
$price_impact = $prodcomb->variation_price;
$price_impact_percent = $prodcomb->variation_price_percentage;
diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php
index 28eb11dde90..e64aa8d837d 100644
--- a/htdocs/website/class/website.class.php
+++ b/htdocs/website/class/website.class.php
@@ -852,9 +852,9 @@ class Website extends CommonObject
}
/**
- * Retourne le libelle du status d'un user (actif, inactif)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
@@ -864,11 +864,11 @@ class Website extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un status donne
+ * Return the label of a given status
*
- * @param int $status Id status
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Label of status
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php
index 932762b3998..dbc66ff3ca4 100644
--- a/htdocs/website/class/websitepage.class.php
+++ b/htdocs/website/class/websitepage.class.php
@@ -795,9 +795,9 @@ class WebsitePage extends CommonObject
}
/**
- * Retourne le libelle du status d'un user (actif, inactif)
+ * Return the label of the status
*
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
public function getLibStatut($mode = 0)
@@ -807,11 +807,11 @@ class WebsitePage extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Renvoi le libelle d'un status donne
+ * Return the label of a given status
*
- * @param int $status Id status
- * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
- * @return string Label of status
+ * @param int $status Id status
+ * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+ * @return string Label of status
*/
public function LibStatut($status, $mode = 0)
{
diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php
index 4f07d48cd21..dcdde005130 100644
--- a/htdocs/workstation/class/workstation.class.php
+++ b/htdocs/workstation/class/workstation.class.php
@@ -156,8 +156,6 @@ class Workstation extends CommonObject
$this->db = $db;
- $this->fields['ref']['default'] = $this->getNextNumRef();
-
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
$this->fields['rowid']['visible'] = 0;
}
diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php
index 821317ba270..37d7b079c8a 100644
--- a/htdocs/workstation/workstation_card.php
+++ b/htdocs/workstation/workstation_card.php
@@ -148,8 +148,6 @@ if (empty($reshook)) {
/*
* View
- *
- * Put here all code to build page
*/
$form = new Form($db);
@@ -190,6 +188,9 @@ llxHeader('', $title, $help_url);
// Part to create
if ($action == 'create') {
+ // Set default value of the property ref
+ $object->fields['ref']['default'] = $object->getNextNumRef();
+
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Workstation")), '', 'object_'.$object->picto);
print ' |