diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 5822e6dd9d2..2b35cc38c4c 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1666,7 +1666,7 @@ class ActionComm extends CommonObject
}
$canread = 0;
- if (!empty($user->rights->agenda->myactions->read) && $this->authorid == $user->id) {
+ if ($user->hasRight('agenda', 'myactions', 'read') && ($this->authorid == $user->id || $this->userownerid == $user->id)) {
$canread = 1; // Can read my event
}
if (!empty($user->rights->agenda->myactions->read) && array_key_exists($user->id, $this->userassigned)) {
diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php
index ea776094625..12303f87ed8 100644
--- a/htdocs/comm/action/list.php
+++ b/htdocs/comm/action/list.php
@@ -934,6 +934,7 @@ while ($i < $imaxinloop) {
$actionstatic->datep = $db->jdate($obj->dp);
$actionstatic->percentage = $obj->percent;
$actionstatic->authorid = $obj->fk_user_author;
+ $actionstatic->userownerid = $obj->fk_user_action;
// Initialize $this->userassigned && this->socpeopleassigned array && this->userownerid
// but only if we need it
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 18306842df6..d3276916747 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.")";
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/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 '