Check required extrafields on orders
This commit is contained in:
parent
bddbc6f6b2
commit
7ee4e42710
@ -275,7 +275,10 @@ else if ($action == 'add' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if($ret < 0)
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
if(!$error) {
|
||||||
$object_id = $object->create($user);
|
$object_id = $object->create($user);
|
||||||
|
|
||||||
if ($object_id > 0)
|
if ($object_id > 0)
|
||||||
@ -370,10 +373,19 @@ else if ($action == 'add' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
// Required extrafield left blank, error message already defined by setOptionalsFromPost()
|
||||||
|
$action='create';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if($ret < 0)
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
if(!$error) {
|
||||||
$object_id = $object->create($user);
|
$object_id = $object->create($user);
|
||||||
|
|
||||||
// If some invoice's lines already known
|
// If some invoice's lines already known
|
||||||
@ -389,6 +401,7 @@ else if ($action == 'add' && $user->rights->commande->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Insert default contacts if defined
|
// Insert default contacts if defined
|
||||||
if ($object_id > 0)
|
if ($object_id > 0)
|
||||||
@ -1130,6 +1143,10 @@ else if ($action == 'update_extras')
|
|||||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
|
||||||
|
if($ret < 0)
|
||||||
|
$error++;
|
||||||
|
|
||||||
|
if(!$error) {
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
// FIXME le hook fait double emploi avec le trigger !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('orderdao'));
|
$hookmanager->initHooks(array('orderdao'));
|
||||||
@ -1147,6 +1164,11 @@ else if ($action == 'update_extras')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
else if ($reshook < 0) $error++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$action = 'edit_extras';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1335,7 +1357,7 @@ if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
|
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
if ($action == 'addcontact')
|
if ($action == 'addcontact')
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user