Qual: Uniformize code
This commit is contained in:
parent
8828bd3b9a
commit
58eb6088fa
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org>
|
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||||
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -31,27 +32,37 @@ $langs->load("mails");
|
|||||||
if (!$user->admin)
|
if (!$user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
$action = GETPOST("action");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($_POST["action"] == 'setvalue' && $user->admin)
|
if ($action == 'setvalue' && $user->admin)
|
||||||
{
|
{
|
||||||
$result1=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$_POST["MAILING_EMAIL_FROM"],'chaine',0,'',$conf->entity);
|
$db->begin();
|
||||||
$result2=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$_POST["MAILING_EMAIL_ERRORSTO"],'chaine',0,'',$conf->entity);
|
|
||||||
if (($result1 + $result2) == 2)
|
$mailfrom = GETPOST("MAILING_EMAIL_FROM");
|
||||||
{
|
$mailerror = GETPOST("MAILING_EMAIL_ERRORSTO");
|
||||||
$mesg='<div class="ok">'.$langs->trans("Success").'</div>';
|
|
||||||
}
|
$res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity);
|
||||||
else
|
if (! $res > 0) $error++;
|
||||||
{
|
$res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity);
|
||||||
dol_print_error($db);
|
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>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
@ -93,10 +104,8 @@ print '</td></tr>';
|
|||||||
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
|
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
|
||||||
print '</table></form>';
|
print '</table></form>';
|
||||||
|
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user