diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php
index 85ed30b8d59..93c8f763efb 100644
--- a/htdocs/core/js/lib_head.js.php
+++ b/htdocs/core/js/lib_head.js.php
@@ -1464,6 +1464,7 @@ function pricejs(amount, mode = 'MT', currency_code = '', force_locale = '') {
*/
function price2numjs(amount) {
if (amount == '') return '';
+ if (amount == null) return ''; /* null or undefined */
var dec = ;
var thousand = ;
diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php
index f83e0e00b7f..dc0d4825965 100644
--- a/htdocs/core/tpl/admin_extrafields_add.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php
@@ -269,7 +269,7 @@ print $formadmin->selectTypeOfFields('type', GETPOST('type', 'alpha'));
+
diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
index 5888fa08c6d..3478e53d82d 100644
--- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php
+++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php
@@ -346,7 +346,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) {
+
'.$langs->trans("Company").' ';
+ print ' '.$langs->trans("Company").' ';
print img_picto('', 'company', 'class="pictofixedwidth paddingright"');
print ' '."\n";
@@ -1001,7 +1002,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
// Add hook to complete the form
- $parameters = array('country_id' => $country_id);
+ $parameters = array('country_id' => $country_id, 'mode' => 'new');
$reshook = $hookmanager->executeHooks('membershipNewSubscriptionPublicForm', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@@ -1012,15 +1013,15 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
// Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER
$s = $langs->trans("AreYouAPreferredPartner", '{s1} ');
$s = str_replace('{s1}', 'Peferred Partner', $s);
- print ''.$s.' ';
+ print ' '.$s.' ';
print ' ';
print ' ';
- print ''.$langs->trans("TurnoverOrBudget").' ';
+ print ' '.$langs->trans("TurnoverOrBudget").' ';
$country_code = dol_getIdFromCode($db, $country_id, 'c_country', 'rowid', 'code');
if ($country_code === 'FR' && $checkednature === 'mor' && GETPOST('pp')) {
- print ' ';
+ print ' ';
} else {
$arraybudget = array('50' => '<= 100 000', '100' => '<= 200 000', '200' => '<= 500 000', '300' => '<= 1 500 000', '600' => '<= 3 000 000', '1000' => '<= 5 000 000', '2000' => '5 000 000+');
print $form->selectarray('budget', $arraybudget, GETPOSTINT('budget'), 1, 0, 0, '', 0, 0, 0, '');
@@ -1058,14 +1059,16 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
jQuery("#newmember").submit();
});
jQuery("#budget").change(function() {
- console.log("Turnover amount has been modified");
+ console.log("Turnover amount has been modified on change");
newamount = initturnover();
jQuery("#amount").val(newamount);
+ jQuery("#amounthidden").val(newamount);
});
jQuery("#budget").keyup(function() {
- console.log("Turnover amount has been modified");
+ console.log("Turnover amount has been modified on keyup");
newamount = initturnover();
jQuery("#amount").val(newamount);
+ jQuery("#amounthidden").val(newamount);
});
function initturnover() {
@@ -1074,7 +1077,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
morphy = jQuery("#moralinput").is(\':checked\') ? \'mor\' : \'phy\';
selectcountry_id = jQuery("#selectcountry_id").val();
pp = jQuery("#pp").is(\':checked\') ? true : false;
- console.log("Set fields according to nature other properties");
+ console.log("Set fields according to nature and other properties");
console.log("morphy="+morphy);
console.log("selectcountry_id="+selectcountry_id);
console.log("pp="+pp);
@@ -1098,7 +1101,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
if (selectcountry_id == 1) {
if (pp) {
console.log("value selected in input text field is "+jQuery("#budget").val());
- newamount = Math.max(Math.round(jQuery("#budget").val() * 0.005), 50);
+ newamount = Math.max(Math.round(price2numjs(jQuery("#budget").val()) * 0.005), 50);
console.log("newamount = "+newamount);
} else {
console.log("not a pp");
@@ -1117,6 +1120,7 @@ if (getDolGlobalString('MEMBER_SKIP_TABLE') || getDolGlobalString('MEMBER_NEWFOR
jQuery("#budget").val(\'\');
newamount = \'\';
}
+ console.log("newamount="+newamount);
}
}
diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php
index a23d3093ac2..b78bd24c6a2 100644
--- a/htdocs/public/payment/newpayment.php
+++ b/htdocs/public/payment/newpayment.php
@@ -1001,6 +1001,7 @@ print ' ';
//print ' ';
print ' ';
print ' ';
+print ' ';
print "\n";
@@ -1807,19 +1808,170 @@ if ($source == 'member' || $source == 'membersubscription') {
}
}
+
+ // Add hook to complete the form
+ $parameters = array('mode' => 'renewal');
+ $reshook = $hookmanager->executeHooks('membershipNewSubscriptionPublicForm', $parameters, $object, $action);
+ if ($reshook < 0) {
+ setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+ $error++;
+ }
+
+ // TODO Move this into previous hook
+ if (getDolGlobalString('MEMBER_NEWFORM_DOLIBARRTURNOVER')) {
+ $country_id = 0;
+ if ($member->thirdparty instanceOf Societe) {
+ $country_id = $member->thirdparty->country_id;
+ }
+ $checkednature = $member->morphy;
+ print ' ';
+
+ // Is it a Preferred Partner
+ $pp = 0;
+ include_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
+ $partnership = new Partnership($db);
+ $result = $partnership->fetch(0, null, null, $member->thirdparty->id);
+ if ($result > 0) {
+ $pp = 1;
+ }
+
+ // Do not set a default amount MEMBER_NEWFORM_AMOUNT if you use MEMBER_NEWFORM_DOLIBARRTURNOVER
+ $s = $langs->trans("AreYouAPreferredPartner", '{s1} ');
+ $s = str_replace('{s1}', 'Peferred Partner', $s);
+ print ' '.$s.' ';
+ print ' ';
+ print ' ';
+
+ print ''.$langs->trans("TurnoverOrBudget").' ';
+
+ $country_code = dol_getIdFromCode($db, $country_id, 'c_country', 'rowid', 'code');
+ if ($country_code === 'FR' && $checkednature === 'mor' && (GETPOST('reload') ? GETPOST('pp') : $pp)) {
+ print ' ';
+ } else {
+ $arraybudget = array('50' => '<= 100 000', '100' => '<= 200 000', '200' => '<= 500 000', '300' => '<= 1 500 000', '600' => '<= 3 000 000', '1000' => '<= 5 000 000', '2000' => '5 000 000+');
+ print $form->selectarray('budget', $arraybudget, GETPOSTINT('budget'), 1, 0, 0, ($checkednature === 'mor' ? 'required' :''), 0, 0, 0, '');
+ }
+ print ' € or $';
+
+ print '';
+ print ' '."\n";
+ }
+
+
// Set amount for the subscription from the the type and options:
- // - First check the amount of the member type if not previous payment.
+ // - First check the amount of the member type if there is no previous payment.
$amount = ($member->last_subscription_amount ? $member->last_subscription_amount : (empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid]));
// - If not found, take the default amount
if (empty($amount) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) {
$amount = getDolGlobalString('MEMBER_NEWFORM_AMOUNT');
}
+
// - If an amount was posted from the form (for example from page with types of membership)
- if ($caneditamount && GETPOSTISSET('amount') && GETPOSTFLOAT('amount', 'MT') > 0) {
+ if ($caneditamount && !GETPOST('reload') && GETPOSTISSET('amount') && GETPOSTFLOAT('amount', 'MT') > 0) {
$amount = GETPOSTFLOAT('amount', 'MT');
}
// - If a new amount was posted from the form
- if ($caneditamount && GETPOSTISSET('newamount') && GETPOSTFLOAT('newamount', 'MT') > 0) {
+ if ($caneditamount && !GETPOST('reload') && GETPOSTISSET('newamount') && GETPOSTFLOAT('newamount', 'MT') > 0) {
$amount = GETPOSTFLOAT('newamount', 'MT');
}
// - If a min is set or an amount from the posted form, we take them into account
@@ -1829,18 +1981,18 @@ if ($source == 'member' || $source == 'membersubscription') {
print ''.$langs->trans("Amount");
// This place no longer allows amount edition
if (getDolGlobalString('MEMBER_EXT_URL_SUBSCRIPTION_INFO')) {
- print ' - '.$langs->trans("SeeHere").' ';
+ print ' - '.img_picto('', 'url', 'class="pictofixedwidth"').$langs->trans("SeeHere").' ';
}
print ' ';
$caneditamount = $adht->caneditamount;
$minimumamount = !getDolGlobalString('MEMBER_MIN_AMOUNT') ? $adht->amount : max(getDolGlobalString('MEMBER_MIN_AMOUNT'), $adht->amount, $amount);
- if ($caneditamount && $action != 'dopayment') {
+ if ($caneditamount && ($action != 'dopayment' || GETPOST('reload'))) {
if (GETPOSTISSET('newamount')) {
- print ' ';
+ print ' ';
} else {
- print ' ';
+ print ' ';
}
} else {
print ''.price($amount, 1, $langs, 1, -1, -1, $currency).' '; // Price with currency
@@ -2580,7 +2732,7 @@ if (preg_match('/^dopayment/', $action)) { // If we choose/clicked on the paym
// JS Code for Stripe
if (empty($stripearrayofkeys['publishable_key'])) {
$langs->load("errors");
- print info_admin($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Stripe")), 0, 0, 'error');
+ print info_admin($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Stripe")), 0, 0, 'error marginleftonly marginrightonly');
} else {
print '';
print ''."\n";
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index bc5fffe51be..0ea8a7490b6 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -5781,6 +5781,15 @@ div.boximport {
.product_line_stock_too_low { color: var(--productlinestocktoolow); }
.fieldrequired { font-weight: bold; color: var(--fieldrequiredcolor) !important; }
+#tablesubscribe .fieldrequired {
+ font-weight: inherit !important;
+ color: inherit !important;
+}
+#tablesubscribe .fieldrequired:after {
+ content: " *";
+ color: #660000;
+ font-weight: bold;
+}
td.widthpictotitle, .table-fiche-title img.widthpictotitle { width: 34px; text-align: ; }
span.widthpictotitle { font-size: 1.5em; }
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index e9bdf0ac745..9690da24525 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -5713,6 +5713,15 @@ div.boximport {
.product_line_stock_too_low { color: #884400; }
.fieldrequired { font-weight: bold; color: #000055; }
+#tablesubscribe .fieldrequired {
+ font-weight: inherit !important;
+ color: inherit !important;
+}
+#tablesubscribe .fieldrequired:after {
+ content: " *";
+ color: #660000;
+ font-weight: bold;
+}
td.widthpictotitle, .table-fiche-title img.widthpictotitle { width: 32px; font-size: 1.4em; text-align: ; }
table.titlemodulehelp tr td img.widthpictotitle { width: 80px; }