Skip to content
Snippets Groups Projects
Commit 947acfff authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

FIX #7173

parent 6b5b10fc
No related branches found
No related tags found
No related merge requests found
...@@ -113,7 +113,6 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights ...@@ -113,7 +113,6 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
if ($result < 0) if ($result < 0)
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans($company->error);
setEventMessages($company->error, $company->errors, 'errors'); setEventMessages($company->error, $company->errors, 'errors');
} }
else else
...@@ -123,7 +122,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights ...@@ -123,7 +122,7 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights
} }
else else
{ {
$errmsg=$object->error; setEventMessages($object->error, $object->errors, 'errors');
} }
} }
...@@ -211,7 +210,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -211,7 +210,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]); $paymentdate=dol_mktime(0, 0, 0, $_POST["paymentmonth"], $_POST["paymentday"], $_POST["paymentyear"]);
} }
$subscription=$_POST["subscription"]; // Amount of subscription $subscription=price2num(GETPOST("subscription",'alpha')); // Amount of subscription
$label=$_POST["label"]; $label=$_POST["label"];
// Payment informations // Payment informations
...@@ -229,6 +228,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -229,6 +228,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription")); $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateSubscription"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription'; $action='addsubscription';
} }
if (GETPOST('end') && ! $datesubend) if (GETPOST('end') && ! $datesubend)
...@@ -236,6 +236,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -236,6 +236,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription")); $errmsg=$langs->trans("ErrorBadDateFormat",$langs->transnoentitiesnoconv("DateEndSubscription"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription'; $action='addsubscription';
} }
if (! $datesubend) if (! $datesubend)
...@@ -246,16 +247,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -246,16 +247,20 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$error++; $error++;
$errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment")); $errmsg=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment"));
setEventMessages($errmsg, null, 'errors');
$action='addsubscription'; $action='addsubscription';
} }
$amount = price2num(GETPOST("subscription",'alpha'));
// Check if a payment is mandatory or not // Check if a payment is mandatory or not
if (! $error && $adht->subscription) // Member type need subscriptions if (! $error && $adht->subscription) // Member type need subscriptions
{ {
if (! is_numeric($_POST["subscription"])) if (! is_numeric($amount))
{ {
// If field is '' or not a numeric value // If field is '' or not a numeric value
$errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")); $errmsg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount"));
setEventMessages($errmsg, null, 'errors');
$error++; $error++;
$action='addsubscription'; $action='addsubscription';
} }
...@@ -273,7 +278,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -273,7 +278,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount"); if ($_POST["accountid"]) $errmsg=$langs->trans("ErrorDoNotProvideAccountsIfNullAmount");
} }
if ($errmsg) $action='addsubscription'; if ($errmsg)
{
setEventMessages($errmsg, null, 'errors');
$action='addsubscription';
}
} }
} }
} }
...@@ -319,6 +328,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -319,6 +328,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$error++; $error++;
$errmsg=$db->lasterror(); $errmsg=$db->lasterror();
setEventMessages($errmsg, null, 'errors');
} }
} }
else else
...@@ -326,6 +336,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -326,6 +336,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$errmsg=$acct->error; $errmsg=$acct->error;
$errmsgs=$acct->errors; $errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
} }
} }
else else
...@@ -333,6 +344,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -333,6 +344,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
$error++; $error++;
$errmsg=$acct->error; $errmsg=$acct->error;
$errmsgs=$acct->errors; $errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
} }
} }
...@@ -351,6 +363,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -351,6 +363,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$langs->load("errors"); $langs->load("errors");
$errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst"); $errmsg=$langs->trans("ErrorMemberNotLinkedToAThirpartyLinkOrCreateFirst");
setEventMessages($errmsg, null, 'errors');
$error++; $error++;
} }
} }
...@@ -361,6 +374,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -361,6 +374,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$customer->error; $errmsg=$customer->error;
$errmsgs=$acct->errors; $errmsgs=$acct->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
...@@ -378,6 +392,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -378,6 +392,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$error++; $error++;
$errmsg='ErrorNoPaymentTermRECEPFound'; $errmsg='ErrorNoPaymentTermRECEPFound';
setEventMessages($errmsg, null, 'errors');
} }
} }
$invoice->socid=$object->fk_soc; $invoice->socid=$object->fk_soc;
...@@ -395,6 +410,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -395,6 +410,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$invoice->error; $errmsg=$invoice->error;
$errmsgs=$invoice->errors; $errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
...@@ -415,6 +431,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -415,6 +431,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result <= 0) if ($result <= 0)
{ {
$errmsg=$invoice->error; $errmsg=$invoice->error;
setEventMessages($errmsg, null, 'errors');
$error++; $error++;
} }
} }
...@@ -427,6 +444,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -427,6 +444,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$invoice->error; $errmsg=$invoice->error;
$errmsgs=$invoice->errors; $errmsgs=$invoice->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
...@@ -454,6 +472,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -454,6 +472,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
{ {
$errmsg=$paiement->error; $errmsg=$paiement->error;
$errmsgs=$paiement->errors; $errmsgs=$paiement->errors;
setEventMessages($errmsg, $errmsgs, 'errors');
$error++; $error++;
} }
} }
...@@ -535,6 +554,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! ...@@ -535,6 +554,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
if ($result < 0) if ($result < 0)
{ {
$errmsg=$object->error; $errmsg=$object->error;
setEventMessages($errmsg, null, 'errors');
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment