Mwalker has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/60340


Change subject: ThankYou Date is Optional
......................................................................

ThankYou Date is Optional

If thankyou_date is already set in a contribution ThankYou_send will not
send an email. In some cases we do not want to send an email, e.g. we got
a check; so we have to set this to something. This allows both cases.

Change-Id: I5158f4e5421b1119ceaa4f8a2198da11ef1ea7b4
---
M .gitignore
M sites/all/modules/offline2civicrm/offline2civicrm.install
2 files changed, 38 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/40/60340/1

diff --git a/.gitignore b/.gitignore
index f1bc2fb..4302da2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 sites/default/civicrm.settings.php
 sites/default/settings.php
 sites/default/files
+.idea
diff --git a/sites/all/modules/offline2civicrm/offline2civicrm.install 
b/sites/all/modules/offline2civicrm/offline2civicrm.install
index 0b78c5e..99b814e 100644
--- a/sites/all/modules/offline2civicrm/offline2civicrm.install
+++ b/sites/all/modules/offline2civicrm/offline2civicrm.install
@@ -14,15 +14,47 @@
 function offline2civicrm_update_7000() {
     $api = wmf_civicrm_bootstrap_civi();
 
-    $success = $api->CustomGroup->get(array(
+    /* === Create the Gift Information group if it doesn't exist === */
+    $api->CustomGroup->get(array(
         'name' => 'Gift_Information',
     ));
-    $values = $api->values();
-    $custom_group = array_pop($values);
-    if (!$success || !$custom_group->id) {
-        throw new Exception("Missing custom group 'Gift Information', " . 
$api->errorMsg());
+    $result = $api->values();
+    if (empty($result)) {
+        $success = $api->CustomGroup->create(array(
+            'extends' => 'Contribution',
+            'name' => 'Gift_Information',
+            'title' => ts('Gift Information'),
+            'is_active' => 1,
+            'is_view' => 1,
+        ));
+        if (!$success) {
+            throw new Exception("Could not create Gift Information group: " . 
$api->errorMsg());
+        }
+        $values = $api->values();
+        $custom_group = array_pop($values);
+    } else {
+               // If the thing already exists, just go ahead and get it for 
the field creation below
+        $success = $api->CustomGroup->get(array(
+            'name' => 'Gift_Information',
+        ));
+        $values = $api->values();
+        $custom_group = array_pop($values);
+        if (!$success || !$custom_group->id) {
+            throw new Exception("Missing custom group 'Gift Information', " . 
$api->errorMsg());
+        }
     }
 
+    /* === Create all the custom fields === */
+    /* --- Check Number --- */
+    $api->CustomField->get(array(
+        'custom_group_id' => $custom_group->id,
+        'name' => 'import_batch_number',
+    ));
+
+    /* --- Batch Number --- */
+    $api->CustomField->get( 
+
+
     $success = $api->CustomField->create(array(
         'custom_group_id' => $custom_group->id,
         'name' => 'import_batch_number',

-- 
To view, visit https://gerrit.wikimedia.org/r/60340
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5158f4e5421b1119ceaa4f8a2198da11ef1ea7b4
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Mwalker <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to