[Qual] Uniformize code
This commit is contained in:
parent
456913e381
commit
ff5fcbbc10
@ -66,12 +66,12 @@ if (GETPOST('action','alpha') == 'set')
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans("SetupSaved"));
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$db->rollback();
|
||||
setEventMessage($langs->trans("Error"), 'errors');
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($object->error,'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,8 +151,7 @@ if (empty($reshook))
|
||||
$result=$cat->del_type($object,$elementtype);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($cat->error,'errors');
|
||||
setEventMessage($cat->errors,'errors');
|
||||
setEventMessages($cat->error, $cat->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,17 +198,17 @@ if (empty($reshook))
|
||||
$result=$cat->add_type($object,$elementtype);
|
||||
if ($result >= 0)
|
||||
{
|
||||
setEventMessage($langs->trans("WasAddedSuccessfully",$cat->label));
|
||||
setEventMessages($langs->trans("WasAddedSuccessfully",$cat->label), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings');
|
||||
setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages( $cat->error, $cat->errors, 'errors' );
|
||||
setEventMessages($cat->error, $cat->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
{
|
||||
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||
{
|
||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -151,7 +151,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||
exit();
|
||||
} else {
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -347,7 +347,7 @@ if ($action == 'add')
|
||||
$db->rollback();
|
||||
$langs->load("errors");
|
||||
$error=$langs->trans($object->error);
|
||||
setEventMessage($error,'errors');
|
||||
setEventMessages($error, null, 'errors');
|
||||
$action = 'create'; $donotclearsession=1;
|
||||
}
|
||||
}
|
||||
@ -551,8 +551,7 @@ if ($action == 'mupdate')
|
||||
$result=$object->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessage($object->error,'errors');
|
||||
setEventMessage($object->errors,'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
if (! empty($backtopage))
|
||||
|
||||
@ -114,7 +114,7 @@ if (empty($reshook))
|
||||
{
|
||||
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
|
||||
{
|
||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
||||
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -123,8 +123,10 @@ if (empty($reshook))
|
||||
if ($result > 0) {
|
||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||
exit();
|
||||
} else {
|
||||
setEventMessage($object->error, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -140,7 +142,7 @@ if (empty($reshook))
|
||||
exit();
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessage($langs->trans($object->error), 'errors');
|
||||
setEventMessages($langs->trans($object->error), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,8 +200,8 @@ if (empty($reshook))
|
||||
}
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
||||
else setEventMessage($langs->trans($object->error), 'errors');
|
||||
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
else setEventMessages($langs->trans($object->error), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,7 +251,7 @@ if (empty($reshook))
|
||||
|
||||
$id = $object->create_from($user);
|
||||
} else {
|
||||
setEventMessage($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_askpricesupplier')), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_askpricesupplier')), null, 'errors');
|
||||
}
|
||||
} else {
|
||||
$object->ref = GETPOST('ref');
|
||||
@ -484,7 +486,7 @@ if (empty($reshook))
|
||||
if ($object->id > 0) {
|
||||
$result = $object->insert_discount($_POST["remise_id"]);
|
||||
if ($result < 0) {
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -674,7 +676,7 @@ if (empty($reshook))
|
||||
|
||||
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
|
||||
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
|
||||
setEventMessage($mesg, 'errors');
|
||||
setEventMessages($mesg, null, 'errors');
|
||||
} else {
|
||||
// Insert line
|
||||
$ref_fourn = GETPOST('fourn_ref');
|
||||
@ -716,7 +718,7 @@ if (empty($reshook))
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -774,7 +776,7 @@ if (empty($reshook))
|
||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
||||
|
||||
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
||||
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors');
|
||||
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
@ -823,7 +825,7 @@ if (empty($reshook))
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -865,9 +867,9 @@ if (empty($reshook))
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
$ret = dol_delete_file($file, 0, 0, 0, $object);
|
||||
if ($ret)
|
||||
setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
|
||||
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
|
||||
else
|
||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
|
||||
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1325,7 +1327,7 @@ if ($action == 'create')
|
||||
$numref = $object->getNextNumRef($soc);
|
||||
if (empty($numref)) {
|
||||
$error ++;
|
||||
setEventMessage($object->error, 'errors');
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user