Merge pull request #4265 from grandoc/develop

[Qual] Uniformize code
This commit is contained in:
Juanjo Menent 2015-12-21 20:59:25 +01:00
commit 442006dba5
17 changed files with 155 additions and 119 deletions

View File

@ -165,7 +165,7 @@ if (empty($reshook))
else
{
$langs->load("errors");
setEventMessage($langs->trans($object->error), null, 'errors');
setEventMessages($langs->trans($object->error), null, 'errors');
$error++;
}
@ -204,13 +204,13 @@ if (empty($reshook))
if (empty($ref))
{
$error++;
//$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
//$_GET["id"]=$_POST["id"]; // We return on the project card
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors');
}
if (empty($_POST["title"]))
{
$error++;
//$_GET["id"]=$_POST["id"]; // On retourne sur la fiche projet
//$_GET["id"]=$_POST["id"]; // We return on the project card
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
}

View File

@ -122,7 +122,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
$num_rows = $db->num_rows($resql);
if ($num_rows > 0)
{
setEventMessage($langs->trans("VoteNameAlreadyExists"),'errors');
setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors');
$error++;
}
else
@ -181,7 +181,7 @@ for ($i=0; $i<$nblignes; $i++)
$testligneamodifier=true;
}
//test pour voir si une ligne est a modifier
//test to see if a line is to be modified
if (isset($_POST['validermodifier'.$i]))
{
$modifier=$i;
@ -293,11 +293,11 @@ print '<table class="resultats">'."\n";
// Show choice titles
if ($object->format=="D")
{
//affichage des sujets du sondage
//display of survey topics
print '<tr>'."\n";
print '<td></td>'."\n";
//affichage des années
//display of years
$colspan=1;
$nbofsujet=count($toutsujet);
for ($i=0;$i<$nbofsujet;$i++)
@ -314,7 +314,7 @@ if ($object->format=="D")
print '<tr>'."\n";
print '<td></td>'."\n";
//affichage des mois
//display of months
$colspan=1;
for ($i=0;$i<$nbofsujet;$i++) {
$cur = intval($toutsujet[$i]); // intval() est utiliser pour supprimer le suffixe @* qui déplaît logiquement à strftime()
@ -337,7 +337,7 @@ if ($object->format=="D")
print '<tr>'."\n";
print '<td></td>'."\n";
//affichage des jours
//display of days
$colspan=1;
for ($i=0;$i<$nbofsujet;$i++) {
$cur = intval($toutsujet[$i]);
@ -356,7 +356,7 @@ if ($object->format=="D")
print '</tr>'."\n";
//affichage des horaires
//Display schedules
if (strpos($object->sujet, '@') !== false) {
print '<tr>'."\n";
print '<td></td>'."\n";
@ -375,7 +375,7 @@ if ($object->format=="D")
}
else
{
//affichage des sujets du sondage
//display of survey topics
print '<tr>'."\n";
print '<td></td>'."\n";

View File

@ -74,7 +74,7 @@ if ($action == 'confirm_add_resource')
if (empty($ref))
{
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref"));
setEventMessage($mesg, 'errors');
setEventMessages($mesg, null, 'errors');
$error++;
}
@ -90,14 +90,14 @@ if ($action == 'confirm_add_resource')
{
// Creation OK
$db->commit();
setEventMessage($langs->trans('ResourceCreatedWithSuccess'));
setEventMessages($langs->trans('ResourceCreatedWithSuccess'), null, 'mesgs');
Header("Location: card.php?id=" . $object->id);
return;
}
else
{
// Creation KO
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action = '';
}
}

View File

@ -96,14 +96,14 @@ if (empty($reshook))
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='edit';
}
}
else
{
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='edit';
}
}
@ -122,17 +122,18 @@ if (empty($reshook))
if ($result >= 0)
{
setEventMessage($langs->trans('RessourceSuccessfullyDeleted'));
setEventMessages($langs->trans('RessourceSuccessfullyDeleted'), null, 'mesgs');
Header('Location: '.DOL_URL_ROOT.'/resource/list.php');
exit;
}
else {
setEventMessage($object->error,'errors');
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
{
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
}

View File

@ -93,7 +93,7 @@ if ($action == 'add_element_resource' && ! $cancel)
}
if (! $error && $res > 0)
{
setEventMessage($langs->trans('ResourceLinkedWithSuccess'),'mesgs');
setEventMessages($langs->trans('ResourceLinkedWithSuccess'), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF'].'?element='.$element.'&element_id='.$element_id);
exit;
}
@ -112,12 +112,13 @@ if ($action == 'update_linked_resource' && $user->rights->resource->write && !GE
if ($result >= 0)
{
setEventMessage($langs->trans('RessourceLineSuccessfullyUpdated'));
setEventMessages($langs->trans('RessourceLineSuccessfullyUpdated'), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id);
exit;
}
else {
setEventMessage($object->error,'errors');
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -129,13 +130,13 @@ if ($action == 'confirm_delete_linked_resource' && $user->rights->resource->dele
if ($result >= 0)
{
setEventMessage($langs->trans('RessourceLineSuccessfullyDeleted'));
setEventMessages($langs->trans('RessourceLineSuccessfullyDeleted'), null, 'mesgs');
header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id);
exit;
}
else
{
setEventMessage($object->error,'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}

View File

@ -77,11 +77,11 @@ if ($action == 'updateoptions')
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -92,11 +92,11 @@ if ($action == 'updateoptions')
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
}
@ -121,12 +121,12 @@ if ($action == 'setModuleOptions')
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');
}
}
@ -217,11 +217,11 @@ if ($action=="setaddrefinlist") {
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -468,7 +468,7 @@ if ($resql)
// Show delete result message
if (GETPOST('delsoc'))
{
setEventMessage($langs->trans("CompanyDeleted",GETPOST('delsoc')));
setEventMessages($langs->trans("CompanyDeleted",GETPOST('delsoc')), null, 'mesgs');
}
$langs->load("other");

View File

@ -69,10 +69,13 @@ if ($action == 'add_customer_price_confirm' && ! $_POST ["cancel"] && ($user->ri
$result = $prodcustprice->create($user, 0, $update_child_soc);
if ($result < 0) {
setEventMessage($prodcustprice->error, 'errors');
} else {
setEventMessage($langs->trans('Save'), 'mesgs');
if ($result < 0)
{
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
else
{
setEventMessages($langs->trans('Save'), null, 'mesgs');
}
$action = '';
@ -83,10 +86,13 @@ if ($action == 'delete_customer_price' && ($user->rights->produit->creer || $use
$prodcustprice->id = GETPOST('lineid');
$result = $prodcustprice->delete($user);
if ($result < 0) {
setEventMessage($prodcustprice->error, 'mesgs');
} else {
setEventMessage($langs->trans('Delete'), 'errors');
if ($result < 0)
{
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
else
{
setEventMessages($langs->trans('Delete'), null, 'mesgs');
}
$action = '';
}
@ -105,10 +111,13 @@ if ($action == 'update_customer_price_confirm' && ! $_POST ["cancel"] && ($user-
$prodcustprice->recuperableonly = (preg_match('/\*/', GETPOST("tva_tx")) ? 1 : 0);
$result = $prodcustprice->update($user, 0, $update_child_soc);
if ($result < 0) {
setEventMessage($prodcustprice->error, 'errors');
} else {
setEventMessage($langs->trans('Save'), 'mesgs');
if ($result < 0)
{
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
else
{
setEventMessages($langs->trans('Save'), null, 'mesgs');
}
$action = '';
@ -284,8 +293,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print load_fiche_titre($langs->trans('PriceByCustomer'));
$result = $prodcustprice->fetch(GETPOST('lineid', 'int'));
if ($result < 0) {
setEventMessage($prodcustprice->error, 'errors');
if ($result < 0)
{
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
print '<form action="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '" method="POST">';
@ -369,8 +379,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
}
$result = $prodcustprice->fetch_all_log($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
if ($result < 0) {
setEventMessage($prodcustprice->error, 'errors');
if ($result < 0)
{
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
$option = '&socid=' . GETPOST('socid', 'int') . '&prodid=' . GETPOST('prodid', 'int');
@ -423,7 +434,9 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
print '</td>';
}
print "</table>";
} else {
}
else
{
print $langs->trans('None');
}
@ -459,7 +472,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
$result = $prodcustprice->fetch_all($sortorder, $sortfield, $conf->liste_limit, $offset, $filter);
if ($result < 0)
{
setEventMessage($prodcustprice->error, 'errors');
setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors');
}
$option = '&search_soc=' . $search_soc . '&id=' . $object->id;

View File

@ -81,7 +81,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$result = $account->update($user);
if (! $result)
{
setEventMessage($account->error, 'errors');
setEventMessages($account->error, $account->errors, 'errors');
$_GET["action"]='edit'; // Force chargement page edition
}
else
@ -161,8 +161,10 @@ if ($action == 'setasdefault')
$url=DOL_URL_ROOT.'/societe/rib.php?socid='.$object->id;
header('Location: '.$url);
exit;
} else {
setEventMessage($db->lasterror, 'errors');
}
else
{
setEventMessages($db->lasterror, null, 'errors');
}
}
@ -180,12 +182,12 @@ if ($action == 'confirm_delete' && $_GET['confirm'] == 'yes')
}
else
{
setEventMessage($account->error, 'errors');
setEventMessages($account->error, $account->errors, 'errors');
}
}
else
{
setEventMessage($account->error, 'errors');
setEventMessages($account->error, $account->errors, 'errors');
}
}

View File

@ -121,14 +121,14 @@ if (empty($reshook))
{
$langs->load('errors');
$langs->load('companies');
setEventMessage($langs->trans('ErrorProdIdIsMandatory', $langs->trans('MergeOriginThirdparty')), 'errors');
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors');
}
else
{
if (!$errors && $soc_origin->fetch($soc_origin_id) < 1)
{
setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
$errors++;
}
@ -197,10 +197,12 @@ if (empty($reshook))
if (!$errors)
{
setEventMessage($langs->trans('ThirdpartiesMergeSuccess'));
setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs');
$db->commit();
} else {
setEventMessage($langs->trans('ErrorsThirdpartyMerge'), 'errors');
}
else
{
setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors');
$db->rollback();
}
}

View File

@ -98,7 +98,7 @@ if (empty($reshook)) {
$enabled = trim(GETPOST('AGENDA_EXT_ENABLED_'.$id.'_'.$i, 'alpha'));
if (!empty($src) && !dol_is_url($src)) {
setEventMessage($langs->trans("ErrorParamMustBeAnUrl"), 'errors');
setEventMessages($langs->trans("ErrorParamMustBeAnUrl"), null, 'errors');
$error ++;
$errorsaved ++;
break;
@ -122,11 +122,11 @@ if (empty($reshook)) {
if (!$error) {
$db->commit();
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
$db->rollback();
if (empty($errorsaved)) {
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
}

View File

@ -83,7 +83,7 @@ if ($action == 'update' && ! $_POST["cancel"])
$result = $account->update($user);
if (! $result)
{
setEventMessage($account->error, 'errors');
setEventMessages($account->error, $account->errors, 'errors');
$_GET["action"]='edit'; // Force chargement page edition
}
else

View File

@ -127,7 +127,7 @@ if (empty($reshook)) {
$nb = $object->getNbOfUsers("active");
if ($nb >= $conf->file->main_limit_users) {
$error ++;
setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors');
setEventMessages($langs->trans("YourQuotaOfUsersIsReached"), null, 'errors');
}
}
@ -146,7 +146,7 @@ if (empty($reshook)) {
$result = $object->delete();
if ($result < 0) {
$langs->load("errors");
setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors');
setEventMessages($langs->trans("ErrorUserCannotBeDelete"), null, 'errors');
} else {
header("Location: index.php");
exit;
@ -160,12 +160,12 @@ if (empty($reshook)) {
if (!$_POST["lastname"]) {
$error ++;
setEventMessage($langs->trans("NameNotDefined"), 'errors');
setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
$action = "create"; // Go back to create page
}
if (!$_POST["login"]) {
$error ++;
setEventMessage($langs->trans("LoginNotDefined"), 'errors');
setEventMessages($langs->trans("LoginNotDefined"), null, 'errors');
$action = "create"; // Go back to create page
}
@ -173,7 +173,7 @@ if (empty($reshook)) {
$nb = $object->getNbOfUsers("active");
if ($nb >= $conf->file->main_limit_users) {
$error ++;
setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors');
setEventMessages($langs->trans("YourQuotaOfUsersIsReached"), null, 'errors');
$action = "create"; // Go back to create page
}
}
@ -248,14 +248,15 @@ if (empty($reshook)) {
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
exit;
} else {
}
else
{
$langs->load("errors");
$db->rollback();
if (is_array($object->errors) && count($object->errors)) {
setEventMessage($object->errors, 'errors');
} else {
setEventMessage($object->error, 'errors');
}
if (is_array($object->errors) && count($object->errors))
{
setEventMessages($object->error, $object->errors, 'errors');
}
$action = "create"; // Go back to create page
}
}
@ -281,8 +282,10 @@ if (empty($reshook)) {
if ($result > 0) {
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
exit;
} else {
setEventMessage($object->error, 'errors');
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -295,12 +298,12 @@ if (empty($reshook)) {
$error = 0;
if (!$_POST["lastname"]) {
setEventMessage($langs->trans("NameNotDefined"), 'errors');
setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
$action = "edit"; // Go back to create page
$error ++;
}
if (!$_POST["login"]) {
setEventMessage($langs->trans("LoginNotDefined"), 'errors');
setEventMessages($langs->trans("LoginNotDefined"), null, 'errors');
$action = "edit"; // Go back to create page
$error ++;
}
@ -398,8 +401,10 @@ if (empty($reshook)) {
$error ++;
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessage($langs->trans("ErrorLoginAlreadyExists", $object->login), 'errors');
} else {
setEventMessages($langs->trans("ErrorLoginAlreadyExists", $object->login), null, 'errors');
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -427,7 +432,7 @@ if (empty($reshook)) {
$resql = $db->query($sql);
if (!$resql) {
$error ++;
setEventMessage($db->lasterror(), 'errors');
setEventMessages($db->lasterror(), null, 'errors');
}
}
@ -449,7 +454,7 @@ if (empty($reshook)) {
$result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']);
if (!$result > 0) {
setEventMessage($langs->trans("ErrorFailedToSaveFile"), 'errors');
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
} else {
// Create small thumbs for company (Ratio is near 16/9)
// Used on logon for example
@ -468,7 +473,7 @@ if (empty($reshook)) {
}
if (!$error && !count($object->errors)) {
setEventMessage($langs->trans("UserModified"));
setEventMessages($langs->trans("UserModified"), null, 'mesgs');
$db->commit();
$login = $_SESSION["dol_login"];
@ -490,8 +495,9 @@ if (empty($reshook)) {
$object->oldcopy = dol_clone($object);
$ret = $object->setPassword($user, $_POST["password"]);
if ($ret < 0) {
setEventMessage($object->error, 'errors');
if ($ret < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
@ -502,7 +508,7 @@ if (empty($reshook)) {
$ret=$object->setPassword($user,$_POST["password"]);
if ($ret < 0)
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -515,17 +521,22 @@ if (empty($reshook)) {
$newpassword = $object->setPassword($user, '');
if ($newpassword < 0) {
// Echec
setEventMessage($langs->trans("ErrorFailedToSetNewPassword"), 'errors');
setEventMessages($langs->trans("ErrorFailedToSetNewPassword"), null, 'errors');
} else {
// Succes
if ($action == 'confirm_passwordsend' && $confirm == 'yes') {
if ($object->send_password($user, $newpassword) > 0) {
setEventMessage($langs->trans("PasswordChangedAndSentTo", $object->email));
} else {
setEventMessage($object->error, 'errors');
if ($object->send_password($user, $newpassword) > 0)
{
setEventMessages($langs->trans("PasswordChangedAndSentTo", $object->email), null, 'mesgs');
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
setEventMessage($langs->trans("PasswordChangedTo", $newpassword), 'errors');
}
else
{
setEventMessages($langs->trans("PasswordChangedTo", $newpassword), null, 'errors');
}
}
}
@ -577,8 +588,10 @@ if (empty($reshook)) {
$ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID];
}
}
} else {
setEventMessage($ldap->error, 'errors');
}
else
{
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
}
}
@ -664,12 +677,12 @@ if (($action == 'create') || ($action == 'adduserldap'))
}
else
{
setEventMessage($ldap->error, 'errors');
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
}
else
{
setEventMessage($ldap->error, 'errors');
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
// If user list is full, we show drop-down list
@ -1123,7 +1136,7 @@ else
$entries = $ldap->fetch($object->login,$userSearchFilter);
if (! $entries)
{
setEventMessage($ldap->error, 'errors');
setEventMessages($ldap->error, $ldap->errors, 'errors');
}
$passDoNotExpire = 0;

View File

@ -63,8 +63,9 @@ if (empty($reshook)) {
$edituser->clicktodial_poste = GETPOST("poste");
$result = $edituser->update_clicktodial();
if ($result < 0) {
setEventMessage($edituser->error, 'errors');
if ($result < 0)
{
setEventMessages($edituser->error, $edituser->errors, 'errors');
}
}
}

View File

@ -80,7 +80,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
else
{
$langs->load("errors");
setEventMessage($langs->trans('ErrorForbidden'), 'errors');
setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
}
}
@ -92,7 +92,7 @@ if ($action == 'add')
if ($caneditperms)
{
if (! $_POST["nom"]) {
setEventMessage($langs->trans("NameNotDefined"), 'errors');
setEventMessages($langs->trans("NameNotDefined"), null, 'errors');
$action="create"; // Go back to create page
} else {
$object->nom = trim($_POST["nom"]); // For backward compatibility
@ -122,7 +122,7 @@ if ($action == 'add')
$db->rollback();
$langs->load("errors");
setEventMessage($langs->trans("ErrorGroupAlreadyExists",$object->name), 'errors');
setEventMessages($langs->trans("ErrorGroupAlreadyExists",$object->name), null, 'errors');
$action="create"; // Go back to create page
}
}
@ -130,7 +130,7 @@ if ($action == 'add')
else
{
$langs->load("errors");
setEventMessage($langs->trans('ErrorForbidden'), 'errors');
setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
}
}
@ -156,14 +156,14 @@ if ($action == 'adduser' || $action =='removeuser')
}
else
{
setEventMessage($edituser->error, 'errors');
setEventMessages($edituser->error, $edituser->errors, 'errors');
}
}
}
else
{
$langs->load("errors");
setEventMessage($langs->trans('ErrorForbidden'), 'errors');
setEventMessages($langs->trans('ErrorForbidden'), null, 'errors');
}
}
@ -193,19 +193,19 @@ if ($action == 'update')
if ($ret >= 0 && ! count($object->errors))
{
setEventMessage($langs->trans("GroupModified"));
setEventMessages($langs->trans("GroupModified"), null, 'mesgs');
$db->commit();
}
else
{
setEventMessage($object->error);
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
}
}
else
{
$langs->load("errors");
setEventMessage($langs->trans('ErrorForbidden'));
setEventMessages($langs->trans('ErrorForbidden'), null, 'mesgs');
}
}

View File

@ -73,12 +73,12 @@ if ($action == 'dolibarr2ldap')
if ($result >= 0)
{
setEventMessage($langs->trans("GroupSynchronized"));
setEventMessages($langs->trans("GroupSynchronized"), null, 'mesgs');
$db->commit();
}
else
{
setEventMessage($ldap->error);
setEventMessages($ldap->error, $ldap->errors, 'errors');
$db->rollback();
}
}

View File

@ -70,11 +70,14 @@ if (empty($reshook)) {
$result = $ldap->update($dn, $info, $user, $olddn);
if ($result >= 0) {
setEventMessage($langs->trans("UserSynchronized"));
if ($result >= 0)
{
setEventMessages($langs->trans("UserSynchronized"), null, 'mesgs');
$db->commit();
} else {
setEventMessage($ldap->error, 'errors');
}
else
{
setEventMessages($ldap->error, $ldap->errors, 'errors');
$db->rollback();
}
}