Better extrafield management
This commit is contained in:
parent
162ccf68b6
commit
7b080dec65
@ -2135,6 +2135,7 @@ else
|
|||||||
$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) && ! empty($extrafields->attribute_label))
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
|
if(count($extrafields->attribute_label) > 0) {
|
||||||
|
|
||||||
if ($action == 'edit_extras')
|
if ($action == 'edit_extras')
|
||||||
{
|
{
|
||||||
@ -2144,39 +2145,13 @@ else
|
|||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : use showOptionals($extrafields) function
|
|
||||||
foreach($extrafields->attribute_label as $key=>$label)
|
|
||||||
{
|
|
||||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
|
||||||
if ($extrafields->attribute_type[$key] == 'separate')
|
|
||||||
{
|
|
||||||
print $extrafields->showSeparator($key);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<tr><td';
|
|
||||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
|
||||||
print '>'.$label.'</td><td colspan="3">';
|
|
||||||
|
|
||||||
// Convert date into timestamp format
|
if ($action == 'edit_extras' && $user->rights->propal->creer) {
|
||||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
print $object->showOptionals($extrafields,'edit');
|
||||||
{
|
|
||||||
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if ($action == 'edit_extras' && $user->rights->propal->creer)
|
print $object->showOptionals($extrafields);
|
||||||
{
|
|
||||||
print $extrafields->showInputField($key,$value);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
print $extrafields->showOutputField($key,$value);
|
|
||||||
}
|
|
||||||
print '</td></tr>'."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(count($extrafields->attribute_label) > 0) {
|
|
||||||
|
|
||||||
if ($action == 'edit_extras' && $user->rights->propal->creer)
|
if ($action == 'edit_extras' && $user->rights->propal->creer)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user