From 8ec51c2a6b3d0f44c3dffdb21e8ee6db511faa61 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Thu, 10 May 2012 19:26:44 +0200 Subject: [PATCH] Fix: fetch object for hookmanager --- htdocs/commande/fiche.php | 10 ++++++++-- htdocs/compta/facture.php | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index a741e19a2e8..8dd59e31e15 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -58,12 +58,18 @@ $confirm = GETPOST('confirm'); $lineid = GETPOST('lineid'); $mesg = GETPOST('mesg'); -$object = new Commande($db); - // Security check if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'commande',$id,''); +$object = new Commande($db); + +// Load object +if ($id > 0 || ! empty($ref)) +{ + $ret=$object->fetch($id, $ref); +} + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); $hookmanager=new HookManager($db); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index d2688ff987d..5f3ee6d12f8 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -81,6 +81,12 @@ $usehm=$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE; $object=new Facture($db); +// Load object +if ($id > 0 || ! empty($ref)) +{ + $ret=$object->fetch($id, $ref); +} + // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); $hookmanager=new HookManager($db);