[Qual] Uniformize code
This commit is contained in:
parent
4b9e87367f
commit
de0a13ae8f
@ -73,7 +73,7 @@ if ($action == 'remises')
|
|||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', $_POST['MARGIN_METHODE_FOR_DISCOUNT'], 'chaine', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', $_POST['MARGIN_METHODE_FOR_DISCOUNT'], 'chaine', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("RecordModifiedSuccessfully"));
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -85,7 +85,7 @@ if ($action == 'typemarges')
|
|||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, 'MARGIN_TYPE', $_POST['MARGIN_TYPE'], 'chaine', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, 'MARGIN_TYPE', $_POST['MARGIN_TYPE'], 'chaine', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("RecordModifiedSuccessfully"));
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -97,7 +97,7 @@ if ($action == 'contact')
|
|||||||
{
|
{
|
||||||
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0)
|
if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("RecordModifiedSuccessfully"));
|
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -99,7 +99,7 @@ if ($action == 'update')
|
|||||||
$res=$object->update($user);
|
$res=$object->update($user);
|
||||||
if ($res < 0)
|
if ($res < 0)
|
||||||
{
|
{
|
||||||
setEventMessage($object->error,'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action='edit';
|
$action='edit';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ if (GETPOST('ajoutcomment'))
|
|||||||
|
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorInsertingComment'), 'errors');
|
setEventMessages($langs->trans('ErrorInsertingComment'), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,7 +91,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
|
|||||||
$num_rows = $db->num_rows($resql);
|
$num_rows = $db->num_rows($resql);
|
||||||
if ($num_rows > 0)
|
if ($num_rows > 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("VoteNameAlreadyExists"),'errors');
|
setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1024,11 +1024,11 @@ if (isset($_POST["boutonp"]) && $_POST["nom"] == "") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($erreur_prenom) && $erreur_prenom) {
|
if (isset($erreur_prenom) && $erreur_prenom) {
|
||||||
setEventMessage($langs->trans('VoteNameAlreadyExists'), 'errors');
|
setEventMessages($langs->trans('VoteNameAlreadyExists'), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($erreur_ajout_date) && $erreur_ajout_date) {
|
if (isset($erreur_ajout_date) && $erreur_ajout_date) {
|
||||||
setEventMessage($langs->trans("ErrorWrongDate"), 'errors');
|
setEventMessages($langs->trans("ErrorWrongDate"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
//fin du tableau
|
//fin du tableau
|
||||||
|
|||||||
@ -84,7 +84,7 @@ if (isset($_POST["confirmecreation"]))
|
|||||||
|
|
||||||
//message d'erreur si aucun champ renseigné
|
//message d'erreur si aucun champ renseigné
|
||||||
if ($testremplissage != "ok" || (!$toutchoix)) {
|
if ($testremplissage != "ok" || (!$toutchoix)) {
|
||||||
setEventMessage($langs->trans("ErrorOpenSurveyOneChoice"), 'errors');
|
setEventMessages($langs->trans("ErrorOpenSurveyOneChoice"), null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//format du sondage AUTRE
|
//format du sondage AUTRE
|
||||||
|
|||||||
@ -156,13 +156,13 @@ if (GETPOST('confirmation'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($errheure)) {
|
if (isset($errheure)) {
|
||||||
setEventMessage($langs->trans("ErrorBadFormat"), 'errors');
|
setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//If just one day and no other time options, error message
|
//If just one day and no other time options, error message
|
||||||
if (count($_SESSION["totalchoixjour"])=="1" && $_POST["horaires0"][0]=="" && $_POST["horaires0"][1]=="" && $_POST["horaires0"][2]=="" && $_POST["horaires0"][3]=="" && $_POST["horaires0"][4]=="") {
|
if (count($_SESSION["totalchoixjour"])=="1" && $_POST["horaires0"][0]=="" && $_POST["horaires0"][1]=="" && $_POST["horaires0"][2]=="" && $_POST["horaires0"][3]=="" && $_POST["horaires0"][4]=="") {
|
||||||
setEventMessage($langs->trans("MoreChoices"), 'errors');
|
setEventMessages($langs->trans("MoreChoices"), null, 'errors');
|
||||||
$erreur=true;
|
$erreur=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -94,12 +94,12 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre"))
|
|||||||
$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
|
$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
|
||||||
//$testdate = false;
|
//$testdate = false;
|
||||||
//$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
|
//$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
|
||||||
setEventMessage('ExpireDate','warnings');
|
setEventMessages('ExpireDate', null, 'warnings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $testdate) {
|
if (! $testdate) {
|
||||||
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("ExpireDate")), 'errors');
|
setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("ExpireDate")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($titre && $testdate)
|
if ($titre && $testdate)
|
||||||
|
|||||||
@ -67,7 +67,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessage($langs->trans("SetupSaved"));
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -75,7 +75,7 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessage($langs->trans("SetupSaved"));
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ print $langs->trans("PaypalDesc")."<br>\n";
|
|||||||
if (! function_exists('curl_version'))
|
if (! function_exists('curl_version'))
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans("ErrorPhpCurlNotInstalled"), 'errors');
|
setEventMessages($langs->trans("ErrorPhpCurlNotInstalled"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -43,14 +43,14 @@ $price_globals = new PriceGlobalVariable($db);
|
|||||||
if ($action == 'edit_variable') {
|
if ($action == 'edit_variable') {
|
||||||
$res = $price_globals->fetch($selection);
|
$res = $price_globals->fetch($selection);
|
||||||
if ($res < 1) {
|
if ($res < 1) {
|
||||||
setEventMessage($price_globals->error, 'errors');
|
setEventMessages($price_globals->error, $price_globals->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$price_updaters = new PriceGlobalVariableUpdater($db);
|
$price_updaters = new PriceGlobalVariableUpdater($db);
|
||||||
if ($action == 'edit_updater') {
|
if ($action == 'edit_updater') {
|
||||||
$res = $price_updaters->fetch($selection);
|
$res = $price_updaters->fetch($selection);
|
||||||
if ($res < 1) {
|
if ($res < 1) {
|
||||||
setEventMessage($price_updaters->error, 'errors');
|
setEventMessages($price_updaters->error, $price_updaters->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ if (!empty($action) && empty($cancel)) {
|
|||||||
if (!empty($save)) {
|
if (!empty($save)) {
|
||||||
foreach ($price_globals->listGlobalVariables() as $entry) {
|
foreach ($price_globals->listGlobalVariables() as $entry) {
|
||||||
if ($price_globals->id != $entry->id && dol_strtolower($price_globals->code) == dol_strtolower($entry->code)) {
|
if ($price_globals->id != $entry->id && dol_strtolower($price_globals->code) == dol_strtolower($entry->code)) {
|
||||||
setEventMessage($langs->trans("ErrorRecordAlreadyExists"), 'errors');
|
setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors');
|
||||||
$save = null;
|
$save = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,21 +78,21 @@ if (!empty($action) && empty($cancel)) {
|
|||||||
if ($res > 0) {
|
if ($res > 0) {
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($price_globals->error, 'errors');
|
setEventMessages($price_globals->error, $price_globals->errors, 'errors');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'edit_variable' && !empty($save)) {
|
} elseif ($action == 'edit_variable' && !empty($save)) {
|
||||||
$res = $price_globals->update($user);
|
$res = $price_globals->update($user);
|
||||||
if ($res > 0) {
|
if ($res > 0) {
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($price_globals->error, 'errors');
|
setEventMessages($price_globals->error, $price_globals->errors, 'errors');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'delete_variable') {
|
} elseif ($action == 'delete_variable') {
|
||||||
$res = $price_globals->delete($selection, $user);
|
$res = $price_globals->delete($selection, $user);
|
||||||
if ($res > 0) {
|
if ($res > 0) {
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($price_globals->error, 'errors');
|
setEventMessages($price_globals->error, $price_globals->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ if (!empty($action) && empty($cancel)) {
|
|||||||
if ($res > 0) {
|
if ($res > 0) {
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($price_updaters->error, 'errors');
|
setEventMessages($price_updaters->error, $price_updaters->errors, 'errors');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'edit_updater' && !empty($save)) {
|
} elseif ($action == 'edit_updater' && !empty($save)) {
|
||||||
//Verify if process() works
|
//Verify if process() works
|
||||||
@ -124,14 +124,14 @@ if (!empty($action) && empty($cancel)) {
|
|||||||
if ($res > 0) {
|
if ($res > 0) {
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($price_updaters->error, 'errors');
|
setEventMessages($price_updaters->error, $price_updaters->errors, 'errors');
|
||||||
}
|
}
|
||||||
} elseif ($action == 'delete_updater') {
|
} elseif ($action == 'delete_updater') {
|
||||||
$res = $price_updaters->delete($selection, $user);
|
$res = $price_updaters->delete($selection, $user);
|
||||||
if ($res > 0) {
|
if ($res > 0) {
|
||||||
$action = '';
|
$action = '';
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($price_updaters->error, 'errors');
|
setEventMessages($price_updaters->error, $price_updaters->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (!empty($cancel)) {
|
} elseif (!empty($cancel)) {
|
||||||
|
|||||||
@ -89,13 +89,13 @@ if ($_POST) {
|
|||||||
SET fk_level = ".$db->escape($i_fk_level).", var_percent = ".$i_var_percent.", var_min_percent = ".$i_var_min_percent." WHERE level = ".$i;
|
SET fk_level = ".$db->escape($i_fk_level).", var_percent = ".$i_var_percent.", var_min_percent = ".$i_var_min_percent." WHERE level = ".$i;
|
||||||
|
|
||||||
if (!$db->query($sql)) {
|
if (!$db->query($sql)) {
|
||||||
setEventMessage($langs->trans('ErrorSavingChanges'), 'errors');
|
setEventMessages($langs->trans('ErrorSavingChanges'), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setEventMessage($langs->trans("RecordSaved"));
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -98,12 +98,12 @@ if ($action == 'setModuleOptions')
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessage($langs->trans("SetupSaved"));
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
setEventMessage($langs->trans("Error"), 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,11 +196,11 @@ if ($action)
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("SetupSaved"));
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("Error"), 'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -57,7 +57,7 @@ if ($action == 'convert')
|
|||||||
if ($oldvatrate == $newvatrate)
|
if ($oldvatrate == $newvatrate)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans("ErrorNewValueCantMatchOldValue"),'errors');
|
setEventMessages($langs->trans("ErrorNewValueCantMatchOldValue"), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,12 +225,12 @@ if ($action == 'convert')
|
|||||||
// Output result
|
// Output result
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
if ($nbrecordsmodified > 0) setEventMessage($langs->trans("RecordsModified",$nbrecordsmodified));
|
if ($nbrecordsmodified > 0) setEventMessages($langs->trans("RecordsModified",$nbrecordsmodified), null, 'mesgs');
|
||||||
else setEventMessage($langs->trans("NoRecordFound"),'warnings');
|
else setEventMessages($langs->trans("NoRecordFound"), null, 'warnings');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("Error"),'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,9 +85,11 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
|
|||||||
$error++;
|
$error++;
|
||||||
$action = 're-edit';
|
$action = 're-edit';
|
||||||
if ($object->error == "isFatherOfThis") {
|
if ($object->error == "isFatherOfThis") {
|
||||||
setEventMessage($langs->trans("ErrorAssociationIsFatherOfThis"), 'errors');
|
setEventMessages($langs->trans("ErrorAssociationIsFatherOfThis"), null, 'errors');
|
||||||
} else {
|
}
|
||||||
setEventMessage($object->error, 'errors');
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +103,7 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$action = 're-edit';
|
$action = 're-edit';
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,7 +75,7 @@ if ($action == 'add')
|
|||||||
$priceparser = new PriceParser($db);
|
$priceparser = new PriceParser($db);
|
||||||
$price_result = $priceparser->parseProductSupplierExpression($id, $expression, 0, 0);
|
$price_result = $priceparser->parseProductSupplierExpression($id, $expression, 0, 0);
|
||||||
if ($price_result < 0) { //Expression is not valid
|
if ($price_result < 0) { //Expression is not valid
|
||||||
setEventMessage($priceparser->translatedError(), 'errors');
|
setEventMessages($priceparser->translatedError(), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -85,21 +85,21 @@ if ($action == 'add')
|
|||||||
if ($result > 0) //created successfully, set the eid to newly created entry
|
if ($result > 0) //created successfully, set the eid to newly created entry
|
||||||
{
|
{
|
||||||
$eid = $price_expression->id;
|
$eid = $price_expression->id;
|
||||||
setEventMessage($langs->trans("RecordSaved"));
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage("add: ".$price_expression->error, 'errors');
|
setEventMessages("add: ".$price_expression->error, $price_expression->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($result < 0)
|
else if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessage("add find: ".$price_expression->error, 'errors');
|
setEventMessages("add find: ".$price_expression->error, $price_expression->errors, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorRecordAlreadyExists"), 'errors');
|
setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ if ($action == 'update')
|
|||||||
$priceparser = new PriceParser($db);
|
$priceparser = new PriceParser($db);
|
||||||
$price_result = $priceparser->parseProductSupplierExpression($id, $expression, 0, 0);
|
$price_result = $priceparser->parseProductSupplierExpression($id, $expression, 0, 0);
|
||||||
if ($price_result < 0) { //Expression is not valid
|
if ($price_result < 0) { //Expression is not valid
|
||||||
setEventMessage($priceparser->translatedError(), 'errors');
|
setEventMessages($priceparser->translatedError(), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -125,21 +125,21 @@ if ($action == 'update')
|
|||||||
$result = $price_expression->update($user);
|
$result = $price_expression->update($user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessage("update: ".$price_expression->error, 'errors');
|
setEventMessages("update: ".$price_expression->error, $price_expression->errors, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("RecordSaved"));
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($result < 0)
|
else if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessage("update find: ".$price_expression->error, 'errors');
|
setEventMessages("update find: ".$price_expression->error, $price_expression->errors, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorRecordAlreadyExists"), 'errors');
|
setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ if ($action == 'delete')
|
|||||||
$result = $price_expression->delete($eid, $user);
|
$result = $price_expression->delete($eid, $user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessage("delete: ".$price_expression->error, 'errors');
|
setEventMessages("delete: ".$price_expression->error, $price_expression->errors, 'errors');
|
||||||
}
|
}
|
||||||
$eid = 0;
|
$eid = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ if ($action == 'add' && $user->rights->stock->creer)
|
|||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("RecordSaved"));
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
|
|
||||||
if (! empty($backtopage))
|
if (! empty($backtopage))
|
||||||
{
|
{
|
||||||
@ -94,11 +94,12 @@ if ($action == 'add' && $user->rights->stock->creer)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$action = 'create';
|
$action = 'create';
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
setEventMessage($langs->trans("ErrorWarehouseRefRequired"), 'errors');
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorWarehouseRefRequired"), null, 'errors');
|
||||||
$action="create"; // Force retour sur page creation
|
$action="create"; // Force retour sur page creation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,7 +117,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->stock->su
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,13 +144,13 @@ if ($action == 'update' && $cancel <> $langs->trans("Cancel"))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,7 @@ if ($action == 'addline')
|
|||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans("ErrorWarehouseMustDiffers"),'errors');
|
setEventMessages($langs->trans("ErrorWarehouseMustDiffers"), null, 'errors');
|
||||||
}
|
}
|
||||||
if (! $qty)
|
if (! $qty)
|
||||||
{
|
{
|
||||||
@ -113,7 +113,7 @@ if ($action == 'addline')
|
|||||||
if (empty($batch))
|
if (empty($batch))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData"), 'errors');
|
setEventMessages($langs->trans("ErrorTryToMakeMoveOnProductRequiringBatchData"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ if ($action == 'createmovements')
|
|||||||
if (! GETPOST("label"))
|
if (! GETPOST("label"))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorFieldRequired"),$langs->transnoentitiesnoconv("LabelMovement"));
|
setEventMessages($langs->trans("ErrorFieldRequired"),$langs->transnoentitiesnoconv("LabelMovement"), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
@ -209,7 +209,7 @@ if ($action == 'createmovements')
|
|||||||
if ($result1 < 0)
|
if ($result1 < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($product->errors,'errors');
|
setEventMessages($product->errors, $product->errorss, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add stock
|
// Add stock
|
||||||
@ -225,7 +225,7 @@ if ($action == 'createmovements')
|
|||||||
if ($result2 < 0)
|
if ($result2 < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($product->errors,'errors');
|
setEventMessages($product->errors, $product->errorss, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -260,7 +260,7 @@ if ($action == 'createmovements')
|
|||||||
if ($result1 < 0)
|
if ($result1 < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($product->errors,'errors');
|
setEventMessages($product->errors, $product->errorss, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add stock
|
// Add stock
|
||||||
@ -279,7 +279,7 @@ if ($action == 'createmovements')
|
|||||||
if ($result2 < 0)
|
if ($result2 < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($product->errors,'errors');
|
setEventMessages($product->errors, $product->errorss, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -296,14 +296,14 @@ if ($action == 'createmovements')
|
|||||||
unset($_SESSION['massstockmove']);
|
unset($_SESSION['massstockmove']);
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessage($langs->trans("StockMovementRecorded"),'mesgs');
|
setEventMessages($langs->trans("StockMovementRecorded"), null, 'mesgs');
|
||||||
header("Location: ".DOL_URL_ROOT.'/product/stock/index.php'); // Redirect to avoid pb when using back
|
header("Location: ".DOL_URL_ROOT.'/product/stock/index.php'); // Redirect to avoid pb when using back
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
setEventMessage($langs->trans("Error"),'errors');
|
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user