Merge pull request #1041 from FHenry/develop

Add hook into referent product screen
This commit is contained in:
Laurent Destailleur 2013-06-11 02:56:37 -07:00
commit bf2fa31585
6 changed files with 53 additions and 0 deletions

View File

@ -41,6 +41,9 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('productstatsorder'));
$mesg = ''; $mesg = '';
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -65,6 +68,10 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($id, $ref); $result = $product->fetch($id, $ref);
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
if ($result > 0) if ($result > 0)
@ -77,6 +84,8 @@ if ($id > 0 || ! empty($ref))
$picto=($product->type==1?'service':'product'); $picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto); dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -41,6 +41,9 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('productstatssupplyorder'));
$mesg = ''; $mesg = '';
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -65,6 +68,10 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($id, $ref); $result = $product->fetch($id, $ref);
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
if ($result > 0) if ($result > 0)
@ -74,6 +81,8 @@ if ($id > 0 || ! empty($ref))
$picto=($product->type==1?'service':'product'); $picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto); dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference

View File

@ -41,6 +41,9 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('productstatscontract'));
$mesg = ''; $mesg = '';
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -68,6 +71,10 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($id, $ref); $result = $product->fetch($id, $ref);
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
if ($result > 0) if ($result > 0)
@ -77,6 +84,8 @@ if ($id > 0 || ! empty($ref))
$picto=($product->type==1?'service':'product'); $picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto); dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference

View File

@ -43,6 +43,9 @@ $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref : ''));
$fieldtype = (! empty($ref) ? 'ref' : 'rowid'); $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('productstatsinvoice'));
$mesg = ''; $mesg = '';
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -70,6 +73,9 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($id, $ref); $result = $product->fetch($id, $ref);
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
/* /*
@ -82,6 +88,8 @@ if ($id > 0 || ! empty($ref))
$picto=($product->type==1?'service':'product'); $picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto); dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Reference // Reference

View File

@ -42,6 +42,9 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('productstatssupplyinvoice'));
$mesg = ''; $mesg = '';
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -55,6 +58,7 @@ if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.datef"; if (! $sortfield) $sortfield="f.datef";
/* /*
* View * View
*/ */
@ -68,6 +72,10 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($id, $ref); $result = $product->fetch($id, $ref);
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
if ($result > 0) if ($result > 0)
@ -80,6 +88,8 @@ if ($id > 0 || ! empty($ref))
$picto=($product->type==1?'service':'product'); $picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre, 0, $picto); dol_fiche_head($head, 'referers', $titre, 0, $picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';

View File

@ -41,6 +41,9 @@ $fieldtype = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype); $result=restrictedArea($user,'produit|service',$fieldvalue,'product&product','','',$fieldtype);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('productstatspropal'));
$mesg = ''; $mesg = '';
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@ -64,6 +67,9 @@ if ($id > 0 || ! empty($ref))
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($id, $ref); $result = $product->fetch($id, $ref);
$parameters=array('id'=>$id);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$product,$action); // Note that $action and $object may have been modified by some hooks
llxHeader("","",$langs->trans("CardProduct".$product->type)); llxHeader("","",$langs->trans("CardProduct".$product->type));
if ($result > 0) if ($result > 0)
@ -73,6 +79,8 @@ if ($id > 0 || ! empty($ref))
$picto=($product->type==1?'service':'product'); $picto=($product->type==1?'service':'product');
dol_fiche_head($head, 'referers', $titre,0,$picto); dol_fiche_head($head, 'referers', $titre,0,$picto);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$product,$action); // Note that $action and $object may have been modified by hook
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';