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:
parent
45268578d5
commit
6cb0685b6f
@ -770,13 +770,13 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array();
|
$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))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:'');
|
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||||
print "<tr><td>".$label.'</td><td>';
|
print '<tr><td>'.$label.'</td><td>';
|
||||||
print $extrafields->showInputField($key,$value);
|
print $extrafields->showInputField($key,$value);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
@ -796,6 +796,7 @@ if ($action == 'create')
|
|||||||
print $form->select_users($object->user_id,'userid',1);
|
print $form->select_users($object->user_id,'userid',1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
@ -848,8 +849,7 @@ if ($action == 'edit')
|
|||||||
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
|
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
|
||||||
|
|
||||||
dol_htmloutput_errors($errmsg,$errmsgs);
|
dol_htmloutput_errors($errmsg,$errmsgs);
|
||||||
|
dol_htmloutput_mesg($mesg);
|
||||||
if ($mesg) print '<div class="ok">'.$mesg.'</div>';
|
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
@ -991,15 +991,15 @@ if ($action == 'edit')
|
|||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array();
|
$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))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
$value=(isset($_POST["options_$key"])?$_POST["options_$key"]:$object->array_options["options_$key"]);
|
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||||
print "<tr><td>".$label."</td><td>";
|
print '<tr><td>'.$label.'</td><td>';
|
||||||
print $extrafields->showInputField($key,$value);
|
print $extrafields->showInputField($key,$value);
|
||||||
print "</td></tr>\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,7 +80,7 @@ if ($action == 'create')
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$propal = new Propal($db);
|
$object = new Propal($db);
|
||||||
|
|
||||||
$numpr='';
|
$numpr='';
|
||||||
$obj = $conf->global->PROPALE_ADDON;
|
$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");
|
require_once(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php");
|
||||||
$modPropale = new $obj;
|
$modPropale = new $obj;
|
||||||
$numpr = $modPropale->getNextValue($soc,$propal);
|
$numpr = $modPropale->getNextValue($soc,$object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,12 +175,12 @@ if ($action == 'create')
|
|||||||
|
|
||||||
// What trigger creation
|
// What trigger creation
|
||||||
print '<tr><td>'.$langs->trans('Source').'</td><td>';
|
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>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Delivery delay
|
// Delivery delay
|
||||||
print '<tr><td>'.$langs->trans('AvailabilityPeriod').'</td><td colspan="2">';
|
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>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Delivery date (or manufacturing)
|
// Delivery date (or manufacturing)
|
||||||
@ -240,10 +240,19 @@ if ($action == 'create')
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert hooks
|
// Other attributes
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
|
||||||
$object=new Propal($db);
|
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$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">';
|
||||||
|
print $extrafields->showInputField($key,$value);
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print "</table>";
|
print "</table>";
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -1144,7 +1144,7 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if (! $formconfirm)
|
if (! $formconfirm)
|
||||||
{
|
{
|
||||||
$parameters=array('lineid'=>$lineid);
|
$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
|
// Print form confirm
|
||||||
@ -1468,9 +1468,19 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert hooks
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="3"');
|
$parameters=array('colspan' => ' colspan="3"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$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">';
|
||||||
|
print $extrafields->showInputField($key,$value);
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Amount HT
|
// Amount HT
|
||||||
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
|
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';
|
||||||
|
|||||||
@ -917,7 +917,7 @@ class Propal extends CommonObject
|
|||||||
{
|
{
|
||||||
$parameters=array('objFrom'=>$objFrom);
|
$parameters=array('objFrom'=>$objFrom);
|
||||||
$action='';
|
$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 ($reshook < 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -825,7 +825,7 @@ class Commande extends CommonObject
|
|||||||
{
|
{
|
||||||
$parameters=array('objFrom'=>$objFrom);
|
$parameters=array('objFrom'=>$objFrom);
|
||||||
$action='';
|
$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 ($reshook < 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -921,7 +921,7 @@ class Commande extends CommonObject
|
|||||||
|
|
||||||
$parameters=array('objFrom'=>$object);
|
$parameters=array('objFrom'=>$object);
|
||||||
$action='';
|
$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 ($reshook < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
@ -303,7 +303,7 @@ if ($action == 'add' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
$parameters=array('objFrom'=>$srcobject);
|
$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++;
|
if ($reshook < 0) $error++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1366,13 +1366,23 @@ if ($action == 'create' && $user->rights->commande->creer)
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert hooks
|
// Other attributes
|
||||||
$parameters=array();
|
$parameters=array('colspan' => ' colspan="3"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$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">';
|
||||||
|
print $extrafields->showInputField($key,$value);
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Template to use by default
|
||||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
// pdf
|
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php');
|
include_once(DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php');
|
||||||
$liste=ModelePDFCommandes::liste_modeles($db);
|
$liste=ModelePDFCommandes::liste_modeles($db);
|
||||||
print $form->selectarray('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
|
print $form->selectarray('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
|
||||||
@ -1643,7 +1653,7 @@ else
|
|||||||
if (! $formconfirm)
|
if (! $formconfirm)
|
||||||
{
|
{
|
||||||
$parameters=array('lineid'=>$lineid);
|
$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
|
// Print form confirm
|
||||||
@ -1908,11 +1918,19 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert hooks
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="2"');
|
$parameters=array('colspan' => ' colspan="2"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$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))
|
||||||
// Lignes de 3 colonnes
|
{
|
||||||
|
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
|
// Total HT
|
||||||
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
||||||
|
|||||||
@ -856,7 +856,7 @@ if ($action == 'add' && $user->rights->facture->creer)
|
|||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
$parameters=array('objFrom'=>$srcobject);
|
$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++;
|
if ($reshook < 0) $error++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1801,9 +1801,19 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert hooks
|
// Other attributes
|
||||||
$parameters=array();
|
$parameters=array('colspan' => ' colspan="3"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$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">';
|
||||||
|
print $extrafields->showInputField($key,$value);
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Modele PDF
|
// Modele PDF
|
||||||
print '<tr><td>'.$langs->trans('Model').'</td>';
|
print '<tr><td>'.$langs->trans('Model').'</td>';
|
||||||
@ -2197,7 +2207,7 @@ else
|
|||||||
if (! $formconfirm)
|
if (! $formconfirm)
|
||||||
{
|
{
|
||||||
$parameters=array('lineid'=>$lineid);
|
$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
|
// Print form confirm
|
||||||
@ -2700,9 +2710,19 @@ else
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Insert hooks
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="3"');
|
$parameters=array('colspan' => ' colspan="3"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$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">';
|
||||||
|
print $extrafields->showInputField($key,$value);
|
||||||
|
print '</td></tr>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print '</table><br>';
|
print '</table><br>';
|
||||||
|
|
||||||
|
|||||||
@ -557,7 +557,7 @@ class Facture extends CommonObject
|
|||||||
{
|
{
|
||||||
$parameters=array('objFrom'=>$objFrom);
|
$parameters=array('objFrom'=>$objFrom);
|
||||||
$action='';
|
$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 ($reshook < 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,7 +653,7 @@ class Facture extends CommonObject
|
|||||||
|
|
||||||
$parameters=array('objFrom'=>$object);
|
$parameters=array('objFrom'=>$object);
|
||||||
$action='';
|
$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 ($reshook < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
@ -124,7 +124,7 @@ class HookManager
|
|||||||
* @param array $parameters Array of parameters
|
* @param array $parameters Array of parameters
|
||||||
* @param Object &$object Object to use hooks on
|
* @param Object &$object Object to use hooks on
|
||||||
* @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
|
* @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.
|
* @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.
|
* For printSearchForm,printLeftBlock: Return HTML string.
|
||||||
* $this->error or this->errors are also defined by class called by this function if error.
|
* $this->error or this->errors are also defined by class called by this function if error.
|
||||||
*/
|
*/
|
||||||
@ -148,31 +148,18 @@ class HookManager
|
|||||||
$var=!$var;
|
$var=!$var;
|
||||||
|
|
||||||
// Hooks that return int
|
// 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)
|
$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))
|
if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0))
|
||||||
{
|
{
|
||||||
$this->error=$actioninstance->error; $this->errors=$actioninstance->errors;
|
$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=='add') $action='create'; // TODO this change must be inside the doActions
|
||||||
if ($action=='update') $action='edit'; // 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)
|
|
||||||
if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0))
|
|
||||||
{
|
|
||||||
$this->error=$actioninstance->error; $this->errors=$actioninstance->errors;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Generic hooks that return a string (printSearchForm, printLeftBlock, formBuilddocOptions, ...)
|
// Generic hooks that return a string (printSearchForm, printLeftBlock, formBuilddocOptions, ...)
|
||||||
else if (method_exists($actioninstance,$method))
|
else if (method_exists($actioninstance,$method))
|
||||||
@ -184,7 +171,7 @@ class HookManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($method == 'doActions' || $method == 'showInputFields' || $method == 'showOutputFields') return $resaction;
|
if ($method == 'doActions' || $method == 'formObjectOptions') return $resaction;
|
||||||
return $resprint;
|
return $resprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* 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 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
@ -780,7 +780,21 @@ else
|
|||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
print '</td></tr>';
|
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>';
|
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
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);
|
$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);
|
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||||
print '</td></tr>';
|
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
|
// Note
|
||||||
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
|
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
@ -1183,6 +1211,19 @@ else
|
|||||||
// Origin country code
|
// Origin country code
|
||||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id,0,$db).'</td>';
|
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
|
// 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>';
|
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>';
|
||||||
|
|||||||
@ -940,13 +940,13 @@ else
|
|||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="3"');
|
$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))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:'');
|
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||||
print "<tr><td>".$label.'</td><td colspan="3">';
|
print '<tr><td>'.$label.'</td><td colspan="3">';
|
||||||
print $extrafields->showInputField($key,$value);
|
print $extrafields->showInputField($key,$value);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
@ -1368,13 +1368,13 @@ else
|
|||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('colspan' => ' colspan="3"');
|
$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))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
$value=(isset($_POST["options_$key"])?$_POST["options_$key"]:$object->array_options["options_$key"]);
|
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||||
print "<tr><td>".$label."</td><td colspan=\"3\">";
|
print '<tr><td>'.$label.'</td><td colspan="3">';
|
||||||
print $extrafields->showInputField($key,$value);
|
print $extrafields->showInputField($key,$value);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
@ -1717,13 +1717,13 @@ else
|
|||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
|
$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))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
{
|
{
|
||||||
$value=$object->array_options["options_$key"];
|
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||||
print "<tr><td>".$label.'</td><td colspan="3">';
|
print '<tr><td>'.$label.'</td><td colspan="3">';
|
||||||
print $extrafields->showOutputField($key,$value);
|
print $extrafields->showOutputField($key,$value);
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user