diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang
index 183a6034344..b624fb505e3 100644
--- a/htdocs/langs/en_US/members.lang
+++ b/htdocs/langs/en_US/members.lang
@@ -207,8 +207,9 @@ MembershipStatistics=Membership statistics
NbOfSubscriptions=Number of memberships
AmountOfSubscriptions=Amount collected from membership payments
TurnoverOrBudget=Turnover (for a company) or Budget (for a foundation)
+AreYouAPreferredPartner=Are you (or plan to be) a %s
DefaultAmount=Default amount of membership payment (used only if no amount is defined at member type level)
-MinimumAmount=Minimum amount of membership payment (has priority on any default amounts)
+MinimumAmount=Minimum amount of membership payment (has priority on any default amounts that is lower)
CanEditAmount=Membership amount can be defined by the member
CanEditAmountDetail=Visitor can choose/edit amount of its contribution regardless of the member type
AmountIsLowerToMinimumNotice=The amount is lower than the minimum %s
diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php
index 48f9230d28a..6a92a3962b3 100644
--- a/htdocs/public/members/new.php
+++ b/htdocs/public/members/new.php
@@ -62,6 +62,14 @@ define("DOLENTITY", $entity);
// Load Dolibarr environment
require '../../main.inc.php';
+/**
+ * @var Conf $conf
+ * @var DoliDB $db
+ * @var HookManager $hookmanager
+ * @var Societe $mysoc
+ * @var Translate $langs
+ * @var User $user
+ */
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@@ -79,15 +87,6 @@ $errmsg = '';
$num = 0;
$error = 0;
-/**
- * @var Conf $conf
- * @var DoliDB $db
- * @var HookManager $hookmanager
- * @var Societe $mysoc
- * @var Translate $langs
- * @var User $user
- */
-
// Load translation files
$langs->loadLangs(array("main", "members", "companies", "install", "other", "errors"));
@@ -336,11 +335,14 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."
\n";
}
+
$lastname = GETPOST("lastname", 'alphanohtml');
$firstname = GETPOST("firstname", 'alphanohtml');
$societe = GETPOST("societe", 'alphanohtml');
$morphy = GETPOST("morphy", 'alphanohtml');
$email = preg_replace('/\s+/', '', GETPOST("member_email", 'aZ09arobase'));
+ $country_id = getDolGlobalInt("MEMBER_NEWFORM_FORCECOUNTRYCODE", GETPOSTINT('country_id'));
+
if ($morphy != 'mor' && empty($lastname)) {
$error++;
$langs->load("errors");
@@ -356,6 +358,11 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he
$langs->load("errors");
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors');
}
+ if (empty($country_id)) {
+ $error++;
+ $langs->load("errors");
+ setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
+ }
if (getDolGlobalString('ADHERENT_MAIL_REQUIRED') && !isValidEmail($email)) {
$error++;
$langs->load("errors");
@@ -367,8 +374,10 @@ if (empty($reshook) && $action == 'add') { // Test on permission not required he
$langs->load("errors");
$errmsg .= $langs->trans("ErrorBadDateFormat")."
\n";
}
+
+ // TODO Add this in a hook
if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) {
- if (GETPOST("morphy") == 'mor' && GETPOST('budget') <= 0) {
+ if (GETPOST("morphy") == 'mor' && GETPOSTFLOAT('budget') <= 0) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("TurnoverOrBudget"))."
\n";
}
@@ -661,7 +670,7 @@ if ($action == "subscription") {
}
// Print form
-print '