diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index b6659e9aa0e..605cb8ed290 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -1,6 +1,7 @@ * Copyright (C) 2011 Regis Houssin + * Copyright (C) 2011 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,7 +32,6 @@ if (!$user->admin) $langs->load("admin"); $langs->load("other"); -$langs->load("agenda"); $action=$_POST["action"]; @@ -67,7 +67,7 @@ else /* * Actions */ -if ($_POST["action"] == "save" && empty($_POST["cancel"])) +if ($action == "save" && empty($_POST["cancel"])) { $i=0; @@ -77,12 +77,24 @@ if ($_POST["action"] == "save" && empty($_POST["cancel"])) { $param='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; //print "param=".$param." - ".$_POST[$param]; - if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0,'',$conf->entity); - else dolibarr_del_const($db,$param,$conf->entity); + if (! empty($_POST[$param])) $res = dolibarr_set_const($db,$param,$_POST[$param],'chaine',0,'',$conf->entity); + else $res = dolibarr_del_const($db,$param,$conf->entity); } $db->commit(); - $mesg = ''.$langs->trans("SetupSaved").''; + + if (! $res > 0) $error++; + + if (! $error) + { + $db->commit(); + $mesg = "".$langs->trans("SetupSaved").""; + } + else + { + $db->rollback(); + $mesg = "".$langs->trans("Error").""; + } } @@ -150,11 +162,9 @@ print "\n"; print ''; - - -if ($mesg) print "
$mesg
"; print "
"; +dol_htmloutput_mesg($mesg); $db->close(); diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 45cd460491f..06d52f46065 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -122,7 +122,7 @@ print ''; clearstatcache(); -if ($mesg) print "
$mesg
"; +//if ($mesg) print "
$mesg
"; print "
"; // Show message @@ -146,6 +146,8 @@ $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'
'; $message.=$langs->trans("AgendaUrlOptions5",$user->login,$user->login); print info_admin($message); +dol_htmloutput_mesg($mesg); + $db->close(); llxFooter();