From 179309710cb71c927a4905a630a25a1f4ed297e4 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 6 May 2015 16:44:47 +0200 Subject: [PATCH 1/3] Fix: use global $object instead parameter --- htdocs/core/lib/files.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index bcc6c165472..c6d94f17e76 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -726,13 +726,13 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable * @param int $disableglob Disable usage of glob like * * @param int $nophperrors Disable all PHP output errors * @param int $nohook Disable all hooks - * @param object $object Current object in use + * @deprecated object $object Current object in use * @return boolean True if file is deleted (or if glob is used and there's nothing to delete), False if error */ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null) { global $db, $conf, $user, $langs; - global $hookmanager; + global $object, $hookmanager; $langs->load("other"); $langs->load("errors"); From 1b56144cb8cf5b86d0e44859efc5874612eabc64 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 7 May 2015 11:41:14 +0200 Subject: [PATCH 2/3] Revert "Fix: use global $object instead parameter" This reverts commit 179309710cb71c927a4905a630a25a1f4ed297e4. --- htdocs/core/lib/files.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index c6d94f17e76..bcc6c165472 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -726,13 +726,13 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable * @param int $disableglob Disable usage of glob like * * @param int $nophperrors Disable all PHP output errors * @param int $nohook Disable all hooks - * @deprecated object $object Current object in use + * @param object $object Current object in use * @return boolean True if file is deleted (or if glob is used and there's nothing to delete), False if error */ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null) { global $db, $conf, $user, $langs; - global $object, $hookmanager; + global $hookmanager; $langs->load("other"); $langs->load("errors"); From 9a32d7ec2f6a1735609eaf8b469774c17f4d72a8 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 7 May 2015 11:59:45 +0200 Subject: [PATCH 3/3] Fix: add $object for use with triggers --- htdocs/product/class/product.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2987d0de8fd..c1497ce19ee 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2014 Laurent Destailleur - * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2005-2015 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007-2011 Jean Heimburger * Copyright (C) 2010-2013 Juanjo Menent @@ -1482,7 +1482,7 @@ class Product extends CommonObject $this->date_modification = $obj->tms; $this->import_key = $obj->import_key; $this->entity = $obj->entity; - + $this->ref_ext = $obj->ref_ext; $this->db->free($resql); @@ -3376,7 +3376,7 @@ class Product extends CommonObject $filename = preg_replace('/'.preg_quote($dir,'/').'/i','',$file); // Nom du fichier // On efface l'image d'origine - dol_delete_file($file); + dol_delete_file($file, 0, 0, 0, $this); // For triggers // Si elle existe, on efface la vignette if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$filename,$regs))