From 6aa0eb362d68e439f0f5b8b6d99e1db183693a32 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 16 Feb 2023 21:03:06 +0100 Subject: [PATCH] donations.php cleanup --- donations/donations.php | 17 +++++++++-------- index.html | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/donations/donations.php b/donations/donations.php index ec638c4..479b0d6 100644 --- a/donations/donations.php +++ b/donations/donations.php @@ -5,17 +5,18 @@ $conn = getDatabaseConnection(); $sql = "SELECT `value` FROM `dolibarrInformation` WHERE `information` = 'apiKey'"; $result = $conn->query($sql); $dolibarrAPIKey = $result->fetch_assoc()["value"]; -//$dolibarrAPIKey = "eM6A2bQP36Q7dhELq02qnD7sY4do5KRa"; $conn = getDatabaseConnection(); $sql = "SELECT `value` FROM `dolibarrInformation` WHERE `information` = 'url'"; $result = $conn->query($sql); $dolibarrURL = $result->fetch_assoc()["value"]; -//$dolibarrURL = "https://dolibarr.romanschenk.ch/"; +$conn = getDatabaseConnection(); +$sql = "SELECT `value` FROM `dolibarrInformation` WHERE `information` = 'socid'"; +$result = $conn->query($sql); +$BusinesspartnerID = $result->fetch_assoc()["value"]; -function createDonation($amount, $dolibarrURL, $dolibarrAPIKey) { - $BusinesspartnerID = "220"; +function createDonation($amount, $dolibarrURL, $dolibarrAPIKey, $BusinesspartnerID) { $pulicNote = "Automatisch generiert von genderwatchprotocol"; $ch = curl_init(); @@ -59,8 +60,8 @@ function validateDonation($donationID, $dolibarrURL, $dolibarrAPIKey) { curl_close($ch); return $result; } -function forwardToDonationPage($amount, $dolibarrURL, $dolibarrAPIKey){ - $donationID = createDonation($amount, $dolibarrURL, $dolibarrAPIKey); +function forwardToDonationPage($amount, $dolibarrURL, $dolibarrAPIKey, $BusinesspartnerID){ + $donationID = createDonation($amount, $dolibarrURL, $dolibarrAPIKey, $BusinesspartnerID); validateDonation($donationID, $dolibarrURL, $dolibarrAPIKey); $payment_link = $dolibarrURL."public/payment/newpayment.php?source=donation&ref=".($donationID)."&securekey=NSmKzZ73HW1zWO8nAlpdq95mDt77Q32o"; header('Location: '.$payment_link); @@ -68,11 +69,11 @@ function forwardToDonationPage($amount, $dolibarrURL, $dolibarrAPIKey){ $amount = (float)($_GET["amount"]); if(is_numeric($amount) && $amount > 0) { - forwardToDonationPage($amount, $dolibarrURL, $dolibarrAPIKey); + forwardToDonationPage($amount, $dolibarrURL, $dolibarrAPIKey, $BusinesspartnerID); } else { $amount = (float)($_POST["amount"]); if(is_numeric($amount) && $amount > 0) { - forwardToDonationPage($amount, $dolibarrURL, $dolibarrAPIKey); + forwardToDonationPage($amount, $dolibarrURL, $dolibarrAPIKey, $BusinesspartnerID); } else { echo "invalid amount!"; } diff --git a/index.html b/index.html index ff7ef38..b7e2ad2 100644 --- a/index.html +++ b/index.html @@ -172,7 +172,7 @@ Diese Webseite wird ausschliesslich durch Spenden finanziert.
Helfen Sie bei der Fianzierung mit einer freiwilligen Spende.

- +