diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index 525b4d1fa2f..20da4a4e550 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -1025,24 +1025,25 @@ class EmailCollector extends CommonObject
}
}
}
+
if (preg_match('/^options_/', $tmpproperty)) {
- $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> found '.dol_escape_htmltag(dol_trunc($object->array_options[preg_replace('/^options_/', '', $tmpproperty)], 128));
+ $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> extract '.dol_escape_htmltag(dol_trunc($object->array_options[preg_replace('/^options_/', '', $tmpproperty)], 128)).' so object extrafield '.dol_escape_htmltag($tmpproperty).' is set.';
} else {
if (property_exists($object, $tmpproperty)) {
- $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> found '.dol_escape_htmltag(dol_trunc($object->$tmpproperty, 128));
+ $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> extract '.dol_escape_htmltag(dol_trunc($object->$tmpproperty, 128)).' so object property '.dol_escape_htmltag($tmpproperty).' is set.';
} else {
- $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> found '.dol_escape_htmltag(dol_trunc($tmp[$tmpproperty], 128));
+ $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> extract '.dol_escape_htmltag(dol_trunc($tmp[$tmpproperty], 128)).' so var '.dol_escape_htmltag($tmpproperty).' is set.';
}
}
} else {
// Regex not found
if (property_exists($object, $tmpproperty)) {
$object->$tmpproperty = null;
+ $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> not found, so object property '.dol_escape_htmltag($tmpproperty).' is set to null.';
} else {
$tmp[$tmpproperty] = null;
+ $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> not found, so var '.dol_escape_htmltag($tmpproperty).' is set to null.';
}
-
- $operationslog .= '
Regex /'.dol_escape_htmltag($regexstring).'/'.dol_escape_htmltag($regexoptions).' into '.strtolower($sourcefield).' -> not found, so property '.dol_escape_htmltag($tmpproperty).' is set to null.';
}
} else {
// Nothing can be done for this param
@@ -2691,7 +2692,8 @@ class EmailCollector extends CommonObject
$this->error = 'Error when getting thirdparty with name '.$nametouseforthirdparty.' (may be 2 record exists with same name ?)';
$this->errors[] = $this->error;
break;
- } elseif ($result == 0) { // No thirdparty found
+ }
+ if ($result == 0) { // No thirdparty found
if ($operation['type'] == 'loadthirdparty') {
dol_syslog("Third party with id=".$idtouseforthirdparty." email=".$emailtouseforthirdparty." name=".$nametouseforthirdparty." name_alias=".$namealiastouseforthirdparty." was not found");
@@ -2753,7 +2755,7 @@ class EmailCollector extends CommonObject
}
}
}
- } else { // $result > 0 is ID of thirdparty
+ } else { // if $result > 0, it is ID of thirdparty
dol_syslog("One and only one existing third party has been found");
$thirdpartystatic->fetch($result);
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index c947426fc41..60240fa1fce 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -1913,7 +1913,7 @@ class Societe extends CommonObject
* @param string $ref_alias Name_alias of third party (Warning, this can return several records)
* @param int $is_client Only client third party
* @param int $is_supplier Only supplier third party
- * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found.
+ * @return int >0 if OK, <0 if KO (-2 if two records found for same ref or idprof, other negative for error), 0 if not found.
*/
public function fetch($rowid, $ref = '', $ref_ext = '', $barcode = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '', $is_client = 0, $is_supplier = 0)
{
@@ -2042,7 +2042,7 @@ class Societe extends CommonObject
$num = $this->db->num_rows($resql);
if ($num > 1) {
$this->error = 'Fetch found several records. Rename one of thirdparties to avoid duplicate.';
- dol_syslog($this->error, LOG_ERR);
+ dol_syslog($this->error, LOG_WARNING);
$result = -2;
} elseif ($num) { // $num = 1
$obj = $this->db->fetch_object($resql);
@@ -2241,7 +2241,7 @@ class Societe extends CommonObject
* @param string $ref_alias Name_alias of third party (Warning, this can return several records)
* @param int $is_client Only client third party
* @param int $is_supplier Only supplier third party
- * @return int ID of thirdparty found if OK, <0 if KO or if two records found, 0 if not found.
+ * @return int ID of thirdparty found if OK, <0 if KO (-2 if two records found or other negative if error), 0 if not found.
*/
public function findNearest($rowid = 0, $ref = '', $ref_ext = '', $barcode = '', $idprof1 = '', $idprof2 = '', $idprof3 = '', $idprof4 = '', $idprof5 = '', $idprof6 = '', $email = '', $ref_alias = '', $is_client = 0, $is_supplier = 0)
{
@@ -2321,7 +2321,7 @@ class Societe extends CommonObject
$num = $this->db->num_rows($resql);
if ($num > 1) {
$this->error = 'Fetch found several records. Rename one of thirdparties to avoid duplicate.';
- dol_syslog($this->error, LOG_ERR);
+ dol_syslog($this->error, LOG_WARNING);
$result = -2;
} elseif ($num) {
$obj = $this->db->fetch_object($resql);
@@ -2374,7 +2374,7 @@ class Societe extends CommonObject
$num = $this->db->num_rows($resql);
if ($num > 1) {
$this->error = 'Fetch found several records. Rename one of thirdparties to avoid duplicate.';
- dol_syslog($this->error, LOG_ERR);
+ dol_syslog($this->error, LOG_WARNING);
$result = -2;
} elseif ($num) {
$obj = $this->db->fetch_object($resql);