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);