From 4f8c485914e2e6494e9ccc8a98558d0d8dece08b 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 4b9e7eb520f..d8cd58fe12d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -728,13 +728,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 c6d841613bdbeef049bfe220f3616d02ded376c2 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 7 May 2015 11:42:35 +0200 Subject: [PATCH 2/3] Revert "Fix: use global $object instead parameter" This reverts commit 4f8c485914e2e6494e9ccc8a98558d0d8dece08b. --- 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 d8cd58fe12d..4b9e7eb520f 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -728,13 +728,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 5578151badd69eba8a1803aa41d224b560271fac 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 979c1a935f9..a0ade451c53 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-2014 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 @@ -3437,7 +3437,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('/('.$this->regeximgext.')$/i',$filename,$regs))