diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index dff1107be08..e073fd0616b 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -60,10 +60,10 @@ $typeid=isset($_GET["typeid"])?$_GET["typeid"]:$_POST["typeid"]; * Actions */ -if ($_POST["action"] == 'cotisation' && ! $_POST["cancel"]) +if ($user->rights->adherent->cotisation->creer && $_POST["action"] == 'cotisation' && ! $_POST["cancel"]) { $langs->load("banks"); - + $adh->id = $rowid; $result=$adh->fetch($rowid); @@ -93,18 +93,22 @@ if ($_POST["action"] == 'cotisation' && ! $_POST["cancel"]) if ($adht->cotisation) { - if ($conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) - { - if (! $_POST["label"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); - if (! $_POST["operation"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")); - if (! $_POST["accountid"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("FinancialAccount")); - if ($errmsg) $action='addsubscription'; - } - if (! $_POST["cotisation"] > 0) + if (! is_numeric($_POST["cotisation"])) { + // If field is '' or not a numeric value $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); $action='addsubscription'; } + else + { + if ($_POST["cotisation"] && $conf->banque->enabled && $conf->global->ADHERENT_BANK_USE) + { + if (! $_POST["label"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")); + if (! $_POST["operation"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")); + if (! $_POST["accountid"]) $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("FinancialAccount")); + if ($errmsg) $action='addsubscription'; + } + } } if ($action=='cotisation') diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 4dd447e64bc..9c3d787f2d9 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -216,7 +216,7 @@ if ($_GET["action"] == 'create') print $htmls->selectyesno("vote",0,1); print ''; - print '