add new rule

This commit is contained in:
Frédéric FRANCE
2020-05-21 15:05:19 +02:00
parent b58060f899
commit b41ac00b98
961 changed files with 9487 additions and 19110 deletions

View File

@@ -178,13 +178,11 @@ class Reception extends CommonObject
if ($numref != "")
{
return $numref;
}
else {
} else {
dol_print_error($this->db, get_class($this)."::getNextNumRef ".$obj->error);
return "";
}
}
else {
} else {
print $langs->trans("Error")." ".$langs->trans("Error_RECEPTION_ADDON_NUMBER_NotDefined");
return "";
}
@@ -322,8 +320,7 @@ class Reception extends CommonObject
{
$this->db->commit();
return $this->id;
}
else {
} else {
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
@@ -332,15 +329,13 @@ class Reception extends CommonObject
$this->db->rollback();
return -1 * $error;
}
}
else {
} else {
$error++;
$this->error = $this->db->lasterror()." - sql=$sql";
$this->db->rollback();
return -2;
}
}
else {
} else {
$error++;
$this->error = $this->db->error()." - sql=$sql";
$this->db->rollback();
@@ -467,14 +462,12 @@ class Reception extends CommonObject
}
return 1;
}
else {
} else {
dol_syslog(get_class($this).'::Fetch no reception found', LOG_ERR);
$this->error = 'Delivery with id '.$id.' not found';
return 0;
}
}
else {
} else {
$this->error = $this->db->error();
return -1;
}
@@ -523,8 +516,7 @@ class Reception extends CommonObject
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$numref = $this->getNextNumRef($soc);
}
else {
} else {
$numref = $this->ref;
}
@@ -594,8 +586,7 @@ class Reception extends CommonObject
$this->errors = array_merge($this->errors, $mouvS->errors);
break;
}
}
else {
} else {
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
@@ -609,8 +600,7 @@ class Reception extends CommonObject
}
}
}
}
else {
} else {
$this->db->rollback();
$this->error = $this->db->error();
return -2;
@@ -684,8 +674,7 @@ class Reception extends CommonObject
{
$this->db->commit();
return 1;
}
else {
} else {
foreach ($this->errors as $errmsg)
{
dol_syslog(get_class($this)."::valid ".$errmsg, LOG_ERR);
@@ -856,8 +845,7 @@ class Reception extends CommonObject
}
$this->db->rollback();
return -1 * $error;
}
else {
} else {
$this->db->commit();
return 1;
}
@@ -910,8 +898,7 @@ class Reception extends CommonObject
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed
}
}
else {
} else {
$error++; $this->errors[] = "Error ".$this->db->lasterror();
}
}
@@ -987,31 +974,26 @@ class Reception extends CommonObject
}
return 1;
}
else {
} else {
$this->db->rollback();
return -1;
}
}
else {
} else {
$this->error = $this->db->lasterror()." - sql=$sql";
$this->db->rollback();
return -3;
}
}
else {
} else {
$this->error = $this->db->lasterror()." - sql=$sql";
$this->db->rollback();
return -2;
}
}
else {
} else {
$this->error = $this->db->lasterror()." - sql=$sql";
$this->db->rollback();
return -1;
}
}
else {
} else {
$this->db->rollback();
return -1;
}
@@ -1069,8 +1051,7 @@ class Reception extends CommonObject
}
return 1;
}
else {
} else {
return -1;
}
}
@@ -1256,13 +1237,11 @@ class Reception extends CommonObject
{
$this->date_delivery = $date_livraison;
return 1;
}
else {
} else {
$this->error = $this->db->error();
return -1;
}
}
else {
} else {
return -2;
}
}
@@ -1345,8 +1324,7 @@ class Reception extends CommonObject
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)";
$sql .= " VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')";
$resql = $this->db->query($sql);
}
else {
} else {
$sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET";
$sql .= " code='".$this->db->escape($this->update['code'])."'";
$sql .= ",libelle='".$this->db->escape($this->update['libelle'])."'";
@@ -1421,8 +1399,7 @@ class Reception extends CommonObject
{
$url = str_replace('{TRACKID}', $value, $tracking);
$this->tracking_url = sprintf('<a target="_blank" href="%s">'.($value ? $value : 'url').'</a>', $url, $url);
}
else {
} else {
$this->tracking_url = $value;
}
}
@@ -1523,8 +1500,7 @@ class Reception extends CommonObject
$this->errors = $mouvS->errors;
$error++; break;
}
}
else {
} else {
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
@@ -1537,8 +1513,7 @@ class Reception extends CommonObject
}
}
}
}
else {
} else {
$this->error = $this->db->lasterror();
$error++;
}
@@ -1552,8 +1527,7 @@ class Reception extends CommonObject
$error++;
}
}
}
else {
} else {
dol_print_error($this->db);
$error++;
}
@@ -1562,8 +1536,7 @@ class Reception extends CommonObject
{
$this->db->commit();
return 1;
}
else {
} else {
$this->db->rollback();
return -1;
}
@@ -1607,8 +1580,7 @@ class Reception extends CommonObject
if (empty($error)) {
$this->db->commit();
return 1;
}
else {
} else {
$this->db->rollback();
return -1;
}
@@ -1683,8 +1655,7 @@ class Reception extends CommonObject
$this->errors = $mouvS->errors;
$error++; break;
}
}
else {
} else {
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
@@ -1696,8 +1667,7 @@ class Reception extends CommonObject
}
}
}
}
else {
} else {
$this->error = $this->db->lasterror();
$error++;
}
@@ -1726,8 +1696,7 @@ class Reception extends CommonObject
{
$this->db->commit();
return 1;
}
else {
} else {
$this->db->rollback();
return -1;
}
@@ -1816,8 +1785,7 @@ class Reception extends CommonObject
$error++;
break;
}
}
else {
} else {
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
@@ -1829,8 +1797,7 @@ class Reception extends CommonObject
}
}
}
}
else {
} else {
$this->error = $this->db->lasterror();
$error++;
}
@@ -1880,8 +1847,7 @@ class Reception extends CommonObject
$this->db->rollback();
return -1;
}
}
else {
} else {
$this->error = $this->db->error();
$this->db->rollback();
return -1;