mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-12 19:02:35 +01:00
Better error management
This commit is contained in:
@@ -2691,7 +2691,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 +2754,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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user