FIX Bad redirect url for payment of members after public registration
This commit is contained in:
parent
6e27abaed9
commit
54e335937f
@ -386,35 +386,25 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') {
|
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') {
|
||||||
$urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
|
||||||
|
|
||||||
if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If edition of amount not allowed
|
if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If edition of amount not allowed
|
||||||
// TODO Check amount is same than the amount required for the type of member or if not defined as the defeault amount into $conf->global->MEMBER_NEWFORM_AMOUNT
|
// TODO Check amount is same than the amount required for the type of member or if not defined as the defeault amount into $conf->global->MEMBER_NEWFORM_AMOUNT
|
||||||
// It is not so important because a test is done on return of payment validation.
|
// It is not so important because a test is done on return of payment validation.
|
||||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
|
||||||
} elseif (price2num(GETPOST('amount', 'alpha'))) {
|
|
||||||
$urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$urlback = getOnlinePaymentUrl(0, 'member', $adh->ref, price2num(GETPOST('amount', 'alpha'), 'MT'), '', 0);
|
||||||
|
|
||||||
if (GETPOST('email')) {
|
if (GETPOST('email')) {
|
||||||
$urlback .= '&email='.urlencode(GETPOST('email'));
|
$urlback .= '&email='.urlencode(GETPOST('email'));
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
|
||||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
|
||||||
} else {
|
|
||||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($conf->global->MEMBER_NEWFORM_PAYONLINE != '-1' && $conf->global->MEMBER_NEWFORM_PAYONLINE != 'all') {
|
if ($conf->global->MEMBER_NEWFORM_PAYONLINE != '-1' && $conf->global->MEMBER_NEWFORM_PAYONLINE != 'all') {
|
||||||
$urlback .= '&paymentmethod='.urlencode($conf->global->MEMBER_NEWFORM_PAYONLINE);
|
$urlback .= '&paymentmethod='.urlencode($conf->global->MEMBER_NEWFORM_PAYONLINE);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (!empty($entity)) {
|
||||||
|
$urlback .= '&entity='.((int) $entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($entity)) {
|
|
||||||
$urlback .= '&entity='.((int) $entity);
|
|
||||||
}
|
|
||||||
dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback);
|
dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback);
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -1461,9 +1461,12 @@ if ($source == 'member' || $source == 'membersubscription') {
|
|||||||
$langs->load("members");
|
$langs->load("members");
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php';
|
||||||
|
|
||||||
$member = new Adherent($db);
|
$member = new Adherent($db);
|
||||||
|
$adht = new AdherentType($db);
|
||||||
|
|
||||||
$result = $member->fetch('', $ref);
|
$result = $member->fetch('', $ref);
|
||||||
if ($result <= 0) {
|
if ($result <= 0) {
|
||||||
$mesg = $member->error;
|
$mesg = $member->error;
|
||||||
@ -1471,6 +1474,8 @@ if ($source == 'member' || $source == 'membersubscription') {
|
|||||||
} else {
|
} else {
|
||||||
$member->fetch_thirdparty();
|
$member->fetch_thirdparty();
|
||||||
$subscription = new Subscription($db);
|
$subscription = new Subscription($db);
|
||||||
|
|
||||||
|
$adht->fetch($member->typeid);
|
||||||
}
|
}
|
||||||
$object = $member;
|
$object = $member;
|
||||||
|
|
||||||
@ -1479,6 +1484,11 @@ if ($source == 'member' || $source == 'membersubscription') {
|
|||||||
if (GETPOST("amount", 'alpha')) {
|
if (GETPOST("amount", 'alpha')) {
|
||||||
$amount = GETPOST("amount", 'alpha');
|
$amount = GETPOST("amount", 'alpha');
|
||||||
}
|
}
|
||||||
|
// If amount still not defined, we take amount of the type of member
|
||||||
|
if (empty($amount)) {
|
||||||
|
$amount = $adht->amount;
|
||||||
|
}
|
||||||
|
|
||||||
$amount = price2num($amount, 'MT');
|
$amount = price2num($amount, 'MT');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user