New: Uniformize hooks.

This commit is contained in:
Laurent Destailleur 2013-03-27 14:24:33 +01:00
parent a22d39adfb
commit 6c1bbd3aeb

View File

@ -749,7 +749,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
{
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)); // Must not contain "
setEventMessage($mesg);
$error=0;
// Initialisation donnees
@ -1177,7 +1177,8 @@ if ($action == 'create')
if (1==2 && ! empty($conf->global->PRODUCT_SHOW_WHEN_CREATE))
{
print '<tr class="liste_titre">';
print '<td>&nbsp;</td><td>'.$langs->trans('Label').'</td>';
print '<td>&nbsp;</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
@ -1201,7 +1202,7 @@ if ($action == 'create')
}
// Other options
$parameters=array();
$parameters=array('colspan' => ' colspan="6"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Bouton "Create Draft"
@ -1571,7 +1572,7 @@ else
}
// Other options
$parameters=array('colspan' => ' colspan="3"');
$parameters=array('colspan' => ' colspan="4"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
print '</table>';
@ -1736,6 +1737,12 @@ else
// Show range
print_date_range($date_start,$date_end);
}
if (is_object($hookmanager))
{
$parameters=array('fk_parent_line'=>$line->fk_parent_line, 'line'=>$object->lines[$i],'var'=>$var,'num'=>$num,'i'=>$i);
$reshook=$hookmanager->executeHooks('formViewProductSupplierOptions',$parameters,$object,$action);
}
print '</td>';
// VAT
@ -1808,7 +1815,7 @@ else
if (is_object($hookmanager))
{
$parameters=array();
$reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action);
$reshook=$hookmanager->executeHooks('formCreateSupplierProductOptions',$parameters,$object,$action);
}
// Editor wysiwyg
@ -2036,7 +2043,7 @@ else
* Show mail form
*/
if ($action == 'presend')
{
{
$ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2).$ref, preg_quote($object->ref,'/'));
@ -2092,12 +2099,12 @@ else
$formmail->substit['__SIGNATURE__']=$user->signature;
$formmail->substit['__PERSONALIZED__']='';
$formmail->substit['__CONTACTCIVNAME__']='';
//Find the good contact adress
$custcontact='';
$contactarr=array();
$contactarr=$object->liste_contact(-1,'external');
if (is_array($contactarr) && count($contactarr)>0) {
foreach($contactarr as $contact) {
if ($contact['libelle']==$langs->trans('TypeContact_invoice_supplier_external_BILLING')) {
@ -2107,12 +2114,12 @@ else
$custcontact=$contactstatic->getFullName($langs,1);
}
}
if (!empty($custcontact)) {
$formmail->substit['__CONTACTCIVNAME__']=$custcontact;
}
}
// Tableau des parametres complementaires
$formmail->param['action']='send';
$formmail->param['models']='invoice_supplier_send';