diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 7e85625ac36..cd721792c61 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1845,7 +1845,9 @@ class Propal extends CommonObject if (! dol_delete_file($file,0,0,0,$this)) // For triggers { - $this->db->rollback(); + $this->error='ErrorFailToDeleteFile'; + $this->errors=array('ErrorFailToDeleteFile'); + $this->db->rollback(); return 0; } } @@ -1855,6 +1857,7 @@ class Propal extends CommonObject if (! $res) { $this->error='ErrorFailToDeleteDir'; + $this->errors=array('ErrorFailToDeleteDir'); $this->db->rollback(); return 0; } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 057f4b04794..226751306db 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2262,7 +2262,8 @@ class Commande extends CommonOrder } else { - $this->error=$this->db->error(); + $this->error=$this->db->lasterror(); + $this->errors=array($this->db->lasterror()); $this->db->rollback(); dol_syslog(get_class($this)."::updateline Error=".$this->error, LOG_ERR); return -1; @@ -2271,6 +2272,7 @@ class Commande extends CommonOrder else { $this->error=get_class($this)."::updateline Order status makes operation forbidden"; + $this->errors=array('OrderStatusMakeOperationForbidden'); return -2; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f3905deba6e..5cd0857f923 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1263,6 +1263,7 @@ class Facture extends CommonInvoice if (! dol_delete_file($file,0,0,0,$this)) // For triggers { + $this->error=$langs->trans("ErrorCanNotDeleteFile",$file); $this->db->rollback(); return 0; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b3ceab6376a..1fda6c56670 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -688,7 +688,6 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec if ($ok) { dol_syslog("Removed file ".$filename, LOG_DEBUG); - setEventMessage($langs->trans("FileWasRemoved", basename($filename))); if (! $notrigger) { if (! is_object($object)) $object=(object) 'dummy'; @@ -705,7 +704,6 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec } else { dol_syslog("Failed to remove file ".$filename, LOG_WARNING); - setEventMessage($langs->trans("ErrorFailToDeleteFile", basename($filename)), 'errors'); } } } @@ -715,11 +713,9 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$notrigger=0,$objec else $ok=unlink($file_osencoded); // The unlink encapsulated by dolibarr if ($ok) { dol_syslog("Removed file ".$file_osencoded, LOG_DEBUG); - setEventMessage($langs->trans("FileWasRemoved", basename($file_osencoded))); } else { dol_syslog("Failed to remove file ".$file_osencoded, LOG_WARNING); - setEventMessage($langs->trans("ErrorFailToDeleteFile", basename($file_osencoded)), 'errors'); } } return $ok; @@ -878,7 +874,7 @@ function dol_meta_create($object) { //Pour les articles $meta .= "ITEM_" . $i . "_QUANTITY=\"" . $object->lines[$i]->qty . "\" - ITEM_" . $i . "_UNIT_PRICE=\"" . $object->lines[$i]->total_ht . "\" + ITEM_" . $i . "_TOTAL_HT=\"" . $object->lines[$i]->total_ht . "\" ITEM_" . $i . "_TVA=\"" .$object->lines[$i]->tva_tx . "\" ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($object->lines[$i]->desc)) . "\" "; @@ -926,6 +922,7 @@ function dol_init_file_process($pathtoscan='') /** * Get and save an upload file (for example after submitting a new file a mail form). * All information used are in db, conf, langs, user and _FILES. + * Note: This function can be used only into a HTML page context. * * @param string $upload_dir Directory to store upload files * @param int $allowoverwrite 1=Allow overwrite existing file diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index b4217bff558..7c624d24ae3 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -547,7 +547,10 @@ class Expedition extends CommonObject $file = $dir . "/" . $expeditionref . ".pdf"; if (file_exists($file)) { - dol_delete_file($file); + if (!dol_delete_file($file)) + { + $this->error=$langs->trans("ErrorCanNotDeleteFile",$file); + } } if (file_exists($dir)) { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 7bb03ff2198..466464dd37a 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -651,6 +651,7 @@ class Fichinter extends CommonObject if (! dol_delete_file($file,0,0,0,$this)) // For triggers { + $this->error=$langs->trans("ErrorCanNotDeleteFile",$file); return 0; } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a94b674b3e0..612bfb01ee0 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1322,6 +1322,7 @@ class CommandeFournisseur extends CommonOrder { if (! dol_delete_file($file,0,0,0,$this)) // For triggers { + $this->error='ErrorFailToDeleteFile'; $error++; } } diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 5b9d5446c5b..77786d2c328 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -399,6 +399,7 @@ class Livraison extends CommonObject { if (! dol_delete_file($file)) { + $this->error=$langs->trans("ErrorCanNotDeleteFile",$file); return 0; } }