diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 15536909bf9..8c2871426a4 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1159,14 +1159,11 @@ else if ($action == 'update_extras') { // Fill array 'array_options' with data from update form $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - $ret = $extrafields->setOptionalsFromPost($extralabels,$object); + $ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute')); + if($ret < 0) $error++; - if($ret < 0) { - $error++; - $action = 'edit_extras'; - } - - if(!$error) { + if (! $error) + { // Actions on extra fields (by external module or standard code) // FIXME le hook fait double emploi avec le trigger !! $hookmanager->initHooks(array('propaldao')); @@ -1174,17 +1171,16 @@ else if ($action == 'update_extras') $reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + $result=$object->insertExtraFields(); + if ($result < 0) { - $result=$object->insertExtraFields(); - if ($result < 0) - { - $error++; - } + $error++; } } else if ($reshook < 0) $error++; } + + if ($error) $action = 'edit_extras'; } if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) @@ -1893,20 +1889,12 @@ else print ''; } - // Other attributes + // Other attributes (TODO Move this into an include) $res=$object->fetch_optionals($object->id,$extralabels); $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) && ! empty($extrafields->attribute_label)) { - if ($action == 'edit_extras') - { - print '
'; } else { print $extrafields->showOutputField($key,$value); + if ($object->statut == 0 && $user->rights->propal->creer) print ''.img_picto('','edit').' '.$langs->trans('Modify').''; } print ''."\n"; } } - - if(count($extrafields->attribute_label) > 0) { - - if ($action == 'edit_extras' && $user->rights->propal->creer) - { - print '