From f6c1ff2a6be6545c6c179722235db3cd724127fd Mon Sep 17 00:00:00 2001 From: Miguel Ribeiro Date: Wed, 13 Mar 2024 23:47:51 +0100 Subject: [PATCH] fix: wrong folder for payment method logos (#227) --- README.md | 4 +--- endpoints/payments/add.php | 14 ++++++++++++-- includes/version.php | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 021d7bfaf..4fc34cc57 100644 --- a/README.md +++ b/README.md @@ -136,9 +136,7 @@ If you want to trigger an Update of the exchange rates, change your main currenc ![Screenshot](screenshots/wallos-form.png) -![Screenshot](screenshots/wallos-dashboard-mobile-light.png) - -![Screenshot](screenshots/wallos-dashboard-mobile-dark.png) +![Screenshot](screenshots/wallos-dashboard-mobile-light.png) ![Screenshot](screenshots/wallos-dashboard-mobile-dark.png) ## Contributing diff --git a/endpoints/payments/add.php b/endpoints/payments/add.php index 440451cef..fcf16a24d 100644 --- a/endpoints/payments/add.php +++ b/endpoints/payments/add.php @@ -183,14 +183,24 @@ function resizeAndUploadLogo($uploadedFile, $uploadDir, $name) { } } - $sql = "INSERT INTO payment_methods (name, icon, enabled) VALUES (:name, :icon, :enabled)"; + // Get the maximum existing ID + $stmt = $db->prepare("SELECT MAX(id) as maxID FROM payment_methods"); + $result = $stmt->execute(); + $row = $result->fetchArray(SQLITE3_ASSOC); + $maxID = $row['maxID']; + // Ensure the new ID is greater than 31 + $newID = max($maxID + 1, 32); + + // Insert the new record with the new ID + $sql = "INSERT INTO payment_methods (id, name, icon, enabled) VALUES (:id, :name, :icon, :enabled)"; $stmt = $db->prepare($sql); + $stmt->bindParam(':id', $newID, SQLITE3_INTEGER); $stmt->bindParam(':name', $name, SQLITE3_TEXT); $stmt->bindParam(':icon', $icon, SQLITE3_TEXT); $stmt->bindParam(':enabled', $enabled, SQLITE3_INTEGER); - + if ($stmt->execute()) { $success['success'] = true; $success['message'] = translate('payment_method_added_successfuly', $i18n); diff --git a/includes/version.php b/includes/version.php index dc82bdb81..4b78b7bc4 100644 --- a/includes/version.php +++ b/includes/version.php @@ -1,3 +1,3 @@ \ No newline at end of file