Qual: Uniformize hook names. All hooks to add information on

create/update/view cards are called fomrObjectOptions instead of
sometine formObjectOptions, sometimes showInputFields, sometimes
showOutputFields.
This commit is contained in:
Laurent Destailleur 2012-02-06 17:18:19 +01:00
parent 45268578d5
commit 6cb0685b6f
11 changed files with 189 additions and 104 deletions

View File

@ -770,19 +770,19 @@ if ($action == 'create')
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:'');
print "<tr><td>".$label.'</td><td>';
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
/*
/*
// Third party Dolibarr
if ($conf->societe->enabled)
{
@ -795,7 +795,8 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td class="valeur">';
print $form->select_users($object->user_id,'userid',1);
print '</td></tr>';
*/
*/
print "</table>\n";
print '<br>';
@ -848,8 +849,7 @@ if ($action == 'edit')
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
dol_htmloutput_errors($errmsg,$errmsgs);
if ($mesg) print '<div class="ok">'.$mesg.'</div>';
dol_htmloutput_mesg($mesg);
if ($conf->use_javascript_ajax)
{
@ -991,15 +991,15 @@ if ($action == 'edit')
// Other attributes
$parameters=array();
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_$key"])?$_POST["options_$key"]:$object->array_options["options_$key"]);
print "<tr><td>".$label."</td><td>";
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";
print '</td></tr>'."\n";
}
}

View File

@ -80,7 +80,7 @@ if ($action == 'create')
exit;
}
$propal = new Propal($db);
$object = new Propal($db);
$numpr='';
$obj = $conf->global->PROPALE_ADDON;
@ -90,7 +90,7 @@ if ($action == 'create')
{
require_once(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php");
$modPropale = new $obj;
$numpr = $modPropale->getNextValue($soc,$propal);
$numpr = $modPropale->getNextValue($soc,$object);
}
}
@ -175,12 +175,12 @@ if ($action == 'create')
// What trigger creation
print '<tr><td>'.$langs->trans('Source').'</td><td>';
$form->select_demand_reason($propal->demand_reason,'demand_reason_id',"SRC_PROP",1);
$form->select_demand_reason($object->demand_reason,'demand_reason_id',"SRC_PROP",1);
print '</td></tr>';
// Delivery delay
print '<tr><td>'.$langs->trans('AvailabilityPeriod').'</td><td colspan="2">';
$form->select_availability($propal->availability,'availability_id','',1);
$form->select_availability($object->availability,'availability_id','',1);
print '</td></tr>';
// Delivery date (or manufacturing)
@ -240,10 +240,19 @@ if ($action == 'create')
print '</tr>';
}
// Insert hooks
$parameters=array('socid'=>$socid);
$object=new Propal($db);
// Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
print "</table>";
print '<br>';

View File

@ -745,7 +745,7 @@ else if ($action == "addline" && $user->rights->propale->creer)
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
}
}
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
@ -758,7 +758,7 @@ else if ($action == "addline" && $user->rights->propale->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
}
else
@ -1144,7 +1144,7 @@ if ($id > 0 || ! empty($ref))
if (! $formconfirm)
{
$parameters=array('lineid'=>$lineid);
$formconfirm=$hookmanager->executeHooks('formconfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
}
// Print form confirm
@ -1468,9 +1468,19 @@ if ($id > 0 || ! empty($ref))
print '</tr>';
}
// Insert hooks
$parameters=array('colspan'=>' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Amount HT
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';

View File

@ -917,7 +917,7 @@ class Propal extends CommonObject
{
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}

View File

@ -112,8 +112,8 @@ class Commande extends CommonObject
$this->products = array();
}
/**
/**
* Returns the reference to the following non used Order depending on the active numbering module
* defined into COMMANDE_ADDON
*
@ -448,7 +448,7 @@ class Commande extends CommonObject
/**
* Close order
*
*
* @param User $user Objet user that close
* @return int <0 if KO, >0 if OK
*/
@ -504,7 +504,7 @@ class Commande extends CommonObject
/**
* Cancel an order
* If stock is decremented on order validation, we must reincrement it
*
*
* @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK
*/
@ -531,7 +531,7 @@ class Commande extends CommonObject
{
require_once(DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php");
$langs->load("agenda");
$num=count($this->lines);
for ($i = 0; $i < $num; $i++)
{
@ -581,7 +581,7 @@ class Commande extends CommonObject
/**
* Create order
* Note that this->ref can be set or empty. If empty, we will use "(PROV)"
*
*
* @param User $user Objet user that make creation
* @param int notrigger Disable all triggers
* @return int <0 if KO, >0 if OK
@ -825,7 +825,7 @@ class Commande extends CommonObject
{
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
@ -921,7 +921,7 @@ class Commande extends CommonObject
$parameters=array('objFrom'=>$object);
$action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
if (! $error)
@ -944,7 +944,7 @@ class Commande extends CommonObject
/**
* Add an order line into database (linked to product/service or not)
*
*
* @param int $commandeid Id of line
* @param string $desc Description of line
* @param double $pu_ht Unit price (without tax)
@ -1112,7 +1112,7 @@ class Commande extends CommonObject
* @param timestamp $date_start Start date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @param timestamp $date_end End date of the line - Added by Matelli (See http://matelli.fr/showcases/patchs-dolibarr/add-dates-in-order-lines.html)
* @return void
*
*
* TODO Remplacer les appels a cette fonction par generation objet Ligne
* insere dans tableau $this->products
*/
@ -1316,7 +1316,7 @@ class Commande extends CommonObject
/**
* Adding line of fixed discount in the order in DB
*
*
* @param int $idremise Id de la remise fixe
* @return int >0 si ok, <0 si ko
*/
@ -1392,7 +1392,7 @@ class Commande extends CommonObject
/**
* Load array lines
*
*
* @param int $only_product Return only physical products
* @return int <0 if KO, >0 if OK
*/
@ -1494,10 +1494,10 @@ class Commande extends CommonObject
/**
* Load array this->expeditions of nb of products sent by line in order
*
*
* @param int $filtre_statut Filter on status
* @return int <0 if KO, Nb of lines found if OK
*
*
* TODO deprecated, move to Shipping class
*/
function loadExpeditions($filtre_statut=-1)
@ -1544,7 +1544,7 @@ class Commande extends CommonObject
/**
* Returns a array with expeditions lines number
*
*
* TODO deprecated, move to Shipping class
*/
function nb_expedition()
@ -1567,7 +1567,7 @@ class Commande extends CommonObject
/**
* Return a array with sendings by line
*
*
* @param int $filtre_statut Filtre sur statut
* @return int 0 si OK, <0 si KO
*
@ -1582,10 +1582,10 @@ class Commande extends CommonObject
/**
* Return a array with the pending stock by product
*
*
* @param int $filtre_statut Filtre sur statut
* @return int 0 si OK, <0 si KO
*
*
* TODO FONCTION NON FINIE A FINIR
*/
function stock_array($filtre_statut=-1)
@ -1594,7 +1594,7 @@ class Commande extends CommonObject
// Tableau des id de produit de la commande
$array_of_product=array();
// Recherche total en stock pour chaque produit
if (count($array_of_product))
@ -1622,7 +1622,7 @@ class Commande extends CommonObject
/**
* Delete an order line
*
*
* @param int $lineid Id of line to delete
* @return int >0 if OK, 0 if nothing to do, <0 if KO
*/
@ -2038,7 +2038,7 @@ class Commande extends CommonObject
/**
* Change le delai de livraison
*
*
* @param int $availability_id Id du nouveau mode
* @return int >0 if OK, <0 if KO
*/
@ -2403,7 +2403,7 @@ class Commande extends CommonObject
/**
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
*
*
* @param User $user Object user
* @return int <0 if KO, >0 if OK
*/
@ -2756,7 +2756,7 @@ class Commande extends CommonObject
/**
* Return an array of order lines
*
*
* @return array Lines of order
*/
function getLinesArray()
@ -2960,7 +2960,7 @@ class OrderLine
global $conf, $user, $langs;
$error=0;
$sql = 'DELETE FROM '.MAIN_DB_PREFIX."commandedet WHERE rowid='".$this->rowid."';";
dol_syslog("OrderLine::delete sql=".$sql);
@ -2995,7 +2995,7 @@ class OrderLine
global $langs, $conf, $user;
$error=0;
dol_syslog("OrderLine::insert rang=".$this->rang);
// Clean parameters
@ -3095,7 +3095,7 @@ class OrderLine
global $conf,$langs,$user;
$error=0;
// Clean parameters
if (empty($this->tva_tx)) $this->tva_tx=0;
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;

View File

@ -303,7 +303,7 @@ if ($action == 'add' && $user->rights->commande->creer)
// Hooks
$parameters=array('objFrom'=>$srcobject);
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) $error++;
}
else
@ -552,7 +552,7 @@ if ($action == 'addline' && $user->rights->commande->creer)
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
}
}
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
@ -565,7 +565,7 @@ if ($action == 'addline' && $user->rights->commande->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"])) ? $prod->multilangs[$outputlangs->defaultlang]["description"] : $prod->description;
}
else
@ -1366,13 +1366,23 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td></tr>';
}
// Insert hooks
$parameters=array();
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Template to use by default
print '<tr><td>'.$langs->trans('Model').'</td>';
print '<td colspan="2">';
// pdf
include_once(DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php');
$liste=ModelePDFCommandes::liste_modeles($db);
print $form->selectarray('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
@ -1643,7 +1653,7 @@ else
if (! $formconfirm)
{
$parameters=array('lineid'=>$lineid);
$formconfirm=$hookmanager->executeHooks('formconfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
}
// Print form confirm
@ -1908,11 +1918,19 @@ else
print '</td></tr>';
}
// Insert hooks
$parameters=array('colspan'=>' colspan="2"');
// Other attributes
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
// Lignes de 3 colonnes
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Total HT
print '<tr><td>'.$langs->trans('AmountHT').'</td>';

View File

@ -856,7 +856,7 @@ if ($action == 'add' && $user->rights->facture->creer)
// Hooks
$parameters=array('objFrom'=>$srcobject);
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) $error++;
}
else
@ -1801,9 +1801,19 @@ if ($action == 'create')
print '</td></tr>';
}
// Insert hooks
$parameters=array();
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Modele PDF
print '<tr><td>'.$langs->trans('Model').'</td>';
@ -2197,7 +2207,7 @@ else
if (! $formconfirm)
{
$parameters=array('lineid'=>$lineid);
$formconfirm=$hookmanager->executeHooks('formconfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
}
// Print form confirm
@ -2700,9 +2710,19 @@ else
print '</tr>';
}
// Insert hooks
$parameters=array('colspan'=>' colspan="3"');
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
print '</table><br>';

View File

@ -557,7 +557,7 @@ class Facture extends CommonObject
{
$parameters=array('objFrom'=>$objFrom);
$action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
@ -653,7 +653,7 @@ class Facture extends CommonObject
$parameters=array('objFrom'=>$object);
$action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
if (! $error)

View File

@ -124,8 +124,8 @@ class HookManager
* @param array $parameters Array of parameters
* @param Object &$object Object to use hooks on
* @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @return mixed For doActions,showInputField,showOutputField: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO.
* For printSearchForm,printLeftBlock: Return HTML string.
* @return mixed For doActions,formObjectOptions: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO.
* For printSearchForm,printLeftBlock: Return HTML string.
* $this->error or this->errors are also defined by class called by this function if error.
*/
function executeHooks($method, $parameters=false, &$object='', &$action='')
@ -148,30 +148,17 @@ class HookManager
$var=!$var;
// Hooks that return int
if ($method == 'doActions' && method_exists($actioninstance,$method))
if (($method == 'doActions' || $method='formObjectOptions') && method_exists($actioninstance,$method))
{
$resaction+=$actioninstance->doActions($parameters, $object, $action); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example)
if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0))
{
$this->error=$actioninstance->error; $this->errors=$actioninstance->errors;
if ($action=='add') $action='create'; // TODO this change must be inside the doActions
if ($action=='update') $action='edit'; // TODO this change must be inside the doActions
}
}
else if ($method == 'showInputFields' && method_exists($actioninstance,$method))
{
$resaction+=$actioninstance->showInputFields($parameters, $object, $action); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example)
if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0))
{
$this->error=$actioninstance->error; $this->errors=$actioninstance->errors;
}
}
else if ($method == 'showOutputFields' && method_exists($actioninstance,$method))
{
$resaction+=$actioninstance->showOutputFields($parameters, $object, $action); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example)
$resaction+=$actioninstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0))
{
$this->error=$actioninstance->error; $this->errors=$actioninstance->errors;
if ($method == 'doActions')
{
if ($action=='add') $action='create'; // TODO this change must be inside the doActions
if ($action=='update') $action='edit'; // TODO this change must be inside the doActions
}
}
}
// Generic hooks that return a string (printSearchForm, printLeftBlock, formBuilddocOptions, ...)
@ -184,7 +171,7 @@ class HookManager
}
}
if ($method == 'doActions' || $method == 'showInputFields' || $method == 'showOutputFields') return $resaction;
if ($method == 'doActions' || $method == 'formObjectOptions') return $resaction;
return $resprint;
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -780,7 +780,21 @@ else
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>';
// Note (invisible sur facture, propales...)
// Other attributes
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Note (private, no output on invoices, propales...)
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note',$_POST["note"],'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70);
@ -970,6 +984,20 @@ else
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Note
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
@ -1183,6 +1211,19 @@ else
// Origin country code
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id,0,$db).'</td>';
// Other attributes
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">'.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'</td></tr>';

View File

@ -940,13 +940,13 @@ else
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:'');
print "<tr><td>".$label.'</td><td colspan="3">';
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
@ -1368,13 +1368,13 @@ else
// Other attributes
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_$key"])?$_POST["options_$key"]:$object->array_options["options_$key"]);
print "<tr><td>".$label."</td><td colspan=\"3\">";
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";
}
@ -1717,13 +1717,13 @@ else
// Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('showOutputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=$object->array_options["options_$key"];
print "<tr><td>".$label.'</td><td colspan="3">';
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";
}