Hello.
I am developing a custom module and want to add an additional field on Expense report creation.
- I have created my module
- I have created the hook
- I have set an SQL file, so a column named fk_soc is added in llx_expensereport (fk_soc int(11))
- The required field (DropDown to select Third party) is shown on the Expense report create page
- On form submit, field ‘fk_soc’ is not populated
My code:
On “expensereport/card.php” I have
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
so in my class, I have this function:
public function formObjectOptions($parameters, &$object, &$action, $hookmanager)
{
global $conf, $user, $langs;
$error = 0; // Error counter
if ($action === 'create') {
print '<tr><td class="tdtop">' . $langs->trans('Customer') . '</td>';
print '<td>';
$form = new Form($this->db);
$societe = new Societe($this->db);
print img_picto('', 'company') . $form->select_company($societe->id, 'fk_soc', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx');
print '</td>';
print '</tr>';
}
if (!$error) {
return 0;
} else {
dol_print_error($this->db);
return -1;
}
}
I am attaching the form create screen.