Clean code
This commit is contained in:
parent
aec2579c41
commit
3ab2308124
@ -19,16 +19,6 @@
|
|||||||
* \file htdocs/public/eventorganization/attendee_new.php
|
* \file htdocs/public/eventorganization/attendee_new.php
|
||||||
* \ingroup project
|
* \ingroup project
|
||||||
* \brief Example of form to subscribe to an event
|
* \brief Example of form to subscribe to an event
|
||||||
*
|
|
||||||
* Note that you can add following constant to change behaviour of page
|
|
||||||
* MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form
|
|
||||||
* MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited
|
|
||||||
* MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe
|
|
||||||
* MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation)
|
|
||||||
* MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted
|
|
||||||
* MEMBER_NEWFORM_FORCETYPE Force type of member
|
|
||||||
* MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy)
|
|
||||||
* MEMBER_NEWFORM_FORCECOUNTRYCODE Force country
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('NOLOGIN')) {
|
if (!defined('NOLOGIN')) {
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
* Note that you can add following constant to change behaviour of page
|
* Note that you can add following constant to change behaviour of page
|
||||||
* MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form
|
* MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form
|
||||||
* MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited
|
* MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited
|
||||||
|
* MEMBER_MIN_AMOUNT Minimum amount
|
||||||
* MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe
|
* MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe
|
||||||
* MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation)
|
* MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation)
|
||||||
* MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted
|
* MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted
|
||||||
|
|||||||
@ -481,7 +481,7 @@ if ($action == 'dopayment') {
|
|||||||
|
|
||||||
|
|
||||||
// Called when choosing Stripe mode.
|
// Called when choosing Stripe mode.
|
||||||
// When using the Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture.
|
// When using the old Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture.
|
||||||
// When using the PaymentIntent API architecture, the Stripe customer was already created when creating PaymentIntent when showing payment page, and the payment is already ok when action=charge.
|
// When using the PaymentIntent API architecture, the Stripe customer was already created when creating PaymentIntent when showing payment page, and the payment is already ok when action=charge.
|
||||||
if ($action == 'charge' && !empty($conf->stripe->enabled)) {
|
if ($action == 'charge' && !empty($conf->stripe->enabled)) {
|
||||||
$amountstripe = $amount;
|
$amountstripe = $amount;
|
||||||
@ -728,7 +728,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// When using the PaymentIntent API architecture
|
// When using the PaymentIntent API architecture (mode set on by default into conf.class.php)
|
||||||
if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) {
|
if (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) {
|
||||||
$service = 'StripeTest';
|
$service = 'StripeTest';
|
||||||
$servicestatus = 0;
|
$servicestatus = 0;
|
||||||
@ -793,8 +793,8 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) {
|
|||||||
$remoteip = getUserRemoteIP();
|
$remoteip = getUserRemoteIP();
|
||||||
|
|
||||||
$_SESSION["onlinetoken"] = $stripeToken;
|
$_SESSION["onlinetoken"] = $stripeToken;
|
||||||
$_SESSION["FinalPaymentAmt"] = $amount;
|
$_SESSION["FinalPaymentAmt"] = $amount; // amount really paid (coming from Stripe). Will be used for check in paymentok.php.
|
||||||
$_SESSION["currencyCodeType"] = $currency;
|
$_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php.
|
||||||
$_SESSION["paymentType"] = '';
|
$_SESSION["paymentType"] = '';
|
||||||
$_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip
|
$_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip
|
||||||
$_SESSION['payerID'] = is_object($customer) ? $customer->id : '';
|
$_SESSION['payerID'] = is_object($customer) ? $customer->id : '';
|
||||||
|
|||||||
@ -417,7 +417,7 @@ if ($ispaymentok) {
|
|||||||
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
// Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time)
|
||||||
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
|
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) {
|
||||||
// Security protection:
|
// Security protection:
|
||||||
if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount
|
if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount (if free amount is allowed, no need to check)
|
||||||
if ($object->status == $object::STATUS_DRAFT) { // If the member is not yet validated, we check that the amount is the same as expected.
|
if ($object->status == $object::STATUS_DRAFT) { // If the member is not yet validated, we check that the amount is the same as expected.
|
||||||
$typeid = $object->typeid;
|
$typeid = $object->typeid;
|
||||||
|
|
||||||
@ -440,6 +440,17 @@ if ($ispaymentok) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Security protection:
|
||||||
|
if (!empty($conf->global->MEMBER_MIN_AMOUNT)) {
|
||||||
|
if ($FinalPaymentAmt < $conf->global->MEMBER_MIN_AMOUNT) {
|
||||||
|
$error++;
|
||||||
|
$errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') is lower than the minimum allowed ('.$conf->global->MEMBER_MIN_AMOUNT.'). May be a hack to try to pay a different amount ?';
|
||||||
|
$postactionmessages[] = $errmsg;
|
||||||
|
$ispostactionok = -1;
|
||||||
|
dol_syslog("Failed to validate member (amount lower than minimum): ".$errmsg, LOG_ERR, 0, '_payment');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Security protection:
|
// Security protection:
|
||||||
if ($currencyCodeType && $currencyCodeType != $conf->currency) { // Check that currency is the good one
|
if ($currencyCodeType && $currencyCodeType != $conf->currency) { // Check that currency is the good one
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -19,16 +19,6 @@
|
|||||||
* \file htdocs/public/project/suggestbooth.php
|
* \file htdocs/public/project/suggestbooth.php
|
||||||
* \ingroup member
|
* \ingroup member
|
||||||
* \brief Example of form to suggest a booth
|
* \brief Example of form to suggest a booth
|
||||||
*
|
|
||||||
* Note that you can add following constant to change behaviour of page
|
|
||||||
* MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form
|
|
||||||
* MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited
|
|
||||||
* MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe
|
|
||||||
* MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation)
|
|
||||||
* MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted
|
|
||||||
* MEMBER_NEWFORM_FORCETYPE Force type of member
|
|
||||||
* MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy)
|
|
||||||
* MEMBER_NEWFORM_FORCECOUNTRYCODE Force country
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('NOLOGIN')) {
|
if (!defined('NOLOGIN')) {
|
||||||
|
|||||||
@ -19,16 +19,6 @@
|
|||||||
* \file htdocs/public/project/suggestconference.php
|
* \file htdocs/public/project/suggestconference.php
|
||||||
* \ingroup member
|
* \ingroup member
|
||||||
* \brief Example of form to suggest a conference
|
* \brief Example of form to suggest a conference
|
||||||
*
|
|
||||||
* Note that you can add following constant to change behaviour of page
|
|
||||||
* MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form
|
|
||||||
* MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited
|
|
||||||
* MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe
|
|
||||||
* MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation)
|
|
||||||
* MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted
|
|
||||||
* MEMBER_NEWFORM_FORCETYPE Force type of member
|
|
||||||
* MEMBER_NEWFORM_FORCEMORPHY Force nature of member (mor/phy)
|
|
||||||
* MEMBER_NEWFORM_FORCECOUNTRYCODE Force country
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('NOLOGIN')) {
|
if (!defined('NOLOGIN')) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user