Fix bug on contract create form propal
and fix extrafield must be control before create object
This commit is contained in:
parent
ae2dbe37ba
commit
2f59a63e5a
@ -73,7 +73,7 @@ $object = new Contrat($db);
|
|||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
if ($id > 0 || ! empty($ref)) {
|
if ($id > 0 || ! empty($ref) && $action!='add') {
|
||||||
$ret = $object->fetch($id, $ref);
|
$ret = $object->fetch($id, $ref);
|
||||||
if ($ret > 0)
|
if ($ret > 0)
|
||||||
$ret = $object->fetch_thirdparty();
|
$ret = $object->fetch_thirdparty();
|
||||||
@ -203,6 +203,13 @@ if ($action == 'add' && $user->rights->contrat->creer)
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fill array 'array_options' with data from add form
|
||||||
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||||
|
if ($ret < 0) {
|
||||||
|
$error ++;
|
||||||
|
$action = 'create';
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$object->socid = $socid;
|
$object->socid = $socid;
|
||||||
@ -352,10 +359,6 @@ if ($action == 'add' && $user->rights->contrat->creer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
|
||||||
|
|
||||||
$result = $object->create($user);
|
$result = $object->create($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user