Uniformize code

This commit is contained in:
Juanjo Menent 2011-09-02 15:41:35 +00:00
parent 37086d010e
commit e237ca83f7
2 changed files with 21 additions and 9 deletions

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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 = '<font class="ok">'.$langs->trans("SetupSaved").'</font>';
if (! $res > 0) $error++;
if (! $error)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
}
@ -150,11 +162,9 @@ print "</form>\n";
print '</div>';
if ($mesg) print "<br>$mesg<br>";
print "<br>";
dol_htmloutput_mesg($mesg);
$db->close();

View File

@ -122,7 +122,7 @@ print '</div>';
clearstatcache();
if ($mesg) print "<br>$mesg<br>";
//if ($mesg) print "<br>$mesg<br>";
print "<br>";
// Show message
@ -146,6 +146,8 @@ $message.=$langs->trans("AgendaUrlOptions4",$user->login,$user->login).'<br>';
$message.=$langs->trans("AgendaUrlOptions5",$user->login,$user->login);
print info_admin($message);
dol_htmloutput_mesg($mesg);
$db->close();
llxFooter();