From 685bf3d218a9dad7e90d24aec165c63df12c1f67 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 3 Jul 2020 20:00:04 +1200 Subject: [PATCH] Move BAO and template files into event cart Fix templates Path --- .../Incremental/php/FiveTwentyNine.php | 54 +++++++++++++------ distmaker/dists/common.sh | 1 + .../eventcart/CRM}/Event/Cart/BAO/Cart.php | 0 .../CRM}/Event/Cart/BAO/Conference.php | 0 .../CRM}/Event/Cart/BAO/EventInCart.php | 0 .../CRM}/Event/Cart/BAO/MerParticipant.php | 0 .../CRM}/Event/Cart/Controller/Checkout.php | 0 .../eventcart/CRM}/Event/Cart/Form/Cart.php | 0 .../Cart/Form/Checkout/ConferenceEvents.php | 0 .../Form/Checkout/ParticipantsAndPrices.php | 0 .../CRM}/Event/Cart/Form/Checkout/Payment.php | 0 .../Event/Cart/Form/Checkout/ThankYou.php | 0 .../CRM}/Event/Cart/Form/MerParticipant.php | 0 .../CRM}/Event/Cart/Page/AddToCart.php | 0 .../CRM}/Event/Cart/Page/CheckoutAJAX.php | 0 .../CRM}/Event/Cart/Page/RemoveFromCart.php | 0 .../CRM}/Event/Cart/Page/ViewCart.php | 0 .../CRM}/Event/Cart/StateMachine/Checkout.php | 0 ext/eventcart/info.xml | 20 +++---- .../Cart/Form/Checkout/ConferenceEvents.tpl | 0 .../Event/Cart/Form/Checkout/Participant.tpl | 0 .../Form/Checkout/ParticipantsAndPrices.tpl | 0 .../CRM/Event/Cart/Form/Checkout/Payment.tpl | 0 .../CRM/Event/Cart/Form/Checkout/ThankYou.tpl | 0 .../CRM/Event/Cart/Form/viewCartLink.tpl | 0 .../CRM/Event/Cart/Page/AddToCart.tpl | 0 .../CRM/Event/Cart/Page/ViewCart.tpl | 0 sql/civicrm_generated.mysql | 1 + xml/templates/civicrm_data.tpl | 1 + 29 files changed, 52 insertions(+), 25 deletions(-) rename {CRM => ext/eventcart/CRM}/Event/Cart/BAO/Cart.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/BAO/Conference.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/BAO/EventInCart.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/BAO/MerParticipant.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Controller/Checkout.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Form/Cart.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Form/Checkout/ConferenceEvents.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Form/Checkout/ParticipantsAndPrices.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Form/Checkout/Payment.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Form/Checkout/ThankYou.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Form/MerParticipant.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Page/AddToCart.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Page/CheckoutAJAX.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Page/RemoveFromCart.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/Page/ViewCart.php (100%) rename {CRM => ext/eventcart/CRM}/Event/Cart/StateMachine/Checkout.php (100%) rename {templates => ext/eventcart/templates}/CRM/Event/Cart/Form/Checkout/ConferenceEvents.tpl (100%) rename {templates => ext/eventcart/templates}/CRM/Event/Cart/Form/Checkout/Participant.tpl (100%) rename {templates => ext/eventcart/templates}/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl (100%) rename {templates => ext/eventcart/templates}/CRM/Event/Cart/Form/Checkout/Payment.tpl (100%) rename {templates => ext/eventcart/templates}/CRM/Event/Cart/Form/Checkout/ThankYou.tpl (100%) rename {templates => ext/eventcart/templates}/CRM/Event/Cart/Form/viewCartLink.tpl (100%) rename {templates => ext/eventcart/templates}/CRM/Event/Cart/Page/AddToCart.tpl (100%) rename {templates => ext/eventcart/templates}/CRM/Event/Cart/Page/ViewCart.tpl (100%) diff --git a/CRM/Upgrade/Incremental/php/FiveTwentyNine.php b/CRM/Upgrade/Incremental/php/FiveTwentyNine.php index c36320f5a8..37a4600e20 100644 --- a/CRM/Upgrade/Incremental/php/FiveTwentyNine.php +++ b/CRM/Upgrade/Incremental/php/FiveTwentyNine.php @@ -52,21 +52,45 @@ class CRM_Upgrade_Incremental_php_FiveTwentyNine extends CRM_Upgrade_Incremental * (change the x in the function name): */ - // /** - // * Upgrade function. - // * - // * @param string $rev - // */ - // public function upgrade_5_0_x($rev) { - // $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); - // $this->addTask('Do the foo change', 'taskFoo', ...); - // // Additional tasks here... - // // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex. - // // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable. - // } + /** + * Upgrade function. + * + * @param string $rev + */ + public function upgrade_5_29_alpha1($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); + $this->addTask('Install eventcart extension', 'installEventCart'); + } - // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) { - // return TRUE; - // } + /** + * Install sequentialCreditNotes extension. + * + * This feature is restructured as a core extension - which is primarily a code cleanup step. + * + * @param \CRM_Queue_TaskContext $ctx + * + * @return bool + * + * @throws \CiviCRM_API3_Exception + * @throws \CRM_Core_Exception + */ + public static function installEventCart(CRM_Queue_TaskContext $ctx) { + // Install via direct SQL manipulation. Note that: + // (1) This extension has no activation logic. + // (2) On new installs, the extension is activated purely via default SQL INSERT. + // (3) Caches are flushed at the end of the upgrade. + // ($) Over long term, upgrade steps are more reliable in SQL. API/BAO sometimes don't work mid-upgrade. + $insert = CRM_Utils_SQL_Insert::into('civicrm_extension')->row([ + 'type' => 'module', + 'full_name' => 'eventcart', + 'name' => 'eventcart', + 'label' => 'Event Cart', + 'file' => 'eventcart', + 'schema_version' => NULL, + 'is_active' => 1, + ]); + CRM_Core_DAO::executeQuery($insert->usingReplace()->toSQL()); + return TRUE; + } } diff --git a/distmaker/dists/common.sh b/distmaker/dists/common.sh index 2194aaaf7d..c31042066f 100644 --- a/distmaker/dists/common.sh +++ b/distmaker/dists/common.sh @@ -108,6 +108,7 @@ function dm_install_coreext() { function dm_core_exts() { echo ext/sequentialcreditnotes echo ext/flexmailer + echo ext/eventcart } ## Copy all packages diff --git a/CRM/Event/Cart/BAO/Cart.php b/ext/eventcart/CRM/Event/Cart/BAO/Cart.php similarity index 100% rename from CRM/Event/Cart/BAO/Cart.php rename to ext/eventcart/CRM/Event/Cart/BAO/Cart.php diff --git a/CRM/Event/Cart/BAO/Conference.php b/ext/eventcart/CRM/Event/Cart/BAO/Conference.php similarity index 100% rename from CRM/Event/Cart/BAO/Conference.php rename to ext/eventcart/CRM/Event/Cart/BAO/Conference.php diff --git a/CRM/Event/Cart/BAO/EventInCart.php b/ext/eventcart/CRM/Event/Cart/BAO/EventInCart.php similarity index 100% rename from CRM/Event/Cart/BAO/EventInCart.php rename to ext/eventcart/CRM/Event/Cart/BAO/EventInCart.php diff --git a/CRM/Event/Cart/BAO/MerParticipant.php b/ext/eventcart/CRM/Event/Cart/BAO/MerParticipant.php similarity index 100% rename from CRM/Event/Cart/BAO/MerParticipant.php rename to ext/eventcart/CRM/Event/Cart/BAO/MerParticipant.php diff --git a/CRM/Event/Cart/Controller/Checkout.php b/ext/eventcart/CRM/Event/Cart/Controller/Checkout.php similarity index 100% rename from CRM/Event/Cart/Controller/Checkout.php rename to ext/eventcart/CRM/Event/Cart/Controller/Checkout.php diff --git a/CRM/Event/Cart/Form/Cart.php b/ext/eventcart/CRM/Event/Cart/Form/Cart.php similarity index 100% rename from CRM/Event/Cart/Form/Cart.php rename to ext/eventcart/CRM/Event/Cart/Form/Cart.php diff --git a/CRM/Event/Cart/Form/Checkout/ConferenceEvents.php b/ext/eventcart/CRM/Event/Cart/Form/Checkout/ConferenceEvents.php similarity index 100% rename from CRM/Event/Cart/Form/Checkout/ConferenceEvents.php rename to ext/eventcart/CRM/Event/Cart/Form/Checkout/ConferenceEvents.php diff --git a/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php b/ext/eventcart/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php similarity index 100% rename from CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php rename to ext/eventcart/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.php diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php similarity index 100% rename from CRM/Event/Cart/Form/Checkout/Payment.php rename to ext/eventcart/CRM/Event/Cart/Form/Checkout/Payment.php diff --git a/CRM/Event/Cart/Form/Checkout/ThankYou.php b/ext/eventcart/CRM/Event/Cart/Form/Checkout/ThankYou.php similarity index 100% rename from CRM/Event/Cart/Form/Checkout/ThankYou.php rename to ext/eventcart/CRM/Event/Cart/Form/Checkout/ThankYou.php diff --git a/CRM/Event/Cart/Form/MerParticipant.php b/ext/eventcart/CRM/Event/Cart/Form/MerParticipant.php similarity index 100% rename from CRM/Event/Cart/Form/MerParticipant.php rename to ext/eventcart/CRM/Event/Cart/Form/MerParticipant.php diff --git a/CRM/Event/Cart/Page/AddToCart.php b/ext/eventcart/CRM/Event/Cart/Page/AddToCart.php similarity index 100% rename from CRM/Event/Cart/Page/AddToCart.php rename to ext/eventcart/CRM/Event/Cart/Page/AddToCart.php diff --git a/CRM/Event/Cart/Page/CheckoutAJAX.php b/ext/eventcart/CRM/Event/Cart/Page/CheckoutAJAX.php similarity index 100% rename from CRM/Event/Cart/Page/CheckoutAJAX.php rename to ext/eventcart/CRM/Event/Cart/Page/CheckoutAJAX.php diff --git a/CRM/Event/Cart/Page/RemoveFromCart.php b/ext/eventcart/CRM/Event/Cart/Page/RemoveFromCart.php similarity index 100% rename from CRM/Event/Cart/Page/RemoveFromCart.php rename to ext/eventcart/CRM/Event/Cart/Page/RemoveFromCart.php diff --git a/CRM/Event/Cart/Page/ViewCart.php b/ext/eventcart/CRM/Event/Cart/Page/ViewCart.php similarity index 100% rename from CRM/Event/Cart/Page/ViewCart.php rename to ext/eventcart/CRM/Event/Cart/Page/ViewCart.php diff --git a/CRM/Event/Cart/StateMachine/Checkout.php b/ext/eventcart/CRM/Event/Cart/StateMachine/Checkout.php similarity index 100% rename from CRM/Event/Cart/StateMachine/Checkout.php rename to ext/eventcart/CRM/Event/Cart/StateMachine/Checkout.php diff --git a/ext/eventcart/info.xml b/ext/eventcart/info.xml index 12d480259a..6c1bf45ba5 100644 --- a/ext/eventcart/info.xml +++ b/ext/eventcart/info.xml @@ -1,30 +1,30 @@ eventcart - FIXME - FIXME + Event Cart + This feature allows users to register for more than one event at a time. When enabled, users will add event(s) to a "cart" and then pay for them all at once. Enabling this setting will affect online registration for all active events. AGPL-3.0 CiviCRM info@civicrm.org - http://FIXME - http://FIXME - http://FIXME + https://github.com/civicrm/civicrm-core/tree/master/ext/eventcart http://www.gnu.org/licenses/agpl-3.0.html - 2020-07-03 + 2020-08-03 1.0 - alpha + + mgmt:hidden + + stable - 5.0 + 5.29 - This is a new, undeveloped module - CRM/Eventcart + CRM/Event/Cart diff --git a/templates/CRM/Event/Cart/Form/Checkout/ConferenceEvents.tpl b/ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/ConferenceEvents.tpl similarity index 100% rename from templates/CRM/Event/Cart/Form/Checkout/ConferenceEvents.tpl rename to ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/ConferenceEvents.tpl diff --git a/templates/CRM/Event/Cart/Form/Checkout/Participant.tpl b/ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/Participant.tpl similarity index 100% rename from templates/CRM/Event/Cart/Form/Checkout/Participant.tpl rename to ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/Participant.tpl diff --git a/templates/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl b/ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl similarity index 100% rename from templates/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl rename to ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl diff --git a/templates/CRM/Event/Cart/Form/Checkout/Payment.tpl b/ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/Payment.tpl similarity index 100% rename from templates/CRM/Event/Cart/Form/Checkout/Payment.tpl rename to ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/Payment.tpl diff --git a/templates/CRM/Event/Cart/Form/Checkout/ThankYou.tpl b/ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/ThankYou.tpl similarity index 100% rename from templates/CRM/Event/Cart/Form/Checkout/ThankYou.tpl rename to ext/eventcart/templates/CRM/Event/Cart/Form/Checkout/ThankYou.tpl diff --git a/templates/CRM/Event/Cart/Form/viewCartLink.tpl b/ext/eventcart/templates/CRM/Event/Cart/Form/viewCartLink.tpl similarity index 100% rename from templates/CRM/Event/Cart/Form/viewCartLink.tpl rename to ext/eventcart/templates/CRM/Event/Cart/Form/viewCartLink.tpl diff --git a/templates/CRM/Event/Cart/Page/AddToCart.tpl b/ext/eventcart/templates/CRM/Event/Cart/Page/AddToCart.tpl similarity index 100% rename from templates/CRM/Event/Cart/Page/AddToCart.tpl rename to ext/eventcart/templates/CRM/Event/Cart/Page/AddToCart.tpl diff --git a/templates/CRM/Event/Cart/Page/ViewCart.tpl b/ext/eventcart/templates/CRM/Event/Cart/Page/ViewCart.tpl similarity index 100% rename from templates/CRM/Event/Cart/Page/ViewCart.tpl rename to ext/eventcart/templates/CRM/Event/Cart/Page/ViewCart.tpl diff --git a/sql/civicrm_generated.mysql b/sql/civicrm_generated.mysql index fab07d6559..ee0280aaa4 100644 --- a/sql/civicrm_generated.mysql +++ b/sql/civicrm_generated.mysql @@ -496,6 +496,7 @@ UNLOCK TABLES; LOCK TABLES `civicrm_extension` WRITE; /*!40000 ALTER TABLE `civicrm_extension` DISABLE KEYS */; INSERT INTO `civicrm_extension` (`id`, `type`, `full_name`, `name`, `label`, `file`, `schema_version`, `is_active`) VALUES (1,'module','sequentialcreditnotes','Sequential credit notes','Sequential credit notes','sequentialcreditnotes',NULL,1); +INSERT IGNORE INTO civicrm_extension (type, full_name, name, label, file, is_active) VALUES ('module', 'eventcart', 'Event cart', 'Event cart', 'eventcart', 1); /*!40000 ALTER TABLE `civicrm_extension` ENABLE KEYS */; UNLOCK TABLES; diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index c32355c12e..54d4b01f6c 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -1780,3 +1780,4 @@ VALUES -- in the setup routine based on their tags & using the standard extension install api. -- do not try this at home folks. INSERT IGNORE INTO civicrm_extension (type, full_name, name, label, file, is_active) VALUES ('module', 'sequentialcreditnotes', 'Sequential credit notes', 'Sequential credit notes', 'sequentialcreditnotes', 1); +INSERT IGNORE INTO civicrm_extension (type, full_name, name, label, file, is_active) VALUES ('module', 'eventcart', 'Event cart', 'Event cart', 'eventcart', 1); -- 2.25.1