From 81fd5ea56e59602dd8fc4fc0954432e7246b84d6 Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Wed, 2 Oct 2024 11:26:50 +0200 Subject: [PATCH 1/6] Add custom field values from mapping to membership --- api/v3/TwingleDonation/Submit.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/v3/TwingleDonation/Submit.php b/api/v3/TwingleDonation/Submit.php index 013dc73..41e2743 100644 --- a/api/v3/TwingleDonation/Submit.php +++ b/api/v3/TwingleDonation/Submit.php @@ -900,6 +900,11 @@ function civicrm_api3_twingle_donation_Submit($params) { $membership_data['source'] = $membership_source; } + // Add custom fields from mapping. + if (isset($custom_fields['Membership'])) { + $membership_data += $custom_fields['Membership']; + } + $membership = civicrm_api3('Membership', 'create', $membership_data); $result_values['membership'] = $membership; From c7c766d926bc3475b0e119a6ff9b9a283d2bc8a8 Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Wed, 9 Oct 2024 12:39:57 +0200 Subject: [PATCH 2/6] Fix BAO class namespace issues --- CRM/Twingle/BAO/TwingleShop.php | 2 +- CRM/Twingle/Submission.php | 3 +-- api/v3/TwingleProduct/Create.php | 3 +-- api/v3/TwingleProduct/Delete.php | 3 +-- api/v3/TwingleProduct/Get.php | 5 ++--- api/v3/TwingleShop/Create.php | 3 +-- api/v3/TwingleShop/Delete.php | 6 +++--- api/v3/TwingleShop/Fetch.php | 5 ++--- api/v3/TwingleShop/Get.php | 4 ++-- twingle.php | 4 ++-- 10 files changed, 16 insertions(+), 22 deletions(-) diff --git a/CRM/Twingle/BAO/TwingleShop.php b/CRM/Twingle/BAO/TwingleShop.php index a4b006c..27ae3b8 100644 --- a/CRM/Twingle/BAO/TwingleShop.php +++ b/CRM/Twingle/BAO/TwingleShop.php @@ -294,7 +294,7 @@ class CRM_Twingle_BAO_TwingleShop extends CRM_Twingle_DAO_TwingleShop { /** * Get associated products. * - * @return array[Civi\Twingle\Shop\BAO\TwingleProduct] + * @return list * @throws \Civi\Core\Exception\DBQueryException * @throws \Civi\Twingle\Shop\Exceptions\ProductException */ diff --git a/CRM/Twingle/Submission.php b/CRM/Twingle/Submission.php index 2c3e85d..1955d18 100644 --- a/CRM/Twingle/Submission.php +++ b/CRM/Twingle/Submission.php @@ -18,7 +18,6 @@ declare(strict_types = 1); use CRM_Twingle_ExtensionUtil as E; use Civi\Twingle\Exceptions\BaseException; use Civi\Twingle\Shop\Exceptions\LineItemException; -use Civi\Twingle\Shop\BAO\TwingleProduct; class CRM_Twingle_Submission { @@ -503,7 +502,7 @@ class CRM_Twingle_Submission { // Try to find the TwingleProduct with its corresponding PriceField // for this product try { - $price_field = TwingleProduct::findByExternalId($product['id']); + $price_field = CRM_Twingle_BAO_TwingleProduct::findByExternalId($product['id']); } catch (Exception $e) { Civi::log()->error(E::LONG_NAME . diff --git a/api/v3/TwingleProduct/Create.php b/api/v3/TwingleProduct/Create.php index 36bb48a..2490557 100644 --- a/api/v3/TwingleProduct/Create.php +++ b/api/v3/TwingleProduct/Create.php @@ -2,7 +2,6 @@ use Civi\Twingle\Shop\Exceptions\ProductException; use CRM_Twingle_ExtensionUtil as E; -use Civi\Twingle\Shop\BAO\TwingleProduct; /** * TwingleProduct.Create API specification (optional) @@ -121,7 +120,7 @@ function civicrm_api3_twingle_product_Create($params): array { try { // Create TwingleProduct and load params - $product = new TwingleProduct(); + $product = new CRM_Twingle_BAO_TwingleProduct(); $product->load($params); // Save TwingleProduct diff --git a/api/v3/TwingleProduct/Delete.php b/api/v3/TwingleProduct/Delete.php index 60c9591..7c675ab 100644 --- a/api/v3/TwingleProduct/Delete.php +++ b/api/v3/TwingleProduct/Delete.php @@ -1,7 +1,6 @@ delete(); diff --git a/api/v3/TwingleProduct/Get.php b/api/v3/TwingleProduct/Get.php index a7f64ca..9544678 100644 --- a/api/v3/TwingleProduct/Get.php +++ b/api/v3/TwingleProduct/Get.php @@ -1,7 +1,6 @@ getMessage(), [ diff --git a/api/v3/TwingleShop/Create.php b/api/v3/TwingleShop/Create.php index ebb34f4..ab858ff 100644 --- a/api/v3/TwingleShop/Create.php +++ b/api/v3/TwingleShop/Create.php @@ -1,6 +1,5 @@ load($params); // Save TwingleShop diff --git a/api/v3/TwingleShop/Delete.php b/api/v3/TwingleShop/Delete.php index d1f3323..cc851a7 100644 --- a/api/v3/TwingleShop/Delete.php +++ b/api/v3/TwingleShop/Delete.php @@ -1,6 +1,6 @@ deleteByConstraint(); if ($result) { return civicrm_api3_create_success(1, $params, 'TwingleShop', 'Delete'); diff --git a/api/v3/TwingleShop/Fetch.php b/api/v3/TwingleShop/Fetch.php index 961f42b..9c5d3e3 100644 --- a/api/v3/TwingleShop/Fetch.php +++ b/api/v3/TwingleShop/Fetch.php @@ -1,7 +1,6 @@ fetchProducts(); $returnValues[$projectId] = []; $returnValues[$projectId] += $shop->getAttributes(); @@ -63,7 +62,7 @@ function civicrm_api3_twingle_shop_Fetch($params) { return $product->getAttributes(); }, $products); } - catch (ShopException|ApiCallError|ProductException $e) { + catch (ShopException | ApiCallError | ProductException $e) { // If this project identifier doesn't belong to a project of type // 'shop', just skip it if ($e->getErrorCode() == ShopException::ERROR_CODE_NOT_A_SHOP) { diff --git a/api/v3/TwingleShop/Get.php b/api/v3/TwingleShop/Get.php index 2915212..9309e04 100644 --- a/api/v3/TwingleShop/Get.php +++ b/api/v3/TwingleShop/Get.php @@ -1,6 +1,6 @@ getMessage(), [ diff --git a/twingle.php b/twingle.php index c00ac35..9c20db1 100644 --- a/twingle.php +++ b/twingle.php @@ -17,7 +17,7 @@ function twingle_civicrm_pre($op, $objectName, $id, &$params) { // Create/delete PriceField and PriceFieldValue for TwingleProduct elseif ($objectName == 'TwingleProduct') { - $twingle_product = new \Civi\Twingle\Shop\BAO\TwingleProduct(); + $twingle_product = new CRM_Twingle_BAO_TwingleProduct(); $twingle_product->load($params); if ($op == 'create' || $op == 'edit') { $twingle_product->createPriceField(); @@ -30,7 +30,7 @@ function twingle_civicrm_pre($op, $objectName, $id, &$params) { // Create PriceSet for TwingleShop elseif ($objectName == 'TwingleShop' && ($op == 'create' || $op == 'edit')) { - $twingle_shop = new \Civi\Twingle\Shop\BAO\TwingleShop(); + $twingle_shop = new CRM_Twingle_BAO_TwingleShop(); $twingle_shop->load($params); $twingle_shop->createPriceSet(); $params = $twingle_shop->getAttributes(); From 2ee06faf34bb7ccdd40e066770d175ac0f7cbba5 Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Thu, 23 Jan 2025 15:17:54 +0100 Subject: [PATCH 3/6] Version 1.5-beta4 --- info.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/info.xml b/info.xml index c019d80..56b4ef3 100644 --- a/info.xml +++ b/info.xml @@ -14,9 +14,9 @@ https://github.com/systopia/de.systopia.twingle/issues http://www.gnu.org/licenses/agpl-3.0.html - - 1.5-dev - dev + 2025-01-23 + 1.5-beta4 + beta 5.58 From c8a577b6517807a7b273e2691454fa9f597dd366 Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Thu, 23 Jan 2025 15:18:14 +0100 Subject: [PATCH 4/6] Back to dev (1.5-dev) --- info.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/info.xml b/info.xml index 56b4ef3..c019d80 100644 --- a/info.xml +++ b/info.xml @@ -14,9 +14,9 @@ https://github.com/systopia/de.systopia.twingle/issues http://www.gnu.org/licenses/agpl-3.0.html - 2025-01-23 - 1.5-beta4 - beta + + 1.5-dev + dev 5.58 From 21f29ce169ffe00eebab2daf36dc68b9533fc1c7 Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Fri, 21 Feb 2025 13:13:44 +0100 Subject: [PATCH 5/6] Version 1.5.0 --- info.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/info.xml b/info.xml index c019d80..1e7baa0 100644 --- a/info.xml +++ b/info.xml @@ -14,9 +14,9 @@ https://github.com/systopia/de.systopia.twingle/issues http://www.gnu.org/licenses/agpl-3.0.html - - 1.5-dev - dev + 2025-02-21 + 1.5.0 + stable 5.58 From b8f44d962de634a777bf85fe25300101c66788cd Mon Sep 17 00:00:00 2001 From: Jens Schuppe Date: Fri, 21 Feb 2025 13:14:04 +0100 Subject: [PATCH 6/6] Back to dev (1.6-dev) --- info.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/info.xml b/info.xml index 1e7baa0..edfa3fb 100644 --- a/info.xml +++ b/info.xml @@ -14,9 +14,9 @@ https://github.com/systopia/de.systopia.twingle/issues http://www.gnu.org/licenses/agpl-3.0.html - 2025-02-21 - 1.5.0 - stable + + 1.6-dev + dev 5.58