diff --git a/ChangeLog b/ChangeLog index ecd695878e02f9f01d7b1f0b985ca2b7cf2fc934..40cdcd4225214bd5398cc627104001996629bef2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -36,8 +36,9 @@ Fix: If multiprice level is used the VAT on addline is not correct Fix: [ bug #1254 ] Error when using "Enter" on qty input box of a product (on supplier order part) Fix: [ bug #1462, 1468, 1480, 1483, 1490, 1497] $this instead of $object Fix: [ bug #1455 ] outstanding amount -Fix: [ bug #1425 ] Fix: [ bug #1425 ] LINEBILL_SUPPLIER_DELETE failure trigger leads to an endless loop +Fix: [ bug #1460 ] Several supplier order triggers do not show error messages +Fix: [ bug #1461 ] LINEORDER_SUPPLIER_CREATE does not intercept supplier order line insertion ***** ChangeLog for 3.5.3 compared to 3.5.2 ***** Fix: Error on field accountancy code for export profile of invoices. diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN index e3257e2bda864c7b3b0c8d1241346cb546dd68f1..f8d58ab4c35e915160117bd904840156adb06468 100644 --- a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN +++ b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN @@ -257,10 +257,30 @@ class InterfaceDemo { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + elseif ($action == 'ORDER_SUPPLIER_CLONE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } + elseif ($action == 'ORDER_SUPPLIER_DELETE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_SUPPLIER_APPROVE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_SUPPLIER_REFUSE') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } + elseif ($action == 'ORDER_SUPPLIER_CANCEL') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -421,6 +441,8 @@ class InterfaceDemo } elseif ($action == 'LINEBILL_SUPPLIER_DELETE') { + $object->error='Erreur trigger'; + return -1; dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c67b15bc61926873ae373d88b1fd1f0684545dba..0a0067f1105c11d4bbd39a514c30b73096a52b58 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -390,7 +390,13 @@ class CommandeFournisseur extends CommonOrder include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + if ($result < 0) + { + $error++; + $this->errors=$interface->errors; + $this->db->rollback(); + return -1; + } // Fin appel triggers } @@ -401,9 +407,9 @@ class CommandeFournisseur extends CommonOrder } else { + $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); $this->db->rollback(); - $this->error=$this->db->lasterror(); return -1; } } @@ -743,8 +749,7 @@ class CommandeFournisseur extends CommonOrder } else { - $this->db->rollback(); - $this->error=$this->db->lasterror(); + $this->db->rollback(); return -1; } } @@ -779,9 +784,11 @@ class CommandeFournisseur extends CommonOrder $result = 0; if ($user->rights->fournisseur->commande->approuver) { + $this->db->begin(); + $sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 9"; - $sql .= " WHERE rowid = ".$this->id; - + $sql .= " WHERE rowid = ".$this->id; + if ($this->db->query($sql)) { $result = 0; @@ -793,12 +800,19 @@ class CommandeFournisseur extends CommonOrder include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_SUPPLIER_REFUSE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + if ($result < 0) + { + $error++; + $this->errors=$interface->errors; + $this->db->rollback(); + } // Fin appel triggers } } else { + $this->db->rollback(); + $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::refuse Error -1"); $result = -1; } @@ -855,7 +869,6 @@ class CommandeFournisseur extends CommonOrder else { $this->db->rollback(); - $this->error=$this->db->lasterror(); return -1; } } @@ -1039,7 +1052,13 @@ class CommandeFournisseur extends CommonOrder include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers('ORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + if ($result < 0) + { + $error++; + $this->errors=$interface->errors; + $this->db->rollback(); + return -1; + } // Fin appel triggers } @@ -1286,7 +1305,13 @@ class CommandeFournisseur extends CommonOrder include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers('LINEORDER_SUPPLIER_CREATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + if ($result < 0) + { + $error++; + $this->errors=$interface->errors; + $this->db->rollback(); + return -1; + } // Fin appel triggers } @@ -1351,7 +1376,13 @@ class CommandeFournisseur extends CommonOrder include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers('LINEORDER_SUPPLIER_DISPATCH',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + if ($result < 0) + { + $error++; + $this->errors=$interface->errors; + $this->db->rollback(); + return -1; + } // Fin appel triggers } @@ -1380,6 +1411,7 @@ class CommandeFournisseur extends CommonOrder } } + //TODO: Check if there is a current transaction in DB but seems not. if ($error == 0) { $this->db->commit(); @@ -1410,7 +1442,8 @@ class CommandeFournisseur extends CommonOrder { $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idligne; $resql=$this->db->query($sql); - + + //TODO: Add trigger for deleted line dol_syslog(get_class($this)."::deleteline sql=".$sql); if ($resql) { @@ -1457,11 +1490,13 @@ class CommandeFournisseur extends CommonOrder { if ($this->db->affected_rows($resql) < 1) { + $this->error=$this->db->lasterror(); $error++; } } else { + $this->error=$this->db->lasterror(); $error++; } @@ -1524,7 +1559,6 @@ class CommandeFournisseur extends CommonOrder } else { - $this->error=$this->db->lasterror(); dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -$error; @@ -1725,7 +1759,7 @@ class CommandeFournisseur extends CommonOrder $resql = $this->db->query($sql); if ($resql) { - + //TODO: Add trigger for status modification } else { @@ -1849,7 +1883,13 @@ class CommandeFournisseur extends CommonOrder include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; $interface=new Interfaces($this->db); $result=$interface->run_triggers('LINEORDER_SUPPLIER_UPDATE',$this,$user,$langs,$conf); - if ($result < 0) { $error++; $this->errors=$interface->errors; } + if ($result < 0) + { + $error++; + $this->errors=$interface->errors; + $this->db->rollback(); + return -1; + } // Fin appel triggers } diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 24b80a60f94c329a0c761e8e1306dd9ae2441d28..04a3b90581dfadbc5f0286649d8d26a721e21257 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -931,7 +931,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G if ($error) { - dol_print_error($db); + setEventMessage($object->error, 'errors'); } else { @@ -1057,6 +1057,7 @@ if ($action=="create") print_fiche_titre($langs->trans('NewOrder')); dol_htmloutput_mesg($mesg); + dol_htmloutput_events(); $societe=''; if ($socid>0)