2
0
forked from Wavyzz/dolibarr

Fix bug on contract create form propal

and fix extrafield must be control before create object
This commit is contained in:
Florian HENRY
2015-02-02 18:03:18 +01:00
parent ae2dbe37ba
commit 2f59a63e5a

View File

@@ -73,7 +73,7 @@ $object = new Contrat($db);
$extrafields = new ExtraFields($db);
// Load object
if ($id > 0 || ! empty($ref)) {
if ($id > 0 || ! empty($ref) && $action!='add') {
$ret = $object->fetch($id, $ref);
if ($ret > 0)
$ret = $object->fetch_thirdparty();
@@ -203,6 +203,13 @@ if ($action == 'add' && $user->rights->contrat->creer)
$error++;
}
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) {
$error ++;
$action = 'create';
}
if (! $error)
{
$object->socid = $socid;
@@ -352,10 +359,6 @@ if ($action == 'add' && $user->rights->contrat->creer)
}
else
{
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
$result = $object->create($user);
if ($result > 0)
{