Qual: Better error management

This commit is contained in:
Laurent Destailleur 2011-08-27 16:41:30 +00:00
parent 27300fe898
commit f198d8bd8e
2 changed files with 12 additions and 3 deletions

View File

@ -212,7 +212,15 @@ if ($user->rights->adherent->cotisation->creer && $action == 'cotisation' && ! $
if (! $datecotisation)
{
$error++;
$errmsg=$langs->trans("BadDateFormat");
$langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
$action='addsubscription';
}
if (GETPOST('end') && ! $datesubend)
{
$error++;
$langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
$action='addsubscription';
}
if (! $datesubend)

View File

@ -391,11 +391,12 @@ class Translate {
*/
function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
{
if (! empty($this->tab_translate[$key])) // Translation is available
if (! empty($this->tab_translate[$key])) // Translation is available
{
$str=$this->tab_translate[$key];
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
if (! preg_match('/^Format/',$key)) $str=sprintf($str,$param1,$param2,$param3,$param4); // Replace %s and %d except for FormatXXX strings.
if ($maxsize) $str=dol_trunc($str,$maxsize);
// We replace some HTML tags by __xx__ to avoid having them encoded by htmlentities