Skip to content

Commit

Permalink
Qual: Better error management
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Aug 27, 2011
1 parent 27300fe commit f198d8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 9 additions & 1 deletion htdocs/adherents/card_subscriptions.php
Expand Up @@ -212,7 +212,15 @@
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)
Expand Down
5 changes: 3 additions & 2 deletions htdocs/core/class/translate.class.php
Expand Up @@ -391,11 +391,12 @@ function getTradFromKey($key)
*/
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
Expand Down

0 comments on commit f198d8b

Please sign in to comment.