diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 38d32e7b78d..ea2ce80d6ca 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -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) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index bcc3ae0adc8..f1f707a658f 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -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