|
@@ -65,7 +65,7 @@ discard block |
|
|
block discarded – undo |
|
65
|
65
|
// For MultiCompany module. |
|
66
|
66
|
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php |
|
67
|
67
|
// Because 2 entities can have the same ref. |
|
68
|
|
-$entity = (!empty($_GET['e']) ? (int)$_GET['e'] : (!empty($_POST['e']) ? (int)$_POST['e'] : 1)); |
|
|
68
|
+$entity = (!empty($_GET['e']) ? (int) $_GET['e'] : (!empty($_POST['e']) ? (int) $_POST['e'] : 1)); |
|
69
|
69
|
if (is_numeric($entity)) { |
|
70
|
70
|
define("DOLENTITY", $entity); |
|
71
|
71
|
} |
|
@@ -168,7 +168,7 @@ discard block |
|
|
block discarded – undo |
|
168
|
168
|
if (getDolGlobalString($paramcreditorlong)) { |
|
169
|
169
|
$creditor = getDolGlobalString($paramcreditorlong); // use label long of the seller to show |
|
170
|
170
|
} elseif (getDolGlobalString($paramcreditor)) { |
|
171
|
|
- $creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show |
|
|
171
|
+ $creditor = getDolGlobalString($paramcreditor); // use label short of the seller to show |
|
172
|
172
|
} |
|
173
|
173
|
|
|
174
|
174
|
|
|
@@ -301,7 +301,7 @@ discard block |
|
|
block discarded – undo |
|
301
|
301
|
// Set by newpayment.php |
|
302
|
302
|
$currencyCodeType = $_SESSION['currencyCodeType']; |
|
303
|
303
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; |
|
304
|
|
- $paymentType = $_SESSION['PaymentType']; // Value can be 'Mark', 'Sole', 'Sale' for example |
|
|
304
|
+ $paymentType = $_SESSION['PaymentType']; // Value can be 'Mark', 'Sole', 'Sale' for example |
|
305
|
305
|
// From env |
|
306
|
306
|
$ipaddress = $_SESSION['ipaddress']; |
|
307
|
307
|
|
|
@@ -404,7 +404,7 @@ discard block |
|
|
block discarded – undo |
|
404
|
404
|
$ipaddress = $_SESSION['ipaddress']; |
|
405
|
405
|
} |
|
406
|
406
|
if (empty($TRANSACTIONID)) { |
|
407
|
|
- $TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID']; // pi_... or ch_... |
|
|
407
|
+ $TRANSACTIONID = empty($_SESSION['TRANSACTIONID']) ? '' : $_SESSION['TRANSACTIONID']; // pi_... or ch_... |
|
408
|
408
|
if (empty($TRANSACTIONID) && GETPOST('payment_intent', 'alphanohtml')) { |
|
409
|
409
|
// For the case we use STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION = 2 |
|
410
|
410
|
$TRANSACTIONID = GETPOST('payment_intent', 'alphanohtml'); |
|
@@ -463,7 +463,7 @@ discard block |
|
|
block discarded – undo |
|
463
|
463
|
$adht = new AdherentType($db); |
|
464
|
464
|
$object = new Adherent($db); |
|
465
|
465
|
|
|
466
|
|
- $result1 = $object->fetch((int)$tmptag['MEM']); |
|
|
466
|
+ $result1 = $object->fetch((int) $tmptag['MEM']); |
|
467
|
467
|
$result2 = $adht->fetch($object->typeid); |
|
468
|
468
|
|
|
469
|
469
|
$defaultdelay = !empty($adht->duration_value) ? $adht->duration_value : 1; |
|
@@ -509,7 +509,7 @@ discard block |
|
|
block discarded – undo |
|
509
|
509
|
|
|
510
|
510
|
// Set amount for the subscription: |
|
511
|
511
|
// - First check the amount of the member type. |
|
512
|
|
- $amountbytype = $adht->amountByType(1); // Load the array of amount per type |
|
|
512
|
+ $amountbytype = $adht->amountByType(1); // Load the array of amount per type |
|
513
|
513
|
$amountexpected = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid]; |
|
514
|
514
|
// - If not found, take the default amount |
|
515
|
515
|
if (empty($amountexpected) && getDolGlobalString('MEMBER_NEWFORM_AMOUNT')) { |
|
@@ -564,7 +564,7 @@ discard block |
|
|
block discarded – undo |
|
564
|
564
|
if ($object->datefin > 0) { |
|
565
|
565
|
$datesubscription = dol_time_plus_duree($object->datefin, 1, 'd'); |
|
566
|
566
|
} elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) { |
|
567
|
|
- $datesubscription = dol_time_plus_duree($now, (int)substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)); |
|
|
567
|
+ $datesubscription = dol_time_plus_duree($now, (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)); |
|
568
|
568
|
} |
|
569
|
569
|
|
|
570
|
570
|
if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "m") { |
|
@@ -709,7 +709,7 @@ discard block |
|
|
block discarded – undo |
|
709
|
709
|
$thirdparty = new Societe($db); |
|
710
|
710
|
$thirdparty->fetch($thirdparty_id); |
|
711
|
711
|
|
|
712
|
|
- include_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php'; // This also set $stripearrayofkeysbyenv |
|
|
712
|
+ include_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php'; // This also set $stripearrayofkeysbyenv |
|
713
|
713
|
$stripe = new Stripe($db); |
|
714
|
714
|
//$stripeacc = $stripe->getStripeAccount($service); Already defined previously |
|
715
|
715
|
|
|
@@ -724,7 +724,7 @@ discard block |
|
|
block discarded – undo |
|
724
|
724
|
|
|
725
|
725
|
if (preg_match('/^pi_/', $TRANSACTIONID)) { |
|
726
|
726
|
// This may throw an error if not found. |
|
727
|
|
- $chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID); // payment_intent (pi_...) |
|
|
727
|
+ $chpi = \Stripe\PaymentIntent::retrieve($TRANSACTIONID); // payment_intent (pi_...) |
|
728
|
728
|
} else { |
|
729
|
729
|
// This throw an error if not found |
|
730
|
730
|
$chpi = \Stripe\Charge::retrieve($TRANSACTIONID); // old method, contains the charge id (ch_...) |
|
@@ -743,7 +743,7 @@ discard block |
|
|
block discarded – undo |
|
743
|
743
|
} |
|
744
|
744
|
} else { |
|
745
|
745
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_account (fk_soc, login, key_account, site, site_account, status, entity, date_creation, fk_user_creat)"; |
|
746
|
|
- $sql .= " VALUES (" . ((int)$object->fk_soc) . ", '', '" . $db->escape($stripecu) . "', 'stripe', '" . $db->escape($stripearrayofkeysbyenv[$servicestatus]['publishable_key']) . "', " . ((int)$servicestatus) . ", " . ((int)$conf->entity) . ", '" . $db->idate(dol_now()) . "', 0)"; |
|
|
746
|
+ $sql .= " VALUES (" . ((int) $object->fk_soc) . ", '', '" . $db->escape($stripecu) . "', 'stripe', '" . $db->escape($stripearrayofkeysbyenv[$servicestatus]['publishable_key']) . "', " . ((int) $servicestatus) . ", " . ((int) $conf->entity) . ", '" . $db->idate(dol_now()) . "', 0)"; |
|
747
|
747
|
$resql = $db->query($sql); |
|
748
|
748
|
if (!$resql) { // should not happen |
|
749
|
749
|
$error++; |
|
@@ -873,7 +873,7 @@ discard block |
|
|
block discarded – undo |
|
873
|
873
|
} elseif (array_key_exists('INV', $tmptag) && $tmptag['INV'] > 0) { |
|
874
|
874
|
// Record payment |
|
875
|
875
|
$object = new Facture($db); |
|
876
|
|
- $result = $object->fetch((int)$tmptag['INV']); |
|
|
876
|
+ $result = $object->fetch((int) $tmptag['INV']); |
|
877
|
877
|
if ($result) { |
|
878
|
878
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; |
|
879
|
879
|
|
|
@@ -924,7 +924,7 @@ discard block |
|
|
block discarded – undo |
|
924
|
924
|
$paiement->paiementid = $paymentTypeId; |
|
925
|
925
|
$paiement->num_payment = ''; |
|
926
|
926
|
$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress; |
|
927
|
|
- $paiement->ext_payment_id = $TRANSACTIONID; // TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue. |
|
|
927
|
+ $paiement->ext_payment_id = $TRANSACTIONID; // TODO LDR May be we should store py_... instead of pi_... but we started with pi_... so we continue. |
|
928
|
928
|
//$paiement->ext_payment_id = $TRANSACTIONID.':'.$customer->id.'@'.$stripearrayofkeysbyenv[$servicestatus]['publishable_key']; // TODO LDR It would be better if we could store this. Do we have customer->id and publishable_key ? |
|
929
|
929
|
$paiement->ext_payment_site = $service; |
|
930
|
930
|
|
|
@@ -997,7 +997,7 @@ discard block |
|
|
block discarded – undo |
|
997
|
997
|
} |
|
998
|
998
|
} elseif (array_key_exists('ORD', $tmptag) && $tmptag['ORD'] > 0) { |
|
999
|
999
|
$object = new Commande($db); |
|
1000
|
|
- $result = $object->fetch((int)$tmptag['ORD']); |
|
|
1000
|
+ $result = $object->fetch((int) $tmptag['ORD']); |
|
1001
|
1001
|
if ($result) { |
|
1002
|
1002
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; |
|
1003
|
1003
|
|
|
@@ -1050,8 +1050,8 @@ discard block |
|
|
block discarded – undo |
|
1050
|
1050
|
$paiement->paiementid = $paymentTypeId; |
|
1051
|
1051
|
$paiement->num_payment = ''; |
|
1052
|
1052
|
$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress; |
|
1053
|
|
- $paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ... |
|
1054
|
|
- $paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ... |
|
|
1053
|
+ $paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ... |
|
|
1054
|
+ $paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ... |
|
1055
|
1055
|
|
|
1056
|
1056
|
if (!$error) { |
|
1057
|
1057
|
$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents |
|
@@ -1130,7 +1130,7 @@ discard block |
|
|
block discarded – undo |
|
1130
|
1130
|
} |
|
1131
|
1131
|
} elseif (array_key_exists('DON', $tmptag) && $tmptag['DON'] > 0) { |
|
1132
|
1132
|
$don = new Don($db); |
|
1133
|
|
- $result = $don->fetch((int)$tmptag['DON']); |
|
|
1133
|
+ $result = $don->fetch((int) $tmptag['DON']); |
|
1134
|
1134
|
if ($result) { |
|
1135
|
1135
|
$paymentTypeId = 0; |
|
1136
|
1136
|
if ($paymentmethod == 'paybox') { |
|
@@ -1372,7 +1372,7 @@ discard block |
|
|
block discarded – undo |
|
1372
|
1372
|
|
|
1373
|
1373
|
if (!$error) { |
|
1374
|
1374
|
// Validating the attendee |
|
1375
|
|
- $resultattendee = $attendeetovalidate->fetch((int)$tmptag['ATT']); |
|
|
1375
|
+ $resultattendee = $attendeetovalidate->fetch((int) $tmptag['ATT']); |
|
1376
|
1376
|
if ($resultattendee < 0) { |
|
1377
|
1377
|
$error++; |
|
1378
|
1378
|
setEventMessages(null, $attendeetovalidate->errors, "errors"); |
|
@@ -1598,7 +1598,7 @@ discard block |
|
|
block discarded – undo |
|
1598
|
1598
|
if (!$error) { |
|
1599
|
1599
|
// Putting the booth to "suggested" state |
|
1600
|
1600
|
$booth = new ConferenceOrBooth($db); |
|
1601
|
|
- $resultbooth = $booth->fetch((int)$tmptag['BOO']); |
|
|
1601
|
+ $resultbooth = $booth->fetch((int) $tmptag['BOO']); |
|
1602
|
1602
|
if ($resultbooth < 0) { |
|
1603
|
1603
|
$error++; |
|
1604
|
1604
|
setEventMessages(null, $booth->errors, "errors"); |
|
@@ -1687,7 +1687,7 @@ discard block |
|
|
block discarded – undo |
|
1687
|
1687
|
} |
|
1688
|
1688
|
} elseif (array_key_exists('CON', $tmptag) && $tmptag['CON'] > 0) { |
|
1689
|
1689
|
$object = new Contrat($db); |
|
1690
|
|
- $result = $object->fetch((int)$tmptag['CON']); |
|
|
1690
|
+ $result = $object->fetch((int) $tmptag['CON']); |
|
1691
|
1691
|
if ($result) { |
|
1692
|
1692
|
$FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; |
|
1693
|
1693
|
|
|
@@ -1724,7 +1724,7 @@ discard block |
|
|
block discarded – undo |
|
1724
|
1724
|
if (isModEnabled('invoice')) { |
|
1725
|
1725
|
if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { |
|
1726
|
1726
|
$invoice = new Facture($db); |
|
1727
|
|
- $result = $invoice->createFromContract($object, $user, array((int)$contract_lines)); |
|
|
1727
|
+ $result = $invoice->createFromContract($object, $user, array((int) $contract_lines)); |
|
1728
|
1728
|
if ($result > 0) { |
|
1729
|
1729
|
// $object->classifyBilled($user); |
|
1730
|
1730
|
$invoice->validate($user); |
|
@@ -1743,8 +1743,8 @@ discard block |
|
|
block discarded – undo |
|
1743
|
1743
|
$paiement->paiementid = $paymentTypeId; |
|
1744
|
1744
|
$paiement->num_payment = ''; |
|
1745
|
1745
|
$paiement->note_public = 'Online payment ' . dol_print_date($now, 'standard') . ' from ' . $ipaddress; |
|
1746
|
|
- $paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ... |
|
1747
|
|
- $paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ... |
|
|
1746
|
+ $paiement->ext_payment_id = $TRANSACTIONID; // pi_... for Stripe, ... |
|
|
1747
|
+ $paiement->ext_payment_site = $service; // 'StripeLive' or 'Stripe', or ... |
|
1748
|
1748
|
|
|
1749
|
1749
|
if (!$error) { |
|
1750
|
1750
|
$paiement_id = $paiement->create($user, 1); // This include closing invoices and regenerating documents |
|
@@ -1841,7 +1841,7 @@ discard block |
|
|
block discarded – undo |
|
1841
|
1841
|
// Set by newpayment.php |
|
1842
|
1842
|
$currencyCodeType = empty($_SESSION['currencyCodeType']) ? '' : $_SESSION['currencyCodeType']; |
|
1843
|
1843
|
$FinalPaymentAmt = empty($_SESSION["FinalPaymentAmt"]) ? '' : $_SESSION["FinalPaymentAmt"]; |
|
1844
|
|
- $paymentType = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType']; // Seems used by paypal only |
|
|
1844
|
+ $paymentType = empty($_SESSION['PaymentType']) ? '' : $_SESSION['PaymentType']; // Seems used by paypal only |
|
1845
|
1845
|
|
|
1846
|
1846
|
if (is_object($object) && method_exists($object, 'call_trigger')) { |
|
1847
|
1847
|
// Call trigger |
|
@@ -1917,12 +1917,12 @@ discard block |
|
|
block discarded – undo |
|
1917
|
1917
|
$topic = '[' . $appli . '] ' . $companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived"); |
|
1918
|
1918
|
$content = ""; |
|
1919
|
1919
|
if (array_key_exists('MEM', $tmptag)) { |
|
1920
|
|
- $url = $urlwithroot . "/adherents/subscription.php?rowid=" . ((int)$tmptag['MEM']); |
|
|
1920
|
+ $url = $urlwithroot . "/adherents/subscription.php?rowid=" . ((int) $tmptag['MEM']); |
|
1921
|
1921
|
$content .= '<strong>' . $companylangs->trans("PaymentSubscription") . "</strong><br><br>\n"; |
|
1922
|
1922
|
$content .= $companylangs->trans("MemberId") . ': <strong>' . $tmptag['MEM'] . "</strong><br>\n"; |
|
1923
|
1923
|
$content .= $companylangs->trans("Link") . ': <a href="' . $url . '">' . $url . '</a>' . "<br>\n"; |
|
1924
|
1924
|
} elseif (array_key_exists('INV', $tmptag)) { |
|
1925
|
|
- $url = $urlwithroot . "/compta/facture/card.php?id=" . ((int)$tmptag['INV']); |
|
|
1925
|
+ $url = $urlwithroot . "/compta/facture/card.php?id=" . ((int) $tmptag['INV']); |
|
1926
|
1926
|
$content .= '<strong>' . $companylangs->trans("Payment") . "</strong><br><br>\n"; |
|
1927
|
1927
|
$content .= $companylangs->trans("InvoiceId") . ': <strong>' . $tmptag['INV'] . "</strong><br>\n"; |
|
1928
|
1928
|
//$content.=$companylangs->trans("ThirdPartyId").': '.$tmptag['CUS']."<br>\n"; |