From 59f424bde3df84484cbb67513dc9ceb3205b4067 Mon Sep 17 00:00:00 2001 From: FHenry Date: Wed, 29 Feb 2012 14:32:22 +0100 Subject: [PATCH] add hook for select produit --- htdocs/fourn/commande/fiche.php | 11 +++++++++++ htdocs/fourn/facture/fiche.php | 12 ++++++++++++ htdocs/product/fournisseurs.php | 13 ++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index b30dd309167..ef5e30ff7d2 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -59,6 +59,11 @@ $projectid = GETPOST("projectid"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'commande_fournisseur', $id,''); +// 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); +$hookmanager->callHooks(array('fournordercard')); + $mesg=''; $object = new CommandeFournisseur($db); @@ -1318,6 +1323,12 @@ if ($id > 0 || ! empty($ref)) if (! $conf->global->PRODUIT_USE_SEARCH_TO_SELECT) print '
'; + if (is_object($hookmanager)) + { + $parameters=array('filtre'=>$filtre); + echo $hookmanager->executeHooks('formCreateProductFournOptions',$parameters,$object,$action); + } + // Editor wysiwyg require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); $nbrows=ROWS_2; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 001666bea71..2769bb79adc 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -50,6 +50,11 @@ $confirm = GETPOST("confirm"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture'); +// 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); +$hookmanager->callHooks(array('fournpricecard')); + $object=new FactureFournisseur($db); @@ -1645,6 +1650,13 @@ else print ''; print ''; $form->select_produits_fournisseurs($object->socid,'','idprodfournprice','',$filtre); + + if (is_object($hookmanager)) + { + $parameters=array('filtre'=>$filtre); + echo $hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); + } + print ''; print ''; print ' '; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index b274009897a..d9a48c6d8d7 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -53,6 +53,11 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : '')); $fieldtype = (! empty($ref) ? 'ref' : 'rowid'); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'produit|service&fournisseur',$fieldvalue,'product&product','','',$fieldtype); +// 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); +$hookmanager->callHooks(array('fournpricecard')); + $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -273,7 +278,13 @@ if ($id || $ref) } else { - print $form->select_company($_POST["id_fourn"],'id_fourn','fournisseur=1',1); + print $form->select_company(GETPOST("id_fourn"),'id_fourn','fournisseur=1',1); + + if (is_object($hookmanager)) + { + $parameters=array('filtre'=>"fournisseur=1",'html_name'=>'id_fourn','selected'=>GETPOST("id_fourn"),'showempty'=>1,'prod_id'=>$product->id); + echo $hookmanager->executeHooks('formCreateCompagnyOptions',$parameters,$object,$action); + } } print '';