Merge pull request #6394 from colemanw/CRM-14599
authorcolemanw <coleman@civicrm.org>
Sat, 8 Aug 2015 14:18:36 +0000 (10:18 -0400)
committercolemanw <coleman@civicrm.org>
Sat, 8 Aug 2015 14:18:36 +0000 (10:18 -0400)
CRM-14599 - Exclude deleted contacts from test mailing

232 files changed:
CRM/ACL/API.php
CRM/Activity/Form/Search.php
CRM/Activity/Import/Parser/Activity.php
CRM/Admin/Form/Navigation.php
CRM/Admin/Form/RelationshipType.php
CRM/Admin/Form/Setting.php
CRM/Admin/Form/WordReplacements.php
CRM/Admin/Page/Options.php
CRM/Batch/Form/Entry.php
CRM/Batch/Page/AJAX.php
CRM/Campaign/BAO/Query.php
CRM/Campaign/Form/Petition/Signature.php
CRM/Campaign/Form/Search.php
CRM/Campaign/Page/AJAX.php
CRM/Case/Form/Activity.php
CRM/Case/Form/Search.php
CRM/Contact/BAO/Contact.php
CRM/Contact/BAO/GroupContact.php
CRM/Contact/BAO/GroupContactCache.php
CRM/Contact/BAO/Individual.php
CRM/Contact/BAO/Query.php
CRM/Contact/Form/DedupeFind.php
CRM/Contact/Form/DedupeRules.php
CRM/Contact/Form/Edit/Address.php
CRM/Contact/Form/RelatedContact.php
CRM/Contact/Form/Search/Advanced.php
CRM/Contact/Form/Search/Criteria.php
CRM/Contact/Form/Search/Custom/ContribSYBNT.php
CRM/Contact/Import/Parser/Contact.php
CRM/Contact/Page/AJAX.php
CRM/Contact/Page/ImageFile.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/Form/AdditionalPayment.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/ContributionBase.php
CRM/Contribute/Form/Search.php
CRM/Contribute/Form/Task/PDFLetter.php
CRM/Contribute/Form/Task/Status.php
CRM/Contribute/Import/Parser/Contribution.php
CRM/Contribute/xml/Menu/Contribute.xml
CRM/Core/BAO/CustomField.php
CRM/Core/BAO/CustomQuery.php
CRM/Core/BAO/CustomValue.php
CRM/Core/BAO/UFField.php
CRM/Core/Block.php
CRM/Core/Controller.php
CRM/Core/DAO/permissions.php
CRM/Core/Form.php
CRM/Core/I18n/SchemaStructure_4_7_alpha1.php [new file with mode: 0644]
CRM/Core/OptionValue.php
CRM/Core/Page/AJAX.php
CRM/Core/Page/AJAX/Attachment.php
CRM/Core/Payment/BaseIPN.php
CRM/Core/Payment/Form.php
CRM/Core/Payment/PayPalImpl.php
CRM/Core/Payment/PayPalProIPN.php
CRM/Core/Resources.php
CRM/Core/SelectValues.php
CRM/Custom/Form/Group.php
CRM/Custom/Page/AJAX.php
CRM/Dedupe/Merger.php
CRM/Event/BAO/Event.php
CRM/Event/Form/EventFees.php
CRM/Event/Form/Participant.php
CRM/Event/Form/Registration/AdditionalParticipant.php
CRM/Event/Form/Registration/Register.php
CRM/Event/Form/Search.php
CRM/Event/Form/Task/Batch.php
CRM/Event/Import/Parser/Participant.php
CRM/Export/BAO/Export.php
CRM/Financial/BAO/ExportFormat.php
CRM/Financial/BAO/PaymentProcessor.php
CRM/Financial/Form/BatchTransaction.php
CRM/Financial/Form/FinancialBatch.php
CRM/Financial/Form/Payment.php
CRM/Financial/Form/Search.php
CRM/Financial/Page/AJAX.php
CRM/Grant/Form/Search.php
CRM/Group/Page/AJAX.php
CRM/Mailing/BAO/Mailing.php
CRM/Mailing/BAO/MailingAB.php
CRM/Mailing/BAO/MailingJob.php
CRM/Mailing/Form/Group.php
CRM/Mailing/Info.php
CRM/Mailing/Page/Preview.php
CRM/Member/Form/Membership.php
CRM/Member/Form/MembershipRenewal.php
CRM/Member/Form/Search.php
CRM/Member/Import/Parser/Membership.php
CRM/Member/Page/Tab.php
CRM/PCP/Form/PCPAccount.php
CRM/Pledge/Form/Search.php
CRM/Profile/Form.php
CRM/Report/Form.php
CRM/Report/Form/Contribute/Bookkeeping.php
CRM/Report/Form/Contribute/Detail.php
CRM/Report/Form/Extended.php
CRM/Report/Form/Mailing/Summary.php
CRM/Report/Form/Member/Detail.php
CRM/Report/Utils/Report.php
CRM/SMS/Form/Group.php
CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_html.tpl
CRM/Upgrade/4.7.alpha1.msg_template/message_templates/pcp_owner_notify_text.tpl
CRM/Upgrade/Incremental/php/FourSix.php
CRM/Upgrade/Incremental/sql/4.6.6.mysql.tpl
CRM/Upgrade/Incremental/sql/4.6.7.mysql.tpl [new file with mode: 0644]
CRM/Upgrade/Incremental/sql/4.7.alpha1.mysql.tpl
CRM/Utils/API/ReloadOption.php
CRM/Utils/Hook.php
CRM/Utils/ICalendar.php
CRM/Utils/JSON.php
CRM/Utils/PDF/Utils.php
CRM/Utils/REST.php
CRM/Utils/System.php
CRM/Utils/System/Base.php
CRM/Utils/System/Drupal.php
CRM/Utils/System/Drupal6.php
CRM/Utils/System/Drupal8.php
CRM/Utils/System/Joomla.php
CRM/Utils/System/UnitTests.php
Civi/API/Subscriber/ChainSubscriber.php
api/api.php
api/v3/Acl.php
api/v3/AclRole.php
api/v3/ActionSchedule.php
api/v3/Activity.php
api/v3/ActivityContact.php
api/v3/Address.php
api/v3/Contact.php
api/v3/Contribution.php
api/v3/CustomSearch.php
api/v3/Group.php
api/v3/GroupContact.php
api/v3/MembershipBlock.php
api/v3/MembershipLog.php [new file with mode: 0644]
api/v3/OpenID.php
api/v3/OptionValue.php
api/v3/PaymentProcessor.php
api/v3/Phone/Get.php
api/v3/ReportInstance.php
api/v3/ReportTemplate.php
api/v3/Tag.php
api/v3/Website.php
api/v3/examples/Contact/GetFieldsOptions.php
api/v3/examples/Mailing/GetTokens.php
js/Common.js
js/wysiwyg/admin.ckeditor-configurator.js
templates/CRM/Admin/Form/RelationshipType.tpl
templates/CRM/Admin/Page/APIExplorer.js
templates/CRM/Admin/Page/APIExplorer.tpl
templates/CRM/Contact/Form/Contact.hlp
templates/CRM/Contact/Form/Contact.tpl
templates/CRM/Contact/Form/Edit/Address/city_postal_code.tpl
templates/CRM/Contact/Form/Task/AddToGroup.tpl
templates/CRM/Contact/Page/View/CustomData.tpl
templates/CRM/Contact/Page/View/Summary.tpl
templates/CRM/Contribute/Form/AdditionalPayment.tpl
templates/CRM/Contribute/Form/Contribution.tpl
templates/CRM/Contribute/Form/Contribution/Main.tpl
templates/CRM/Contribute/Form/ContributionPage/Amount.tpl
templates/CRM/Contribute/Form/ContributionPage/Premium.tpl
templates/CRM/Contribute/Form/ContributionPage/Widget.tpl
templates/CRM/Contribute/Form/ContributionView.tpl
templates/CRM/Contribute/Form/PaymentInstrument.tpl
templates/CRM/Contribute/Form/Search/Common.tpl
templates/CRM/Contribute/Form/Task/Status.tpl
templates/CRM/Contribute/Page/Tab.hlp
templates/CRM/Core/BillingBlock.tpl
templates/CRM/Custom/Import/Form/DataSource.hlp
templates/CRM/Event/Form/EventFees.tpl
templates/CRM/Event/Form/ManageEvent/Fee.tpl
templates/CRM/Event/Form/ManageEvent/Registration.tpl
templates/CRM/Event/Form/Registration/AdditionalParticipant.tpl
templates/CRM/Event/Form/Task/AddToGroup.tpl
templates/CRM/Financial/Form/Search.tpl
templates/CRM/Financial/Page/FinancialAccount.tpl
templates/CRM/Financial/Page/FinancialBatch.hlp
templates/CRM/Member/Form/Membership.tpl
templates/CRM/PCP/Form/PCP.tpl
templates/CRM/common/contactFooter.tpl
templates/CRM/common/navigation.js.tpl
tests/phpunit/CRM/Core/BAO/CustomValueTest.php
tests/phpunit/CRM/Core/Payment/BaseIPNTest.php
tests/phpunit/CRM/Utils/API/ReloadOptionTest.php
tests/phpunit/WebTest/Contact/MergeContactsTest.php
tests/phpunit/WebTest/Contact/SearchBuilderTest.php
tests/phpunit/WebTest/Contact/SearchbyDateFilterTest.php
tests/phpunit/WebTest/Contribute/AddPricesetTest.php
tests/phpunit/WebTest/Contribute/ContactContextAddTest.php
tests/phpunit/WebTest/Contribute/OfflineContributionTest.php
tests/phpunit/WebTest/Contribute/OfflineRecurContributionTest.php
tests/phpunit/WebTest/Contribute/OnlineRecurContributionTest.php
tests/phpunit/WebTest/Contribute/StandaloneAddTest.php
tests/phpunit/WebTest/Contribute/UpdatePendingContributionTest.php
tests/phpunit/WebTest/Event/AddParticipationTest.php
tests/phpunit/WebTest/Event/AddPricesetTest.php
tests/phpunit/WebTest/Event/AdditionalPaymentTest.php
tests/phpunit/WebTest/Utils/RedirectTest.php [new file with mode: 0644]
tests/phpunit/WebTest/resources/import/ImportContribs1.csv
tests/phpunit/WebTest/resources/import/ImportContribs2.csv
tests/phpunit/WebTest/resources/import/ImportContribsExtID.csv
tests/phpunit/WebTest/resources/import/ImportContribs_custom.csv
tests/phpunit/api/v3/ContactTest.php
tests/phpunit/api/v3/ContributionPageTest.php
tests/phpunit/api/v3/ContributionTest.php
tests/phpunit/api/v3/EventTest.php
tests/phpunit/api/v3/GroupContactTest.php
tests/phpunit/api/v3/SyntaxConformanceTest.php
tools/drupal/modules/multicurrency/templates/CRM/Event/Form/Registration/4/Register.tpl
tools/drupal/modules/multicurrency/templates/CRM/Event/Form/Registration/8/Register.tpl
xml/schema/Batch/Batch.xml
xml/schema/Contact/Contact.xml
xml/schema/Contact/Individual.xml
xml/schema/Contact/RelationshipType.xml
xml/schema/Contribute/Contribution.xml
xml/schema/Contribute/ContributionRecur.xml
xml/schema/Core/Address.xml
xml/schema/Core/MessageTemplate.xml
xml/schema/Financial/FinancialTrxn.xml
xml/schema/Financial/PaymentProcessor.xml
xml/schema/Financial/PaymentProcessorType.xml
xml/schema/Member/MembershipLog.xml
xml/templates/civicrm_data.tpl
xml/templates/civicrm_navigation.tpl
xml/templates/message_templates/contribution_offline_receipt_html.tpl
xml/templates/message_templates/contribution_offline_receipt_text.tpl
xml/templates/message_templates/membership_offline_receipt_html.tpl
xml/templates/message_templates/membership_offline_receipt_text.tpl
xml/templates/message_templates/pcp_owner_notify_html.tpl
xml/templates/message_templates/pcp_owner_notify_text.tpl

index f3681b3fa8702eb91c056b0150f1f95fd82cb7d1..675beb80de3fa91c5d0b105446936a7c269e4fb8 100644 (file)
@@ -227,6 +227,9 @@ class CRM_ACL_API {
       $groups = self::group($type, $contactID, $tableName, $allGroups, $includedGroups);
       $cache[$key] = $groups;
     }
+    if (empty($groups)) {
+      return FALSE;
+    }
 
     return in_array($groupID, $groups) ? TRUE : FALSE;
   }
index 8e2a4ba5d978351d7aefc1ac14c9b5270c080f6f..518925ab25aa23be48c9f58337f8dd52eebed483 100644 (file)
@@ -68,8 +68,6 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_prefix = "activity_";
 
-  protected $_defaults;
-
   /**
    * The saved search ID retrieved from the GET vars.
    *
@@ -234,7 +232,7 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search {
       $this->_formValues["activity_test"] = 0;
     }
 
-    CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
+    CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
 
     $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
 
index 778d0b322eda3f75f833f2657432431efdff4af0..fdbcd75240f141c099d4d63e50155d5969deb488 100644 (file)
@@ -373,14 +373,14 @@ class CRM_Activity_Import_Parser_Activity extends CRM_Activity_Import_Parser {
         if (!empty($params['target_contact_id']) &&
           $params['target_contact_id'] != $targetContactId
         ) {
-          array_unshift($values, 'Mismatch of External identifier :' . $params['external_identifier'] . ' and Contact Id:' . $params['target_contact_id']);
+          array_unshift($values, 'Mismatch of External ID:' . $params['external_identifier'] . ' and Contact Id:' . $params['target_contact_id']);
           return CRM_Import_Parser::ERROR;
         }
         elseif ($targetContactId) {
           $params['target_contact_id'] = $targetContactId;
         }
         else {
-          array_unshift($values, 'No Matching Contact for External identifier :' . $params['external_identifier']);
+          array_unshift($values, 'No Matching Contact for External ID:' . $params['external_identifier']);
           return CRM_Import_Parser::ERROR;
         }
       }
index ca54eff5b539815f7b2ba71bafdb2dfb05d3006a..2f7651c676f1b4fcb78c0b2c641a9e9cae67b027 100644 (file)
@@ -44,11 +44,6 @@ class CRM_Admin_Form_Navigation extends CRM_Admin_Form {
    */
   protected $_currentParentID = NULL;
 
-  /**
-   * Default values.
-   */
-  protected $_defaults = array();
-
   /**
    * Build the form object.
    *
index 9e11ac238741782b7044229ed8a35098d1eb14a4..24dc46a4286508f4bbebd1abd42115932ff1e01e 100644 (file)
@@ -101,6 +101,9 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
     }
+
+    $this->assign('relationship_type_id', $this->_id);
+
   }
 
   /**
index 910e5f90d35ef8df960762b633f88b06399f60ab..c70dd8ae4914ee840dc07e7eff2f31170a78e8a4 100644 (file)
@@ -37,7 +37,6 @@
  */
 class CRM_Admin_Form_Setting extends CRM_Core_Form {
 
-  protected $_defaults;
   protected $_settings = array();
 
   /**
index 4de04e9b6d29547a607cc14e0cb120178b356daa..0e6361a861448e4299235a387d59b8111f6dec77 100644 (file)
@@ -36,8 +36,6 @@ class CRM_Admin_Form_WordReplacements extends CRM_Core_Form {
 
   protected $_stringName = NULL;
 
-  protected $_defaults = NULL;
-
   public $unsavedChangesWarn = TRUE;
 
   /**
index ad4bc74c14d14df3f34443839cf41419766bf9ce..bf29204202043f3d9640a1ee135b583ffad88cc1 100644 (file)
@@ -250,7 +250,7 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic {
       'id', $returnURL, $filter
     );
 
-    // retrieve financial account name for the payment instrument page
+    // retrieve financial account name for the payment method page
     if ($gName = "payment_instrument") {
       foreach ($optionValue as $key => $option) {
         $optionValue[$key]['financial_account'] = CRM_Financial_BAO_FinancialTypeAccount::getFinancialAccount($key, 'civicrm_option_value');
index 688fa27c08df88781b34cd91c29f0d294f4106df..7ea3a69658dfb46fb25f97bb556d16011cb37441 100755 (executable)
@@ -280,9 +280,9 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
     $errors = array();
     $batchTypes = CRM_Core_Pseudoconstant::get('CRM_Batch_DAO_Batch', 'type_id', array('flip' => 1), 'validate');
     $fields = array(
-      'total_amount' => 'Amount',
-      'financial_type' => 'Financial Type',
-      'payment_instrument' => 'Paid By',
+      'total_amount' => ts('Amount'),
+      'financial_type' => ts('Financial Type'),
+      'payment_instrument' => ts('Payment Method'),
     );
 
     //CRM-16480 if contact is selected, validate financial type and amount field.
index 434533e67812d94304325e4251d85394d7375dfe..864b38a882d9156c882ebafe09a8a79ab362aeba 100644 (file)
@@ -114,7 +114,7 @@ class CRM_Batch_Page_AJAX {
         'links',
       );
     }
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
   }
index a6e7b2f090302fae6decf8cf64b146f3fdd6af56..390be8d5c75f47af0d7aae2667784f32f3a51870 100755 (executable)
@@ -354,7 +354,7 @@ civicrm_activity_assignment.record_type_id = $assigneeID ) ";
     $form->add('text', 'street_unit', ts('Street Unit'), $attributes['street_unit']);
     $form->add('text', 'street_address', ts('Street Address'), $attributes['street_address']);
     $form->add('text', 'city', ts('City'), $attributes['city']);
-    $form->add('text', 'postal_code', ts('Zip / Postal Code'), $attributes['postal_code']);
+    $form->add('text', 'postal_code', ts('Postal Code'), $attributes['postal_code']);
 
     //@todo FIXME - using the CRM_Core_DAO::VALUE_SEPARATOR creates invalid html - if you can find the form
     // this is loaded onto then replace with something like '__' & test
index 0affe05a240bbaa7b506ce41f7e25c4987259941..2e937ec22b45c8f4b3d94b7bbc1ca9998e18eeb7 100644 (file)
@@ -134,8 +134,6 @@ class CRM_Campaign_Form_Petition_Signature extends CRM_Core_Form {
 
   protected $_image_URL;
 
-  protected $_defaults = NULL;
-
   /**
    */
   public function __construct() {
index 2e79c5dc91ba7e90ffd3a97bfb123414f0d683f6..4d67f124c3d04ae6a53d06a85b917064deb6fe0b 100755 (executable)
@@ -59,8 +59,6 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_limit = NULL;
 
-  protected $_defaults;
-
   /**
    * Prefix for the controller.
    */
index 423e5903f695ced06135cdb786ff23c5ff2b9dc5..02ad12fd2f19e588938ae4b186a19843515a3bf7 100644 (file)
@@ -360,7 +360,7 @@ class CRM_Campaign_Page_AJAX {
 
     $iFilteredTotal = $iTotal;
 
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
   }
@@ -660,7 +660,7 @@ class CRM_Campaign_Page_AJAX {
 
     $iFilteredTotal = $iTotal;
 
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
   }
@@ -764,7 +764,7 @@ class CRM_Campaign_Page_AJAX {
 
     $iFilteredTotal = $iTotal;
 
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
   }
@@ -863,7 +863,7 @@ class CRM_Campaign_Page_AJAX {
 
     $iFilteredTotal = $iTotal;
 
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
   }
index f1cf6bf439eb592a8873b46ab8f6ef687d1a4309..ee6a7b4b8da919aa81216a859460320cf122f85e 100644 (file)
@@ -53,13 +53,6 @@ class CRM_Case_Form_Activity extends CRM_Activity_Form_Activity {
    */
   public $_caseType;
 
-  /**
-   * The default values of an activity.
-   *
-   * @var array
-   */
-  public $_defaults = array();
-
   /**
    * The array of releted contact info.
    *
index 4c33c675de452b4d22549d51a0098029b017ff0e..2f2ce74510466d89b5bde2164d010f81c7cc3086 100644 (file)
@@ -64,8 +64,6 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_prefix = 'case_';
 
-  protected $_defaults;
-
   /**
    * Processing needed for buildForm and later.
    *
@@ -248,7 +246,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search {
     if (empty($this->_formValues['case_deleted'])) {
       $this->_formValues['case_deleted'] = 0;
     }
-    CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
+    CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
 
     $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
 
index 69dda6bd15b1f7454c89921874584687e0562e7d..49c809f64cfb5a4c1b2ff9bb7318e7d8400b3319 100644 (file)
@@ -2130,6 +2130,9 @@ ORDER BY civicrm_email.is_primary DESC";
         }
         elseif ($fieldName == 'email') {
           $data['email'][$loc]['email'] = $value;
+          if (empty($contactID)) {
+            $data['email'][$loc]['is_primary'] = 1;
+          }
         }
         elseif ($fieldName == 'im') {
           if (isset($params[$key . '-provider_id'])) {
index 2a564f3febed09ababe1531805937839920afe0b..8a4bb40b9e98b669c862d26caa0e2ea13fc9b118 100644 (file)
@@ -351,7 +351,7 @@ class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact {
                     civicrm_subscription_history.method as method';
     }
 
-    $where = " WHERE contact_a.id = %1 AND civicrm_group.is_active = 1 AND civicrm_group.saved_search_id IS NULL";
+    $where = " WHERE contact_a.id = %1 AND civicrm_group.is_active = 1";
 
     if ($excludeHidden) {
       $where .= " AND civicrm_group.is_hidden = 0 ";
@@ -381,6 +381,10 @@ class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact {
 
     $from = CRM_Contact_BAO_Query::fromClause($tables);
 
+    //CRM-16945: seems hackish but as per CRM-16483 of using group criteria for Search Builder it is mandatory
+    //to include group_contact_cache clause when group table is present, so following code remove duplicacy
+    $from = str_replace("OR civicrm_group.id = civicrm_group_contact_cache.group_id", 'AND civicrm_group.saved_search_id IS NULL', $from);
+
     $where .= " AND $permission ";
 
     if ($onlyPublicGroups) {
@@ -799,15 +803,10 @@ AND    contact_id IN ( $contactStr )
 
     $options = CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
 
-    if (($fieldName == 'group' || $fieldName == 'group_id')) {
-      // Enforce group visibility permissions
-      if (!empty($props['check_permissions'])) {
-        $options = CRM_Core_PseudoConstant::group();
-      }
-      if ($context == 'search' || $context == 'create') {
-        // Sort group list by hierarchy
-        $options = CRM_Contact_BAO_Group::getGroupsHierarchy($options, NULL, '- ', TRUE);
-      }
+    // Sort group list by hierarchy
+    // TODO: This will only work when api.entity is "group_contact". What about others?
+    if (($fieldName == 'group' || $fieldName == 'group_id') && ($context == 'search' || $context == 'create')) {
+      $options = CRM_Contact_BAO_Group::getGroupsHierarchy($options, NULL, '- ', TRUE);
     }
 
     return $options;
index fe5802c24bb14a35ae9e93f33325df9f05804bd6..e37c525720268cd52d4d215937923dba6da7af8e 100644 (file)
@@ -482,6 +482,9 @@ WHERE  id = %1
         $customClass = CRM_Contact_BAO_SearchCustom::customClass($ssParams['customSearchID'], $savedSearchID);
         $searchSQL = $customClass->contactIDs();
         $searchSQL = str_replace('ORDER BY contact_a.id ASC', '', $searchSQL);
+        if (!strstr($searchSQL, 'WHERE')) {
+          $searchSQL .= " WHERE ( 1 ) ";
+        }
         $idName = 'contact_id';
       }
       else {
index 490b1645a84fdcbdcf8e5cfe885536ec72555cfd..245b59059ed43859366f33c9b1325d7178b6710e 100644 (file)
@@ -49,7 +49,7 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact {
    *
    * @param array $params
    *   (reference ) an assoc array of name/value pairs.
-   * @param array $contact
+   * @param CRM $contact
    *   Contact object.
    *
    * @return CRM_Contact_BAO_Contact
@@ -254,7 +254,7 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact {
     }
 
     //now set the names.
-    $names = array('sortName' => 'sort_name', 'displayName' => 'display_name');
+    $names = array('displayName' => 'display_name', 'sortName' => 'sort_name');
     foreach ($names as $value => $name) {
       if (empty($$value)) {
         if ($email) {
@@ -263,6 +263,13 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact {
         elseif ($uniqId) {
           $$value = $uniqId;
         }
+        elseif (!empty($params[$name])) {
+          $$value = $params[$name];
+        }
+        // If we have nothing else going on set sort_name to display_name.
+        elseif ($displayName) {
+          $$value = $displayName;
+        }
       }
       //finally if we could not pass anything lets keep db.
       if (!empty($$value)) {
@@ -408,11 +415,10 @@ class CRM_Contact_BAO_Individual extends CRM_Contact_DAO_Contact {
    * Check if there is data to create the object.
    *
    * @param array $params
-   *   (reference ) an assoc array of name/value pairs.
    *
    * @return bool
    */
-  public static function dataExists(&$params) {
+  public static function dataExists($params) {
     if ($params['contact_type'] == 'Individual') {
       return TRUE;
     }
index 57437be2ae40762420c824cc803ff9b29b34699f..990cca71e3c89291931b43d559fe7b5027d5291a 100644 (file)
@@ -5301,6 +5301,12 @@ SELECT COUNT( conts.total_amount ) as cancel_count,
         $clause = " (NULLIF($field, '') IS NOT NULL) ";
         return $clause;
 
+      case 'IN':
+      case 'NOT IN':
+        if (!empty($value) && is_array($value) && !array_key_exists($op, $value)) {
+          $value = array($op => $value);
+        }
+
       default:
         if (empty($dataType)) {
           $dataType = 'String';
index ef80374061d9978b6a2e4d5e9af12da300d913dd..2e77f366cb4c0e06ecf516bdb74338c15bf09f6e 100644 (file)
  */
 class CRM_Contact_Form_DedupeFind extends CRM_Admin_Form {
 
-  /**
-   * Defined defaults.
-   */
-  public $_defaults;
-
   /**
    * Pre processing.
-   *
-   * @return void
    */
   public function preProcess() {
     $this->rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this, FALSE, 0);
index 4361c3ab475b62c84d6976697da7e45c8187c936..bfa0fbfd9d7b6bb1502643d627cd667f24e0881e 100644 (file)
@@ -40,7 +40,6 @@
 class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form {
   const RULES_COUNT = 5;
   protected $_contactType;
-  protected $_defaults = array();
   protected $_fields = array();
   protected $_rgid;
 
index b6cdd6b7f938157bda5aac3d89b17d4df3d3a15e..35d2ed39c0155828d305148dab4fadf836d627b0 100644 (file)
@@ -142,7 +142,13 @@ class CRM_Contact_Form_Edit_Address {
         $name = 'name';
       }
 
-      $form->addField("address[$blockId][$name]", array('entity' => 'address'));
+      $params = array('entity' => 'address');
+
+      if ($name == 'postal_code_suffix') {
+        $params['label'] = ts('Suffix');
+      }
+
+      $form->addField("address[$blockId][$name]", $params);
     }
 
     $entityId = NULL;
index 7b1a453eefb5fcc9f52dcf30dd59e3d354e1dbc8..c869078931da67f1ce8546d22212f6ca6e329e11 100644 (file)
@@ -55,13 +55,6 @@ class CRM_Contact_Form_RelatedContact extends CRM_Core_Form {
    */
   public $_contactId;
 
-  /**
-   * Form defaults.
-   *
-   * @var array
-   */
-  protected $_defaults = array();
-
   /**
    * Build all the data structures needed to build the form.
    */
index e82ae6bf3573b6de0e2b557f9cc2ad86b367a6ed..32742bcc842bd9b2e9f6cf5ff68f00c95b9876ee 100644 (file)
@@ -8,7 +8,7 @@
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | CiviCRM is free software; you can copy, modify, and distribute it  |
-s | under the terms of the GNU Affero General Public License           |
+ | under the terms of the GNU Affero General Public License           |
  | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
  |                                                                    |
  | CiviCRM is distributed in the hope that it will be useful, but     |
@@ -323,7 +323,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
       $this->_sortByCharacter = NULL;
     }
 
-    CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
+    CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
 
     $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     $this->_returnProperties = &$this->returnProperties();
@@ -381,7 +381,6 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
       'contribution_product_id',
       'payment_instrument_id',
     );
-    $specialParams += preg_grep('/^custom_/', array_keys($this->_formValues));
     foreach ($specialParams as $element) {
       $value = CRM_Utils_Array::value($element, $this->_formValues);
       if ($value) {
@@ -427,12 +426,21 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
     }
 
     if ($this->_ssID && empty($_POST)) {
-      $fields = array('contact_type', 'group', 'contact_tags');
+      $specialFields = array('contact_type', 'group', 'contact_tags');
 
-      foreach ($fields as $field) {
-        $fieldValues = CRM_Utils_Array::value($field, $defaults);
-        if ($fieldValues && is_array($fieldValues)) {
-          $defaults[$field] = array_keys($fieldValues);
+      foreach ($defaults as $element => $value) {
+        if (!empty($value) && is_array($value)) {
+          if (in_array($element, $specialFields)) {
+            $defaults[$element] = array_keys($value);
+          }
+          // As per the OK (Operator as Key) value format, value array may contain key
+          // as an operator so to ensure the default is always set actual value
+          elseif (in_array(key($value), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
+            $defaults[$element] = CRM_Utils_Array::value(key($value), $value);
+            if (is_string($defaults[$element])) {
+              $defaults[$element] = str_replace("%", '', $defaults[$element]);
+            }
+          }
         }
       }
     }
index 593e98e785ae59f8befaf5373450835094a67efd..a73122e0828cdbe2998a7d631038b85925728bcf 100644 (file)
@@ -270,7 +270,7 @@ class CRM_Contact_Form_Search_Criteria {
     $form->addSelect('preferred_language', array('class' => 'twenty', 'context' => 'search'));
 
     // Phone search
-    $form->addElement('text', 'phone_numeric', ts('Phone Number'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
+    $form->addElement('text', 'phone_numeric', ts('Phone'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
     $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
     $phoneType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
     $form->add('select', 'phone_location_type_id', ts('Phone Location'), array('' => ts('- any -')) + $locationType, FALSE, array('class' => 'crm-select2'));
@@ -302,7 +302,7 @@ class CRM_Contact_Form_Search_Criteria {
     $elements = array(
       'street_address' => array(ts('Street Address'), $attributes['street_address'], NULL, NULL),
       'city' => array(ts('City'), $attributes['city'], NULL, NULL),
-      'postal_code' => array(ts('Zip / Postal Code'), $attributes['postal_code'], NULL, NULL),
+      'postal_code' => array(ts('Postal Code'), $attributes['postal_code'], NULL, NULL),
       'country' => array(ts('Country'), $attributes['country_id'], 'country', FALSE),
       'state_province' => array(ts('State/Province'), $attributes['state_province_id'], 'stateProvince', TRUE),
       'county' => array(ts('County'), $attributes['county_id'], 'county', TRUE),
index 8c5c9114ad30f8bf3906f55ca04865fdfb04dac5..848742331b6a626bd9249ee336b8af878dea5815 100644 (file)
@@ -167,18 +167,15 @@ class CRM_Contact_Form_Search_Custom_ContribSYBNT extends CRM_Contact_Form_Searc
 
     $from = $this->from();
 
+    $select = $this->select();
     if ($justIDs) {
-      $select = $this->select();
       $select .= ', contact_a.id, display_name';
     }
     else {
-      $select = $this->select();
       $select = "
            DISTINCT contact_a.id as contact_id,
            contact_a.display_name as display_name,
-           $select
-";
-
+           $select ";
     }
     $this->buildACLClause('contact_a');
     $sql = "
index d1785ed72b336c4dcee4520dc267d720d9a1f448..a16b44f9a5f03db933bdeb4c6fc2557742408aa7 100644 (file)
@@ -1356,7 +1356,7 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser {
 
           case 'is_deceased':
             if (CRM_Utils_String::strtoboolstr($value) === FALSE) {
-              self::addToErrorMsg(ts('Is Deceased'), $errorMessage);
+              self::addToErrorMsg(ts('Deceased'), $errorMessage);
             }
             break;
 
index feba0661a7ed82fe6684b4e1d4fee05b9b70f646..a2a9b3bd9c54559ebc3f2dce95ba5092186e3795 100644 (file)
@@ -295,7 +295,7 @@ class CRM_Contact_Page_AJAX {
   }
 
   public static function groupTree() {
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     $gids = CRM_Utils_Type::escape($_GET['gids'], 'String');
     echo CRM_Contact_BAO_GroupNestingCache::json($gids);
     CRM_Utils_System::civiExit();
@@ -305,7 +305,7 @@ class CRM_Contact_Page_AJAX {
    * Delete custom value.
    */
   public static function deleteCustomValue() {
-    header('Content-Type: text/plain');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain');
     $customValueID = CRM_Utils_Type::escape($_REQUEST['valueID'], 'Positive');
     $customGroupID = CRM_Utils_Type::escape($_REQUEST['groupID'], 'Positive');
 
@@ -370,7 +370,7 @@ class CRM_Contact_Page_AJAX {
         $userEmail
         ) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
 
-      header('Content-Type: text/plain');
+      CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain');
       if ($userEmail) {
         echo $userEmail;
       }
@@ -713,7 +713,7 @@ LIMIT {$offset}, {$rowCount}
       }
     }
 
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
 
     CRM_Utils_System::civiExit();
index 443b3ca706fa5e93d73b496d239f0942a92df034..13e4af98e889e74bee1ba1be18982e5af83f5077 100644 (file)
@@ -83,11 +83,11 @@ class CRM_Contact_Page_ImageFile extends CRM_Core_Page {
       header('HTTP/1.0 403 Forbidden');
       return;
     }
-    header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', CRM_Utils_Time::getTimeRaw() + $ttl));
-    header("Content-Type: $mimeType");
-    header("Content-Disposition: inline; filename=\"" . basename($file) . "\"");
-    header("Cache-Control: max-age=$ttl, public");
-    header('Pragma: public');
+    CRM_Utils_System::setHttpHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', CRM_Utils_Time::getTimeRaw() + $ttl));
+    CRM_Utils_System::setHttpHeader("Content-Type", $mimeType);
+    CRM_Utils_System::setHttpHeader("Content-Disposition", "inline; filename=\"" . basename($file) . "\"");
+    CRM_Utils_System::setHttpHeader("Cache-Control", "max-age=$ttl, public");
+    CRM_Utils_System::setHttpHeader('Pragma', 'public');
     readfile($file);
   }
 
index c75a16b58fadbd3d7c07bbbb97bd71334c790a85..55db953b939504ec4e9ce14b6485064b26ff82df 100644 (file)
@@ -493,6 +493,9 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       'name'
     );
     if (!$activity->find(TRUE)) {
+      if (empty($contribution->contact_id)) {
+        $contribution->find(TRUE);
+      }
       CRM_Activity_BAO_Activity::addActivity($contribution, 'Offline');
     }
     else {
@@ -1478,6 +1481,13 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
   /**
    * Update contribution as well as related objects.
    *
+   * This function by-passes hooks - to address this - don't use this function.
+   *
+   * @deprecated
+   *
+   * Use api contribute.completetransaction
+   * For failures use failPayment (preferably exposing by api in the process).
+   *
    * @param array $params
    * @param bool $processContributionObject
    *
@@ -1937,6 +1947,47 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_
     return CRM_Core_DAO::singleValueQuery($query);
   }
 
+  /**
+   * Repeat a transaction as part of a recurring series.
+   *
+   * Only call this via the api as it is being refactored. The intention is that the repeatTransaction function
+   * (possibly living on the ContributionRecur BAO) would be called first to create a pending contribution with a
+   * subsequent call to the contribution.completetransaction api.
+   *
+   * The completeTransaction functionality has historically been overloaded to both complete and repeat payments.
+   *
+   * @param CRM_Contribute_BAO_Contribution $contribution
+   * @param array $input
+   * @param array $contributionParams
+   *
+   * @return array
+   */
+  protected static function repeatTransaction(&$contribution, &$input, $contributionParams) {
+    if (!empty($contribution->id)) {
+      return FALSE;
+    }
+    if (empty($contribution->id)) {
+      // Unclear why this would only be set for repeats.
+      if (!empty($input['amount'])) {
+        $contribution->total_amount = $contributionParams['total_amount'] = $input['amount'];
+      }
+      $templateContribution = civicrm_api3('Contribution', 'getsingle', array(
+        'contribution_recur_id' => $contributionParams['contribution_recur_id'],
+        'options' => array('limit' => 1),
+      ));
+      $contributionParams['skipLineItem'] = TRUE;
+      $contributionParams['status_id'] = 'Pending';
+      $contributionParams['financial_type_id'] = $templateContribution['financial_type_id'];
+      $contributionParams['contact_id'] = $templateContribution['contact_id'];
+      $contributionParams['source'] = empty($templateContribution['source']) ? ts('Recurring contribution') : $templateContribution['source'];
+      $createContribution = civicrm_api3('Contribution', 'create', $contributionParams);
+      $contribution->id = $createContribution['id'];
+      $input['line_item'] = CRM_Contribute_BAO_ContributionRecur::addRecurLineItems($contribution->contribution_recur_id, $contribution);
+      CRM_Contribute_BAO_ContributionRecur::copyCustomValues($contributionParams['contribution_recur_id'], $contribution->id);
+      return TRUE;
+    }
+  }
+
   /**
    * Get individual id for onbehalf contribution.
    *
@@ -2057,15 +2108,13 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
    *   Input as delivered from Payment Processor.
    * @param array $ids
    *   Ids as Loaded by Payment Processor.
-   * @param bool $required
-   *   Is Payment processor / contribution page required.
    * @param bool $loadAll
    *   Load all related objects - even where id not passed in? (allows API to call this).
    *
    * @return bool
    * @throws Exception
    */
-  public function loadRelatedObjects(&$input, &$ids, $required = FALSE, $loadAll = FALSE) {
+  public function loadRelatedObjects(&$input, &$ids, $loadAll = FALSE) {
     if ($loadAll) {
       $ids = array_merge($this->getComponentDetails($this->id), $ids);
       if (empty($ids['contact']) && isset($this->contact_id)) {
@@ -2178,18 +2227,6 @@ WHERE  contribution_id = %1 ";
           }
         }
       }
-
-      if (!$paymentProcessorID) {
-        //fail to load payment processor id.
-        // this seems a bit dubious....
-        if (empty($ids['pledge_payment'])) {
-          $loadObjectSuccess = TRUE;
-          if ($required) {
-            throw new Exception("Could not find contribution page for contribution record: " . $this->id);
-          }
-          return $loadObjectSuccess;
-        }
-      }
     }
     else {
       // we are in event mode
@@ -2232,10 +2269,6 @@ WHERE  contribution_id = %1 ";
       $ids['paymentProcessor'] = $paymentProcessorID;
       $this->_relatedObjects['paymentProcessor'] = $paymentProcessor;
     }
-    elseif ($required) {
-      throw new Exception("Could not find payment processor for contribution record: " . $this->id);
-    }
-
     return TRUE;
   }
 
@@ -2263,9 +2296,8 @@ WHERE  contribution_id = %1 ";
    * @throws Exception
    */
   public function composeMessageArray(&$input, &$ids, &$values, $recur = FALSE, $returnMessageText = TRUE) {
-    if (empty($this->_relatedObjects)) {
-      $this->loadRelatedObjects($input, $ids);
-    }
+    $this->loadRelatedObjects($input, $ids);
+
     if (empty($this->_component)) {
       $this->_component = CRM_Utils_Array::value('component', $input);
     }
@@ -2293,14 +2325,9 @@ WHERE  contribution_id = %1 ";
         $entityID = $ids['membership'][0];
       }
 
-      $url = $paymentObject->subscriptionURL($entityID, $entity);
-      $template->assign('cancelSubscriptionUrl', $url);
-
-      $url = $paymentObject->subscriptionURL($entityID, $entity, 'billing');
-      $template->assign('updateSubscriptionBillingUrl', $url);
-
-      $url = $paymentObject->subscriptionURL($entityID, $entity, 'update');
-      $template->assign('updateSubscriptionUrl', $url);
+      $template->assign('cancelSubscriptionUrl', $paymentObject->subscriptionURL($entityID, $entity));
+      $template->assign('updateSubscriptionBillingUrl', $paymentObject->subscriptionURL($entityID, $entity, 'billing'));
+      $template->assign('updateSubscriptionUrl', $paymentObject->subscriptionURL($entityID, $entity, 'update'));
 
       if ($this->_relatedObjects['paymentProcessor']['billing_mode'] & CRM_Core_Payment::BILLING_MODE_FORM) {
         //direct mode showing billing block, so use directIPN for temporary
@@ -2309,6 +2336,39 @@ WHERE  contribution_id = %1 ";
     }
     // todo remove strtolower - check consistency
     if (strtolower($this->_component) == 'event') {
+      $eventParams = array('id' => $this->_relatedObjects['participant']->event_id);
+      $values['event'] = array();
+
+      CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
+
+      //get location details
+      $locationParams = array('entity_id' => $this->_relatedObjects['participant']->event_id, 'entity_table' => 'civicrm_event');
+      $values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
+
+      $ufJoinParams = array(
+        'entity_table' => 'civicrm_event',
+        'entity_id' => $ids['event'],
+        'module' => 'CiviEvent',
+      );
+
+      list($custom_pre_id,
+        $custom_post_ids
+        ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
+
+      $values['custom_pre_id'] = $custom_pre_id;
+      $values['custom_post_id'] = $custom_post_ids;
+      //for tasks 'Change Participant Status' and 'Batch Update Participants Via Profile' case
+      //and cases involving status updation through ipn
+      // whatever that means!
+      // total_amount appears to be the preferred input param & it is unclear why we support amount here
+      // perhaps we should throw an e-notice if amount is set & force total_amount?
+      if (!empty($input['amount'])) {
+        $values['totalAmount'] = $input['amount'];
+      }
+
+      if ($values['event']['is_email_confirm']) {
+        $values['is_email_receipt'] = 1;
+      }
       return CRM_Event_BAO_Event::sendMail($ids['contact'], $values,
         $this->_relatedObjects['participant']->id, $this->is_test, $returnMessageText
       );
@@ -3968,16 +4028,41 @@ WHERE con.id = {$contributionId}
    * @param int $recur
    * @param CRM_Contribute_BAO_Contribution $contribution
    * @param bool $isRecurring
-   *   Duplication of param needs review.
+   *   Duplication of param needs review. Only used by AuthorizeNetIPN
    * @param int $isFirstOrLastRecurringPayment
+   *   Deprecated param only used by AuthorizeNetIPN.
    */
-  public static function completeOrder(&$input, &$ids, $objects, &$transaction, $recur, $contribution, $isRecurring,
+  public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution, $isRecurring,
       $isFirstOrLastRecurringPayment) {
     $primaryContributionID = isset($contribution->id) ? $contribution->id : $objects['first_contribution']->id;
+    // The previous details are used when calculating line items so keep it before any code that 'does something'
+    if (!empty($contribution->id)) {
+      $input['prevContribution'] = CRM_Contribute_BAO_Contribution::getValues(array('id' => $contribution->id),
+        CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray);
+    }
+    $inputContributionWhiteList = array(
+      'fee_amount',
+      'net_amount',
+      'trxn_id',
+      'check_number',
+      'payment_instrument_id',
+      'is_test',
+      'campaign_id',
+      'receive_date',
+    );
+
+    $contributionParams = array_merge(array(
+      'contribution_status_id' => 'Completed',
+    ), array_intersect_key($input, array_fill_keys($inputContributionWhiteList, 1)
+    ));
 
     $participant = CRM_Utils_Array::value('participant', $objects);
     $memberships = CRM_Utils_Array::value('membership', $objects);
     $recurContrib = CRM_Utils_Array::value('contributionRecur', $objects);
+    if (!empty($recurContrib->id)) {
+      $contributionParams['contribution_recur_id'] = $recurContrib->id;
+    }
+    self::repeatTransaction($contribution, $input, $contributionParams);
 
     if (is_numeric($memberships)) {
       $memberships = array($objects['membership']);
@@ -3989,14 +4074,14 @@ WHERE con.id = {$contributionId}
     if (isset($input['is_email_receipt'])) {
       $values['is_email_receipt'] = $input['is_email_receipt'];
     }
-    $source = NULL;
+
     if ($input['component'] == 'contribute') {
       if ($contribution->contribution_page_id) {
         CRM_Contribute_BAO_ContributionPage::setValues($contribution->contribution_page_id, $values);
-        $source = ts('Online Contribution') . ': ' . $values['title'];
+        $contributionParams['source'] = ts('Online Contribution') . ': ' . $values['title'];
       }
       elseif ($recurContrib && $recurContrib->id) {
-        $contribution->contribution_page_id = NULL;
+        $contributionParams['contribution_page_id'] = NULL;
         $values['amount'] = $recurContrib->amount;
         $values['financial_type_id'] = $objects['contributionType']->id;
         $values['title'] = $source = ts('Offline Recurring Contribution');
@@ -4011,20 +4096,24 @@ WHERE con.id = {$contributionId}
         $values['is_email_receipt'] = $recurContrib->is_email_receipt;
       }
 
-      $contribution->source = $source;
       if (!empty($values['is_email_receipt'])) {
-        $contribution->receipt_date = $changeDate;
+        $contributionParams['receipt_date'] = $changeDate;
       }
 
       if (!empty($memberships)) {
-        $membershipsUpdate = array();
         foreach ($memberships as $membershipTypeIdKey => $membership) {
           if ($membership) {
-            $format = '%Y%m%d';
+            $membershipParams = array(
+              'id' => $membership->id,
+              'contact_id' => $membership->contact_id,
+              'is_test' => $membership->is_test,
+              'membership_type_id' => $membership->membership_type_id,
+            );
 
-            $currentMembership = CRM_Member_BAO_Membership::getContactMembership($membership->contact_id,
-              $membership->membership_type_id,
-              $membership->is_test, $membership->id
+            $currentMembership = CRM_Member_BAO_Membership::getContactMembership($membershipParams['contact_id'],
+              $membershipParams['membership_type_id'],
+              $membershipParams['is_test'],
+              $membershipParams['id']
             );
 
             // CRM-8141 update the membership type with the value recorded in log when membership created/renewed
@@ -4032,22 +4121,22 @@ WHERE con.id = {$contributionId}
             $sql = "
 SELECT    membership_type_id
 FROM      civicrm_membership_log
-WHERE     membership_id=$membership->id
+WHERE     membership_id={$membershipParams['id']}
 ORDER BY  id DESC
 LIMIT 1;";
-            $dao = new CRM_Core_DAO();
-            $dao->query($sql);
+            $dao = CRM_Core_DAO::executeQuery($sql);
             if ($dao->fetch()) {
               if (!empty($dao->membership_type_id)) {
-                $membership->membership_type_id = $dao->membership_type_id;
-                $membership->save();
+                $membershipParams['membership_type_id'] = $dao->membership_type_id;
               }
-              // else fall back to using current membership type
             }
-            // else fall back to using current membership type
             $dao->free();
 
-            $num_terms = $contribution->getNumTermsByContributionAndMembershipType($membership->membership_type_id, $primaryContributionID);
+            $membershipParams['num_terms'] = $contribution->getNumTermsByContributionAndMembershipType(
+              $membershipParams['membership_type_id'],
+              $primaryContributionID
+            );
+            $dates = array_fill_keys(array('join_date', 'start_date', 'end_date'), NULL);
             if ($currentMembership) {
               /*
                * Fixed FOR CRM-4433
@@ -4058,14 +4147,11 @@ LIMIT 1;";
 
               // @todo - we should pass membership_type_id instead of null here but not
               // adding as not sure of testing
-              $dates = CRM_Member_BAO_MembershipType::getRenewalDatesForMembershipType($membership->id,
-                $changeDate, NULL, $num_terms
+              $dates = CRM_Member_BAO_MembershipType::getRenewalDatesForMembershipType($membershipParams['id'],
+                $changeDate, NULL, $membershipParams['num_terms']
               );
 
-              $dates['join_date'] = CRM_Utils_Date::customFormat($currentMembership['join_date'], $format);
-            }
-            else {
-              $dates = CRM_Member_BAO_MembershipType::getDatesForMembershipType($membership->membership_type_id, NULL, NULL, NULL, $num_terms);
+              $dates['join_date'] = $currentMembership['join_date'];
             }
 
             //get the status for membership.
@@ -4074,189 +4160,46 @@ LIMIT 1;";
               $dates['join_date'],
               'today',
               TRUE,
-              $membership->membership_type_id,
-              (array) $membership
+              $membershipParams['membership_type_id'],
+              $membershipParams
             );
 
-            $formatedParams = array(
-              'status_id' => CRM_Utils_Array::value('id', $calcStatus, 2),
-              'join_date' => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('join_date', $dates), $format),
-              'start_date' => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('start_date', $dates), $format),
-              'end_date' => CRM_Utils_Date::customFormat(CRM_Utils_Array::value('end_date', $dates), $format),
-            );
+            $membershipParams['status_id'] = CRM_Utils_Array::value('id', $calcStatus, 'New');
             //we might be renewing membership,
             //so make status override false.
-            $formatedParams['is_override'] = FALSE;
-            $membership->copyValues($formatedParams);
-            $membership->save();
-
-            //updating the membership log
-            $membershipLog = array();
-            $membershipLog = $formatedParams;
-
-            $logStartDate = $formatedParams['start_date'];
-            if (!empty($dates['log_start_date'])) {
-              $logStartDate = CRM_Utils_Date::customFormat($dates['log_start_date'], $format);
-              $logStartDate = CRM_Utils_Date::isoToMysql($logStartDate);
-            }
-
-            $membershipLog['start_date'] = $logStartDate;
-            $membershipLog['membership_id'] = $membership->id;
-            $membershipLog['modified_id'] = $membership->contact_id;
-            $membershipLog['modified_date'] = date('Ymd');
-            $membershipLog['membership_type_id'] = $membership->membership_type_id;
-
-            CRM_Member_BAO_MembershipLog::add($membershipLog, CRM_Core_DAO::$_nullArray);
+            $membershipParams['is_override'] = FALSE;
+            civicrm_api3('Membership', 'create', $membershipParams);
 
             //update related Memberships.
-            CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $formatedParams);
-
-            //update the membership type key of membership relatedObjects array
-            //if it has changed after membership update
-            if ($membershipTypeIdKey != $membership->membership_type_id) {
-              $membershipsUpdate[$membership->membership_type_id] = $membership;
-              $contribution->_relatedObjects['membership'][$membership->membership_type_id] = $membership;
-              unset($contribution->_relatedObjects['membership'][$membershipTypeIdKey]);
-              unset($memberships[$membershipTypeIdKey]);
-            }
+            CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $membershipParams);
           }
         }
-        //update the memberships object with updated membershipTypeId data
-        //if membershipTypeId has changed after membership update
-        if (!empty($membershipsUpdate)) {
-          $memberships = $memberships + $membershipsUpdate;
-        }
       }
     }
     else {
-      // event
-      $eventParams = array('id' => $objects['event']->id);
-      $values['event'] = array();
-
-      CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
-
-      //get location details
-      $locationParams = array('entity_id' => $objects['event']->id, 'entity_table' => 'civicrm_event');
-      $values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
-
-      $ufJoinParams = array(
-        'entity_table' => 'civicrm_event',
-        'entity_id' => $ids['event'],
-        'module' => 'CiviEvent',
-      );
-
-      list($custom_pre_id,
-        $custom_post_ids
-        ) = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
+      if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) {
+        $eventDetail = civicrm_api3('Event', 'getsingle', array('id' => $objects['event']->id));
+        $contributionParams['source'] = ts('Online Event Registration') . ': ' . $eventDetail['title'];
 
-      $values['custom_pre_id'] = $custom_pre_id;
-      $values['custom_post_id'] = $custom_post_ids;
-      //for tasks 'Change Participant Status' and 'Batch Update Participants Via Profile' case
-      //and cases involving status updation through ipn
-      $values['totalAmount'] = $input['amount'];
-
-      $contribution->source = ts('Online Event Registration') . ': ' . $values['event']['title'];
-
-      if ($values['event']['is_email_confirm']) {
-        $contribution->receipt_date = $changeDate;
-        $values['is_email_receipt'] = 1;
-      }
-      if (empty($input['skipComponentSync'])) {
-        $participantStatuses = CRM_Core_PseudoConstant::get('CRM_Event_DAO_Participant', 'status_id', array(
-          'labelColumn' => 'name',
-          'flip' => 1,
-        ));
-        $participant->status_id = $participantStatuses['Registered'];
-      }
-      $participant->save();
-    }
-
-    if (CRM_Utils_Array::value('net_amount', $input, 0) == 0 &&
-      CRM_Utils_Array::value('fee_amount', $input, 0) != 0
-    ) {
-      $input['net_amount'] = $input['amount'] - $input['fee_amount'];
-    }
-    // This complete transaction function is being overloaded to create new contributions too.
-    // here we record if it is a new contribution.
-    // @todo separate the 2 more appropriately.
-    $isNewContribution = FALSE;
-    if (empty($contribution->id)) {
-      $isNewContribution = TRUE;
-      if (!empty($input['amount']) && $input['amount'] != $contribution->total_amount) {
-        $contribution->total_amount = $input['amount'];
-        // The BAO does this stuff but we are actually kinda bypassing it here (bad code! go sit in the corner)
-        // so we have to handle net_amount in this (naughty) code.
-        if (isset($input['fee_amount']) && is_numeric($input['fee_amount'])) {
-          $contribution->fee_amount = $input['fee_amount'];
+        if ($eventDetail['is_email_confirm']) {
+          // @todo this should be set by the function that sends the mail after sending.
+          $contributionParams['receipt_date'] = $changeDate;
         }
-        $contribution->net_amount = $contribution->total_amount - $contribution->fee_amount;
+        $participantParams['id'] = $participant->id;
+        $participantParams['status_id'] = 'Registered';
+        civicrm_api3('Participant', 'create', $participantParams);
       }
-      if (!empty($input['campaign_id'])) {
-        $contribution->campaign_id = $input['campaign_id'];
-      }
-    }
-
-    $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array(
-      'labelColumn' => 'name',
-      'flip' => 1,
-    ));
-
-    // @todo this section should call the api  in order to have hooks called &
-    // because all this 'messiness' setting variables could be avoided
-    // by letting the api resolve pseudoconstants & copy set values and format dates.
-    $contribution->contribution_status_id = $contributionStatuses['Completed'];
-    $contribution->is_test = $input['is_test'];
-
-    // CRM-15960 If we don't have a value we 'want' for the amounts, leave it to the BAO to sort out.
-    if (isset($input['net_amount'])) {
-      $contribution->fee_amount = CRM_Utils_Array::value('fee_amount', $input, 0);
-    }
-    if (isset($input['net_amount'])) {
-      $contribution->net_amount = $input['net_amount'];
-    }
-
-    $contribution->trxn_id = $input['trxn_id'];
-    $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
-    $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date);
-    $contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date);
-    $contribution->cancel_date = 'null';
-
-    if (!empty($input['check_number'])) {
-      $contribution->check_number = $input['check_number'];
-    }
-
-    if (!empty($input['payment_instrument_id'])) {
-      $contribution->payment_instrument_id = $input['payment_instrument_id'];
     }
 
-    if (!empty($contribution->id)) {
-      $input['prevContribution'] = CRM_Contribute_BAO_Contribution::getValues(array('id' => $contribution->id),
-      CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray);
-    }
+    $contributionParams['id'] = $contribution->id;
 
-    $contribution->save();
+    civicrm_api3('Contribution', 'create', $contributionParams);
 
     // Add new soft credit against current $contribution.
     if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) {
       CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id);
     }
 
-    //add line items for recurring payments
-    if (!empty($contribution->contribution_recur_id)) {
-      if ($isNewContribution) {
-        $input['line_item'] = CRM_Contribute_BAO_ContributionRecur::addRecurLineItems($contribution->contribution_recur_id, $contribution);
-      }
-      else {
-        // this is just to prevent e-notices when we call recordFinancialAccounts - per comments on that line - intention is somewhat unclear
-        $input['line_item'] = array();
-      }
-    }
-
-    //copy initial contribution custom fields for recurring contributions
-    if ($recurContrib && $recurContrib->id) {
-      CRM_Contribute_BAO_ContributionRecur::copyCustomValues($recurContrib->id, $contribution->id);
-    }
-
     $paymentProcessorId = '';
     if (isset($objects['paymentProcessor'])) {
       if (is_array($objects['paymentProcessor'])) {
@@ -4326,7 +4269,7 @@ LIMIT 1;";
     if (!array_key_exists('is_email_receipt', $values) ||
       $values['is_email_receipt'] == 1
     ) {
-      self::sendMail($input, $ids, $objects, $values, $recur, FALSE);
+      self::sendMail($input, $ids, $objects['contribution'], $values, $recur, FALSE);
       CRM_Core_Error::debug_log_message("Receipt sent");
     }
 
@@ -4349,7 +4292,7 @@ LIMIT 1;";
    *   Incoming data from Payment processor.
    * @param array $ids
    *   Related object IDs.
-   * @param $objects
+   * @param CRM_Contribute_BAO_Contribution $contribution
    * @param array $values
    *   Values related to objects that have already been loaded.
    * @param bool $recur
@@ -4360,8 +4303,7 @@ LIMIT 1;";
    *
    * @return array
    */
-  public static function sendMail(&$input, &$ids, &$objects, &$values, $recur = FALSE, $returnMessageText = FALSE) {
-    $contribution = &$objects['contribution'];
+  public static function sendMail(&$input, &$ids, $contribution, &$values, $recur = FALSE, $returnMessageText = FALSE) {
     $input['is_recur'] = $recur;
     // set receipt from e-mail and name in value
     if (!$returnMessageText) {
index 05be49a28bbb931efeffd220653238ad1a4b05c5..e6159b3444ce7e2e026bda02859d80d85b2c777e 100644 (file)
@@ -271,7 +271,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
     );
 
     $this->add('select', 'payment_instrument_id',
-      ts('Paid By'),
+      ts('Payment Method'),
       array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
       TRUE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
     );
@@ -287,7 +287,7 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract
     $this->add('textarea', 'receipt_text', ts('Confirmation Message'));
 
     // add various dates
-    $dateLabel = ($this->_refund) ? ts('Refund Date') : ts('Received Date');
+    $dateLabel = ($this->_refund) ? ts('Refund Date') : ts('Date Received');
     $this->addDateTime('trxn_date', $dateLabel, FALSE, array('formatType' => 'activityDateTime'));
 
     if ($this->_contactId && $this->_id) {
index 9962143750ea8c6541c9baba3f16bb655c0f9410..b7266ae04aaed28506926e33a03ae3e8f92a90ea 100644 (file)
@@ -181,13 +181,6 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
    */
   public $_priceSet;
 
-  /**
-   * Form defaults
-   * @todo can we define this a as protected? can we define higher up the chain
-   * @var array
-   */
-  public $_defaults;
-
   /**
    * User display name
    *
@@ -626,7 +619,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     $paymentInstrument = FALSE;
     if (!$this->_mode) {
       $paymentInstrument = $this->add('select', 'payment_instrument_id',
-        ts('Paid By'),
+        ts('Payment Method'),
         array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
         TRUE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
       );
index a8e4da5e0ded51d0b6aecda104ed9d322777238e..ef5c4b19dfd48e195bd07d02453feae4a0bd48c0 100644 (file)
@@ -1453,47 +1453,43 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
    *   Line items specifically relating to memberships.
    * @param bool $isPayLater
    */
-  public function processMembership($membershipParams, $contactID, $customFieldsFormatted, $fieldTypes, $premiumParams, $membershipLineItems, $isPayLater) {
-    try {
-      $membershipTypeIDs = (array) $membershipParams['selectMembership'];
-      $membershipTypes = CRM_Member_BAO_Membership::buildMembershipTypeValues($this, $membershipTypeIDs);
-      $membershipType = empty($membershipTypes) ? array() : reset($membershipTypes);
-      $isPending = $this->getIsPending();
+  protected function processMembership($membershipParams, $contactID, $customFieldsFormatted, $fieldTypes, $premiumParams,
+                                $membershipLineItems, $isPayLater) {
 
-      $this->assign('membership_name', CRM_Utils_Array::value('name', $membershipType));
+    $membershipTypeIDs = (array) $membershipParams['selectMembership'];
+    $membershipTypes = CRM_Member_BAO_Membership::buildMembershipTypeValues($this, $membershipTypeIDs);
+    $membershipType = empty($membershipTypes) ? array() : reset($membershipTypes);
+    $isPending = $this->getIsPending();
 
-      $isPaidMembership = FALSE;
-      if ($this->_amount >= 0.0 && isset($membershipParams['amount'])) {
-        //amount must be greater than zero for
-        //adding contribution record  to contribution table.
-        //this condition arises when separate membership payment is
-        //enabled and contribution amount is not selected. fix for CRM-3010
-        $isPaidMembership = TRUE;
-      }
-      $isProcessSeparateMembershipTransaction = $this->isSeparateMembershipTransaction($this->_id, $this->_values['amount_block_is_active']);
-
-      if ($this->_values['amount_block_is_active']) {
-        $financialTypeID = $this->_values['financial_type_id'];
-      }
-      else {
-        $financialTypeID = CRM_Utils_Array::value('financial_type_id', $membershipType, CRM_Utils_Array::value('financial_type_id', $membershipParams));
-      }
-
-      if (CRM_Utils_Array::value('membership_source', $this->_params)) {
-        $membershipParams['contribution_source'] = $this->_params['membership_source'];
-      }
+    $this->assign('membership_name', CRM_Utils_Array::value('name', $membershipType));
 
-      $this->postProcessMembership($membershipParams, $contactID,
-        $this, $premiumParams, $customFieldsFormatted, $fieldTypes, $membershipType, $membershipTypeIDs, $isPaidMembership, $this->_membershipId, $isProcessSeparateMembershipTransaction, $financialTypeID,
-        $membershipLineItems, $isPayLater, $isPending);
+    $isPaidMembership = FALSE;
+    if ($this->_amount >= 0.0 && isset($membershipParams['amount'])) {
+      //amount must be greater than zero for
+      //adding contribution record  to contribution table.
+      //this condition arises when separate membership payment is
+      //enabled and contribution amount is not selected. fix for CRM-3010
+      $isPaidMembership = TRUE;
+    }
+    $isProcessSeparateMembershipTransaction = $this->isSeparateMembershipTransaction($this->_id, $this->_values['amount_block_is_active']);
 
-      $this->assign('membership_assign', TRUE);
-      $this->set('membershipTypeID', $membershipParams['selectMembership']);
+    if ($this->_values['amount_block_is_active']) {
+      $financialTypeID = $this->_values['financial_type_id'];
+    }
+    else {
+      $financialTypeID = CRM_Utils_Array::value('financial_type_id', $membershipType, CRM_Utils_Array::value('financial_type_id', $membershipParams));
     }
-    catch (CRM_Core_Exception $e) {
-      CRM_Core_Session::singleton()->setStatus($e->getMessage());
-      CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', "_qf_Main_display=true&qfKey={$this->_params['qfKey']}"));
+
+    if (CRM_Utils_Array::value('membership_source', $this->_params)) {
+      $membershipParams['contribution_source'] = $this->_params['membership_source'];
     }
+
+    $this->postProcessMembership($membershipParams, $contactID,
+      $this, $premiumParams, $customFieldsFormatted, $fieldTypes, $membershipType, $membershipTypeIDs, $isPaidMembership, $this->_membershipId, $isProcessSeparateMembershipTransaction, $financialTypeID,
+      $membershipLineItems, $isPayLater, $isPending);
+
+    $this->assign('membership_assign', TRUE);
+    $this->set('membershipTypeID', $membershipParams['selectMembership']);
   }
 
   /**
@@ -1694,23 +1690,23 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
         $form->postProcessHook();
       }
       $payment = Civi\Payment\System::singleton()->getByProcessor($form->_paymentProcessor);
-      $result = $payment->doPayment($form->_params, 'contribute');
+      $paymentActionResult = $payment->doPayment($form->_params, 'contribute');
 
-      if (CRM_Utils_Array::value('payment_status_id', $result) == 1) {
+      if (CRM_Utils_Array::value('payment_status_id', $paymentActionResult) == 1) {
         // Refer to CRM-16737. Payment processors 'should' return payment_status_id
         // to denote the outcome of the transaction.
         try {
           civicrm_api3('contribution', 'completetransaction', array(
             'id' => $paymentResult['contribution']->id,
-            'trxn_id' => $paymentResult['contribution']->trxn_id,
+            'trxn_id' => CRM_Utils_Array::value('trxn_id', $paymentActionResult, $paymentResult['contribution']->trxn_id),
             'is_transactional' => FALSE,
             'payment_processor_id' => $form->_paymentProcessor['id'],
           ));
         }
         catch (CiviCRM_API3_Exception $e) {
-          // if for any reason it is already completed this will fail - e.g extensions hacking around core not completing transactions prior to CRM-15296
-          // so let's be gentle here
-          CRM_Core_Error::debug_log_message('contribution ' . $membershipContribution->id . ' not completed with trxn_id ' . $membershipContribution->trxn_id . ' and message ' . $e->getMessage());
+          if ($e->getErrorCode() != 'contribution_completed') {
+            throw new CRM_Core_Exception('Failed to update contribution in database');
+          }
         }
       }
       // Do not send an email if Recurring transaction is done via Direct Mode
@@ -2307,12 +2303,21 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       // @todo move premium processing to complete transaction if it truly is an 'after' action.
       $this->postProcessPremium($premiumParams, $result['contribution']);
       if (CRM_Utils_Array::value('payment_status_id', $result) == 1) {
-        civicrm_api3('contribution', 'completetransaction', array(
-          'id' => $result['contribution']->id,
-          'trxn_id' => CRM_Utils_Array::value('trxn_id', $result),
-          'payment_processor_id' => $this->_paymentProcessor['id'],
-          )
-        );
+        try {
+          civicrm_api3('contribution', 'completetransaction', array(
+              'id' => $result['contribution']->id,
+              'trxn_id' => CRM_Utils_Array::value('trxn_id', $result),
+              'payment_processor_id' => $this->_paymentProcessor['id'],
+              'is_transactional' => FALSE,
+            )
+          );
+        }
+        catch (CiviCRM_API3_Exception $e) {
+          if ($e->getErrorCode() != 'contribution_completed') {
+            throw new CRM_Core_Exception('Failed to update contribution in database');
+          }
+        }
+
       }
       return $result;
     }
@@ -2402,7 +2407,13 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
           }
         }
       }
-      $this->processMembership($membershipParams, $contactID, $customFieldsFormatted, $fieldTypes, $premiumParams, $membershipLineItems, $isPayLater);
+      try {
+        $this->processMembership($membershipParams, $contactID, $customFieldsFormatted, $fieldTypes, $premiumParams, $membershipLineItems, $isPayLater);
+      }
+      catch (CRM_Core_Exception $e) {
+        CRM_Core_Session::singleton()->setStatus($e->getMessage());
+        CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contribute/transact', "_qf_Main_display=true&qfKey={$this->_params['qfKey']}"));
+      }
       if (!$this->_amount > 0.0 || !$membershipParams['amount']) {
         // we need to explicitly create a CMS user in case of free memberships
         // since it is done under processConfirm for paid memberships
index 171b2d45b3b9d48c8fe85fb15acf71de9e71b99c..1839304f63c66b31a0cf62f70dc5fecbfdd12df0 100644 (file)
@@ -46,7 +46,6 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
   public $_onBehalfRequired = FALSE;
   public $_onbehalf = FALSE;
   public $_paymentProcessors;
-  protected $_defaults;
 
   public $_membershipTypeValues;
 
index a81bf836b5f7e1710bf45d74dcfe9c94f4bc82eb..c78b12878f76632cb71ac690bddbe09053cce77c 100644 (file)
@@ -88,12 +88,6 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form {
    * @var bool
    */
   protected $_separateMembershipPayment;
-  /**
-   * The default values for the form
-   *
-   * @var array
-   */
-  protected $_defaults;
 
   /**
    * The params submitted by the form and computed by the app
index 138202af734dab781bb8c0f63ea715706dc52b15..0134a1b2f2cb47c39867d6bb4e58820205daccef 100644 (file)
@@ -57,8 +57,6 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_limit = NULL;
 
-  protected $_defaults;
-
   /**
    * Prefix for the controller.
    */
@@ -120,7 +118,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
       );
     }
 
-    $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 1);
+    $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
     $selector = new CRM_Contribute_Selector_Search($this->_queryParams,
       $this->_action,
       NULL,
@@ -309,7 +307,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
       }
     }
 
-    CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
+    CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
 
     $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
 
index 43e7fbfe865b2407c3f54626bac76fcb20acea82..9e73154cfbea49219ce94b8c31babc4935f9503d 100644 (file)
@@ -125,7 +125,7 @@ class CRM_Contribute_Form_Task_PDFLetter extends CRM_Contribute_Form_Task {
       'contribution_recur_id' => ts('Contact and Recurring'),
       'financial_type_id' => ts('Contact and Financial Type'),
       'campaign_id' => ts('Contact and Campaign'),
-      'payment_instrument_id' => 'Contact and Payment Instrument',
+      'payment_instrument_id' => ts('Contact and Payment Method'),
     );
     $this->addElement('select', 'group_by', ts('Group contributions by'), $options, array(), "<br/>", FALSE);
     // this was going to be free-text but I opted for radio options in case there was a script injection risk
index 5d8d4d26a5753f436f56ceec500bcc8df8f3e027..c4bce64643598a9f5c7359994c783106fdfbb91d 100644 (file)
@@ -154,7 +154,7 @@ AND    co.id IN ( $contribIDs )";
       $this->add("text", "check_number_{$row['contribution_id']}", ts('Check Number'));
       $defaults["check_number_{$row['contribution_id']}"] = $dao->check_no;
 
-      $this->add("select", "payment_instrument_id_{$row['contribution_id']}", ts('Paid By'), $paidByOptions);
+      $this->add("select", "payment_instrument_id_{$row['contribution_id']}", ts('Payment Method'), $paidByOptions);
       $defaults["payment_instrument_id_{$row['contribution_id']}"] = $dao->paid_by;
 
       $this->_rows[] = $row;
@@ -203,7 +203,7 @@ AND    co.id IN ( $contribIDs )";
         $contribID = substr($name, 13);
 
         if ($fields["payment_instrument_id_{$contribID}"] != CRM_Core_OptionGroup::getValue('payment_instrument', 'Check', 'name')) {
-          $errors["payment_instrument_id_{$contribID}"] = ts("Paid By should be Check when a check number is entered for a contribution.");
+          $errors["payment_instrument_id_{$contribID}"] = ts("Payment Method should be Check when a check number is entered for a contribution.");
         }
       }
     }
@@ -288,6 +288,7 @@ AND    co.id IN ( $contribIDs )";
       }
       $input['trxn_date'] = CRM_Utils_Date::processDate($params["trxn_date_{$row['contribution_id']}"]);
 
+      // @todo calling baseIPN like this is a pattern in it's last gasps. Call contribute.completetransaction api.
       $baseIPN->completeTransaction($input, $ids, $objects, $transaction, FALSE);
 
       // reset template values before processing next transactions
index ea4f96640adccf53b317aa374895f09c70f9507b..42514f6f613cfc9a4ec09dfc256833bb4c664564 100644 (file)
@@ -540,7 +540,7 @@ class CRM_Contribute_Import_Parser_Contribution extends CRM_Contribute_Import_Pa
         $checkCid->external_identifier = $paramValues['external_identifier'];
         $checkCid->find(TRUE);
         if ($checkCid->id != $formatted['contact_id']) {
-          array_unshift($values, 'Mismatch of External identifier :' . $paramValues['external_identifier'] . ' and Contact Id:' . $formatted['contact_id']);
+          array_unshift($values, 'Mismatch of External ID:' . $paramValues['external_identifier'] . ' and Contact Id:' . $formatted['contact_id']);
           return CRM_Import_Parser::ERROR;
         }
       }
index f366685d8a9c999ff51bf55910f29c9628effa56..ef8694e9d3aa1c5a35a30cb6df262863da880f72 100644 (file)
   </item>
   <item>
     <path>civicrm/admin/options/payment_instrument</path>
-    <title>Payment Instruments</title>
+    <title>Payment Methods</title>
     <page_callback>CRM_Admin_Page_Options</page_callback>
     <desc>You may choose to record the payment instrument used for each contribution. Common payment methods are installed by default (e.g. Check, Cash, Credit Card...). If your site requires additional payment methods, add them here.</desc>
     <adminGroup>CiviContribute</adminGroup>
index 7cd78b62ffdaf9279bc25283e55567768e9faed3..93521754b9c414b2ce155a2c7c8ba6bfb8191269 100644 (file)
@@ -1228,18 +1228,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
         }
 
         $v = array();
-        $p = array();
         foreach ($checkedData as $key => $val) {
-          if ($html_type == 'CheckBox') {
-            if ($val) {
-              $p[] = $key;
-              $v[] = CRM_Utils_Array::value($key, $option);
-            }
-          }
-          else {
-            $p[] = $val;
-            $v[] = CRM_Utils_Array::value($val, $option);
-          }
+          $v[] = CRM_Utils_Array::value($val, $option);
         }
         if (!empty($v)) {
           $display = implode(', ', $v);
index 66ea07484463146978e67388bfc5cadced41b1d1..108e675eeee34bfc9589a0819c9b06c72d252c9e 100644 (file)
@@ -388,6 +388,10 @@ SELECT label, value
           $op = key($value);
           $qillValue = CRM_Core_BAO_CustomField::getDisplayValue($value[$op], $id, $this->_options);
         }
+        else {
+          $qillValue = CRM_Core_BAO_CustomField::getDisplayValue($value, $id, $this->_options);
+          $value = array('IN' => $value);
+        }
 
         $qillOp = CRM_Utils_Array::value($op, CRM_Core_SelectValues::getSearchBuilderOperators(), $op);
 
@@ -419,22 +423,23 @@ SELECT label, value
               if (strstr($op, 'NULL') || strstr($op, 'EMPTY')) {
                 $qillValue = $value = NULL;
               }
-              elseif ($isSerialized && strstr($op, 'IN')) {
+              elseif ($isSerialized) {
+                if (in_array(key($value), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
+                  $op = key($value);
+                  $value = $value[$op];
+                }
                 $value = implode(',', $value);
               }
 
               // CRM-14563,CRM-16575 : Special handling of multi-select custom fields
-              if (!empty($value)) {
-                if ($isSerialized) {
-                  if (strstr($op, 'IN')) {
-                    $value = str_replace(array('(', ')'), '', str_replace(",", "[[:cntrl:]]|[[:cntrl:]]", $value));
-                  }
-                  $op = (strstr($op, '!') || strstr($op, 'NOT')) ? 'NOT RLIKE' : 'RLIKE';
-                  $value = "[[:cntrl:]]" . $value . "[[:cntrl:]]";
+              if ($isSerialized && !empty($value)) {
+                if (strstr($op, 'IN')) {
+                  $value = str_replace(array('(', ')'), '', str_replace(",", "[[:cntrl:]]|[[:cntrl:]]", $value));
                 }
-                elseif ($wildcard) {
-                  $value = "[[:cntrl:]]%$value%[[:cntrl:]]";
-                  $op = 'LIKE';
+                $op = (strstr($op, '!') || strstr($op, 'NOT')) ? 'NOT RLIKE' : 'RLIKE';
+                $value = "[[:cntrl:]]" . $value . "[[:cntrl:]]";
+                if (!$wildcard) {
+                  $value = str_replace("[[:cntrl:]]|", '', $value);
                 }
               }
 
index ab5e404a00cdb35bc21fe48bf4954d826be8cb63..bf23c7477693b8571b4df5f1cd41502ab175a344 100644 (file)
@@ -165,7 +165,7 @@ class CRM_Core_BAO_CustomValue extends CRM_Core_DAO {
    * @param array $formValues
    * @return null
    */
-  public static function fixFieldValueOfTypeMemo(&$formValues) {
+  public static function fixCustomFieldValue(&$formValues) {
     if (empty($formValues)) {
       return NULL;
     }
@@ -180,14 +180,24 @@ class CRM_Core_BAO_CustomValue extends CRM_Core_DAO {
       $htmlType = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_CustomField',
         substr($key, 7), 'html_type'
       );
-      if (($htmlType == 'TextArea') &&
+      $dataType = CRM_Core_DAO::getFieldValue('CRM_Core_BAO_CustomField',
+        substr($key, 7), 'data_type'
+      );
+
+      if (is_array($formValues[$key])) {
+        if (!in_array(key($formValues[$key]), CRM_Core_DAO::acceptedSQLOperators(), TRUE)) {
+          $formValues[$key] = array('IN' => $formValues[$key]);
+        }
+      }
+      elseif (($htmlType == 'TextArea' ||
+          ($htmlType == 'Text' && $dataType == 'String')
+        ) &&
         !((substr($formValues[$key], 0, 1) == '%') ||
           (substr($formValues[$key], -1, 1) == '%')
         )
       ) {
-        $formValues[$key] = '%' . $formValues[$key] . '%';
+        $formValues[$key] = array('LIKE' => '%' . $formValues[$key] . '%');
       }
-
     }
   }
 
index 5b6204053c4ea4753ec6f0a5f9c3ce13b05dd66d..d05d4ff432f03dc9d0bdc5a29145a57d6d63ab25 100644 (file)
@@ -1137,11 +1137,11 @@ SELECT  id
         ),
         'receive_date' => array(
           'name' => 'receive_date',
-          'title' => ts('Receive Date'),
+          'title' => ts('Date Received'),
         ),
         'payment_instrument' => array(
           'name' => 'payment_instrument',
-          'title' => ts('Payment Instrument'),
+          'title' => ts('Payment Method'),
         ),
         'contribution_status_id' => array(
           'name' => 'contribution_status_id',
index 0f42416532ec4f5d41fb95a9a35bfec65078202d..9fe861ccbb1d62f63c3fd44390193a9787f9a042 100644 (file)
@@ -459,7 +459,7 @@ class CRM_Core_Block {
       $value['url'] = CRM_Utils_System::url($short['path'], $short['query'], FALSE);
     }
     $value['title'] = $short['title'];
-    $value['ref'] = $short['ref'];
+    $value['ref'] = isset($short['ref']) ? $short['ref'] : '';
     if (!empty($short['shortCuts'])) {
       foreach ($short['shortCuts'] as $shortCut) {
         $value['shortCuts'][] = self::setShortcutValues($shortCut);
index c085183bdbe92a52304e9e978137f4823d49303a..4b437735718243fd01cc8fc0513bb344046d68b0 100644 (file)
@@ -692,13 +692,13 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    */
   public function setWord($fileName = NULL) {
     //Mark as a CSV file.
-    header('Content-Type: application/vnd.ms-word');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/vnd.ms-word');
 
     //Force a download and name the file using the current timestamp.
     if (!$fileName) {
       $fileName = 'Contacts_' . $_SERVER['REQUEST_TIME'] . '.doc';
     }
-    header("Content-Disposition: attachment; filename=Contacts_$fileName");
+    CRM_Utils_System::setHttpHeader("Content-Disposition", "attachment; filename=Contacts_$fileName");
   }
 
   /**
@@ -706,14 +706,14 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
    */
   public function setExcel($fileName = NULL) {
     //Mark as an excel file.
-    header('Content-Type: application/vnd.ms-excel');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/vnd.ms-excel');
 
     //Force a download and name the file using the current timestamp.
     if (!$fileName) {
       $fileName = 'Contacts_' . $_SERVER['REQUEST_TIME'] . '.xls';
     }
 
-    header("Content-Disposition: attachment; filename=Contacts_$fileName");
+    CRM_Utils_System::setHttpHeader("Content-Disposition", "attachment; filename=Contacts_$fileName");
   }
 
   /**
@@ -858,18 +858,25 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller {
   }
 
   /**
-   * Instead of outputting a fatal error message, we'll just redirect to the entryURL if present
+   * Instead of outputting a fatal error message, we'll just redirect
+   * to the entryURL if present
    *
    * @return void
    */
   public function invalidKeyRedirect() {
-    if ($this->_entryURL) {
-      CRM_Core_Session::setStatus(ts('Your browser session has expired and we are unable to complete your form submission. We have returned you to the initial step so you can complete and resubmit the form. If you experience continued difficulties, please contact us for assistance.'));
-      return CRM_Utils_System::redirect($this->_entryURL);
-    }
-    else {
-      self::invalidKeyCommon();
+    if ($this->_entryURL && $url_parts = parse_url($this->_entryURL)) {
+      // CRM-16832: Ensure local redirects only.
+      if (!empty($url_parts['path'])) {
+        // Prepend a slash, but don't duplicate it.
+        $redirect_url = '/' . ltrim($url_parts['path'], '/');
+        if (!empty($url_parts['query'])) {
+          $redirect_url .= '?' . $url_parts['query'];
+        }
+        CRM_Core_Session::setStatus(ts('Your browser session has expired and we are unable to complete your form submission. We have returned you to the initial step so you can complete and resubmit the form. If you experience continued difficulties, please contact us for assistance.'));
+        return CRM_Utils_System::redirect($redirect_url);
+      }
     }
+    self::invalidKeyCommon();
   }
 
 }
index 98b3cb6c46e74ed7cd790d7185c90bd03f2f56e1..c572b9e68170dc196079edf19ac9c6a81ccc69ff 100644 (file)
@@ -95,6 +95,16 @@ function _civicrm_api3_permissions($entity, $action, &$params) {
     ),
   );
 
+  // CRM-16963 - Permissions for country.
+  $permissions['country'] = array(
+    'get' => array(
+      'access CiviCRM',
+    ),
+    'default' => array(
+      'administer CiviCRM',
+    ),
+  );
+
   // Contact-related data permissions.
   // CRM-14094 - Users can edit and delete contact-related objects using inline edit with 'edit all contacts' permission
   $permissions['address'] = array(
@@ -131,7 +141,7 @@ function _civicrm_api3_permissions($entity, $action, &$params) {
     ),
     'delete' => array(
       'access CiviCRM',
-      'delete contacts',
+      'edit all contacts',
     ),
     'default' => array(
       'access CiviCRM',
index 550f0da54b17eab30574ccd8bb34e088c2e0831f..ea8615f5c36c6a1074131199f2131ce52063ddcd 100644 (file)
@@ -61,6 +61,13 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    */
   protected $_title = NULL;
 
+  /**
+   * The default values for the form.
+   *
+   * @var array
+   */
+  public $_defaults = array();
+
   /**
    * The options passed into this form
    * @var mixed
@@ -1195,7 +1202,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       $options = $props['options'];
     }
     else {
-      $info = civicrm_api3($props['entity'], 'getoptions', $props + array('check_permissions' => 1));
+      $info = civicrm_api3($props['entity'], 'getoptions', $props);
       $options = $info['values'];
     }
     if (!array_key_exists('placeholder', $props)) {
@@ -1861,7 +1868,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
    *
    * @return NULL|int
    */
-  public function getContactID() {
+  protected function setContactID() {
     $tempID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
     if (isset($this->_params) && isset($this->_params['select_contact_id'])) {
       $tempID = $this->_params['select_contact_id'];
@@ -1904,6 +1911,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     return is_numeric($userID) ? $userID : NULL;
   }
 
+  public function getContactID() {
+    return $this->setContactID();
+  }
+
   /**
    * Get the contact id of the logged in user.
    */
diff --git a/CRM/Core/I18n/SchemaStructure_4_7_alpha1.php b/CRM/Core/I18n/SchemaStructure_4_7_alpha1.php
new file mode 100644 (file)
index 0000000..7fd59b6
--- /dev/null
@@ -0,0 +1,256 @@
+<?php
+/*
++--------------------------------------------------------------------+
+| CiviCRM version 4.6                                                |
++--------------------------------------------------------------------+
+| Copyright CiviCRM LLC (c) 2004-2015                                |
++--------------------------------------------------------------------+
+| This file is a part of CiviCRM.                                    |
+|                                                                    |
+| CiviCRM is free software; you can copy, modify, and distribute it  |
+| under the terms of the GNU Affero General Public License           |
+| Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+|                                                                    |
+| CiviCRM is distributed in the hope that it will be useful, but     |
+| WITHOUT ANY WARRANTY; without even the implied warranty of         |
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+| See the GNU Affero General Public License for more details.        |
+|                                                                    |
+| You should have received a copy of the GNU Affero General Public   |
+| License and the CiviCRM Licensing Exception along                  |
+| with this program; if not, contact CiviCRM LLC                     |
+| at info[AT]civicrm[DOT]org. If you have questions about the        |
+| GNU Affero General Public License or the licensing of CiviCRM,     |
+| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
++--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CRM
+ * @copyright CiviCRM LLC (c) 2004-2015
+ *
+ * Generated from schema_structure.tpl
+ * DO NOT EDIT.  Generated by CRM_Core_CodeGen
+ */
+class CRM_Core_I18n_SchemaStructure_4_7_alpha1 {
+
+  /**
+   * Get column definition.
+   */
+  public static function &columns() {
+    static $result = NULL;
+    if (!$result) {
+      $result = array(
+        'civicrm_location_type' => array(
+          'display_name' => "varchar(64)",
+        ),
+        'civicrm_option_group' => array(
+          'title' => "varchar(255)",
+          'description' => "varchar(255)",
+        ),
+        'civicrm_contact_type' => array(
+          'label' => "varchar(64)",
+          'description' => "text",
+        ),
+        'civicrm_batch' => array(
+          'title' => "varchar(64)",
+          'description' => "text",
+        ),
+        'civicrm_premiums' => array(
+          'premiums_intro_title' => "varchar(255)",
+          'premiums_intro_text' => "text",
+          'premiums_nothankyou_label' => "varchar(255)",
+        ),
+        'civicrm_membership_status' => array(
+          'label' => "varchar(128)",
+        ),
+        'civicrm_survey' => array(
+          'title' => "varchar(255)",
+          'instructions' => "text",
+          'thankyou_title' => "varchar(255)",
+          'thankyou_text' => "text",
+        ),
+        'civicrm_participant_status_type' => array(
+          'label' => "varchar(255)",
+        ),
+        'civicrm_case_type' => array(
+          'title' => "varchar(64)",
+          'description' => "varchar(255)",
+        ),
+        'civicrm_tell_friend' => array(
+          'title' => "varchar(255)",
+          'intro' => "text",
+          'suggested_message' => "text",
+          'thankyou_title' => "varchar(255)",
+          'thankyou_text' => "text",
+        ),
+        'civicrm_custom_group' => array(
+          'title' => "varchar(64)",
+          'help_pre' => "text",
+          'help_post' => "text",
+        ),
+        'civicrm_custom_field' => array(
+          'label' => "varchar(255)",
+          'help_pre' => "text",
+          'help_post' => "text",
+        ),
+        'civicrm_option_value' => array(
+          'label' => "varchar(255)",
+          'description' => "text",
+        ),
+        'civicrm_group' => array(
+          'title' => "varchar(64)",
+        ),
+        'civicrm_contribution_page' => array(
+          'title' => "varchar(255)",
+          'intro_text' => "text",
+          'pay_later_text' => "text",
+          'pay_later_receipt' => "text",
+          'initial_amount_label' => "varchar(255)",
+          'initial_amount_help_text' => "text",
+          'thankyou_title' => "varchar(255)",
+          'thankyou_text' => "text",
+          'thankyou_footer' => "text",
+          'for_organization' => "text",
+          'receipt_from_name' => "varchar(255)",
+          'receipt_text' => "text",
+          'footer_text' => "text",
+        ),
+        'civicrm_product' => array(
+          'name' => "varchar(255)",
+          'description' => "text",
+          'options' => "text",
+        ),
+        'civicrm_membership_type' => array(
+          'name' => "varchar(128)",
+          'description' => "varchar(255)",
+        ),
+        'civicrm_membership_block' => array(
+          'new_title' => "varchar(255)",
+          'new_text' => "text",
+          'renewal_title' => "varchar(255)",
+          'renewal_text' => "text",
+        ),
+        'civicrm_price_set' => array(
+          'title' => "varchar(255)",
+          'help_pre' => "text",
+          'help_post' => "text",
+        ),
+        'civicrm_dashboard' => array(
+          'label' => "varchar(255)",
+        ),
+        'civicrm_uf_group' => array(
+          'title' => "varchar(64)",
+          'help_pre' => "text",
+          'help_post' => "text",
+        ),
+        'civicrm_uf_field' => array(
+          'help_post' => "text",
+          'help_pre' => "text",
+          'label' => "varchar(255)",
+        ),
+        'civicrm_price_field' => array(
+          'label' => "varchar(255)",
+          'help_pre' => "text",
+          'help_post' => "text",
+        ),
+        'civicrm_price_field_value' => array(
+          'label' => "varchar(255)",
+          'description' => "text",
+        ),
+        'civicrm_pcp_block' => array(
+          'link_text' => "varchar(255)",
+        ),
+        'civicrm_event' => array(
+          'title' => "varchar(255)",
+          'summary' => "text",
+          'description' => "text",
+          'registration_link_text' => "varchar(255)",
+          'event_full_text' => "text",
+          'fee_label' => "varchar(255)",
+          'intro_text' => "text",
+          'footer_text' => "text",
+          'confirm_title' => "varchar(255)",
+          'confirm_text' => "text",
+          'confirm_footer_text' => "text",
+          'confirm_email_text' => "text",
+          'confirm_from_name' => "varchar(255)",
+          'thankyou_title' => "varchar(255)",
+          'thankyou_text' => "text",
+          'thankyou_footer_text' => "text",
+          'pay_later_text' => "text",
+          'pay_later_receipt' => "text",
+          'initial_amount_label' => "varchar(255)",
+          'initial_amount_help_text' => "text",
+          'waitlist_text' => "text",
+          'approval_req_text' => "text",
+          'template_title' => "varchar(255)",
+        ),
+        'civicrm_relationship_type' => array(
+          'label_a_b' => "varchar(64)",
+          'label_b_a' => "varchar(64)",
+          'description' => "varchar(255)",
+        ),
+      );
+    }
+    return $result;
+  }
+
+  /**
+   * Get indices.
+   *
+   * @return array
+   */
+  public static function &indices() {
+    static $result = NULL;
+    if (!$result) {
+      $result = array(
+        'civicrm_custom_group' => array(
+          'UI_title_extends' => array(
+            'name' => 'UI_title_extends',
+            'field' => array(
+              'title',
+              'extends',
+            ),
+            'unique' => 1,
+          ),
+        ),
+        'civicrm_custom_field' => array(
+          'UI_label_custom_group_id' => array(
+            'name' => 'UI_label_custom_group_id',
+            'field' => array(
+              'label',
+              'custom_group_id',
+            ),
+            'unique' => 1,
+          ),
+        ),
+        'civicrm_group' => array(
+          'UI_title' => array(
+            'name' => 'UI_title',
+            'field' => array(
+              'title',
+            ),
+            'unique' => 1,
+          ),
+        ),
+      );
+    }
+    return $result;
+  }
+
+  /**
+   * Get tables.
+   *
+   * @return array
+   */
+  public static function &tables() {
+    static $result = NULL;
+    if (!$result) {
+      $result = array_keys(self::columns());
+    }
+    return $result;
+  }
+
+}
index 82c40570e70b63cc3baeb026662669062474415e..1039faab0ae1783f2c8d72f93e5bd9853902627f 100644 (file)
@@ -291,7 +291,7 @@ class CRM_Core_OptionValue {
         $nameTitle = array(
           'payment_instrument' => array(
             'name' => 'payment_instrument',
-            'title' => ts('Payment Instrument'),
+            'title' => ts('Payment Method'),
             'headerPattern' => '/^payment|(p(ayment\s)?instrument)$/i',
           ),
         );
index 7d6604ea832f44e703bf9c435ca8cc38e5d61874..a510c94a55b627b489a865926d427520bf12fe83 100644 (file)
@@ -189,7 +189,7 @@ class CRM_Core_Page_AJAX {
 
     // CRM-11831 @see http://www.malsup.com/jquery/form/#file-upload
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
-      header('Content-Type: application/json');
+      CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     }
     else {
       $output = "<textarea>$output</textarea>";
@@ -209,9 +209,9 @@ class CRM_Core_Page_AJAX {
       // Encourage browsers to cache for a long time - 1 year
       $ttl = 60 * 60 * 24 * 364;
     }
-    header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + $ttl));
-    header('Content-Type:      application/javascript');
-    header("Cache-Control: max-age=$ttl, public");
+    CRM_Utils_System::setHttpHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + $ttl));
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/javascript');
+    CRM_Utils_System::setHttpHeader('Cache-Control', "max-age=$ttl, public");
   }
 
 }
index 7aaf3cd5d899e2dc9909c30f47a9d830805966d9..d043a5f43b3de6947108614a452c94476cc0b806 100644 (file)
@@ -135,7 +135,7 @@ class CRM_Core_Page_AJAX_Attachment {
     if ($isError) {
       $sapi_type = php_sapi_name();
       if (substr($sapi_type, 0, 3) == 'cgi') {
-        header("Status: 500 Internal Server Error");
+        CRM_Utils_System::setHttpHeader("Status", "500 Internal Server Error");
       }
       else {
         header("HTTP/1.1 500 Internal Server Error");
index 9192b867d68ab694f4864e666376f399af7253de..3d4ec6e8df55b152b073c641fe0f80eeb92218a0 100644 (file)
@@ -39,8 +39,22 @@ class CRM_Core_Payment_BaseIPN {
    */
   protected $_inputParameters = array();
 
+  /**
+   * Only used by AuthorizeNetIPN.
+   *
+   * @deprecated
+   *
+   * @var bool
+   */
   protected $_isRecurring = FALSE;
 
+  /**
+   * Only used by AuthorizeNetIPN.
+   *
+   * @deprecated
+   *
+   * @var bool
+   */
   protected $_isFirstOrLastRecurringPayment = FALSE;
 
   /**
@@ -158,7 +172,10 @@ class CRM_Core_Payment_BaseIPN {
       $objects['contribution'] = &$contribution;
     }
     try {
-      $success = $contribution->loadRelatedObjects($input, $ids, $required);
+      $success = $contribution->loadRelatedObjects($input, $ids);
+      if ($required && empty($contribution->_relatedObjects['paymentProcessor'])) {
+        throw new CRM_Core_Exception("Could not find payment processor for contribution record: " . $contribution->id);
+      }
     }
     catch (Exception $e) {
       $success = FALSE;
@@ -227,7 +244,7 @@ class CRM_Core_Payment_BaseIPN {
       CRM_Contribute_BAO_ContributionRecur::copyCustomValues($objects['contributionRecur']->id, $contribution->id);
     }
 
-    if (empty($input['skipComponentSync'])) {
+    if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) {
       if (!empty($memberships)) {
         // if transaction is failed then set "Cancelled" as membership status
         $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', array(
@@ -322,7 +339,7 @@ class CRM_Core_Payment_BaseIPN {
       CRM_Contribute_BAO_ContributionRecur::copyCustomValues($objects['contributionRecur']->id, $contribution->id);
     }
 
-    if (empty($input['skipComponentSync'])) {
+    if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) {
       if (!empty($memberships)) {
         $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', array(
             'labelColumn' => 'name',
@@ -477,7 +494,8 @@ class CRM_Core_Payment_BaseIPN {
    * @return array
    */
   public function sendMail(&$input, &$ids, &$objects, &$values, $recur = FALSE, $returnMessageText = FALSE) {
-    return CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $objects, $values, $recur, $returnMessageText);
+    return CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $objects['contribution'], $values, $recur,
+      $returnMessageText);
   }
 
 }
index 6ece599a74700549d46b1901fad253f5c22413a1..a39aa22f1e1954df2ed1907ded423cd00adce4ff 100644 (file)
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Core_Payment_Form {
 
 
   /**
-   * Add payment fields depending on payment processor. The payment processor can implement the following functions to override the built in fields.
+   * Add payment fields depending on payment processor.
+   *
+   * The payment processor can implement the following functions to override the built in fields.
    *
    *  - getPaymentFormFields()
    *  - getPaymentFormFieldsMetadata()
@@ -349,6 +349,30 @@ class CRM_Core_Payment_Form {
     return $creditCardTypes;
   }
 
+  /**
+   * Set default values for the form.
+   *
+   * @param CRM_Core_Form $form
+   * @param int $contactID
+   */
+  public static function setDefaultValues(&$form, $contactID) {
+    $billingDefaults = $form->getProfileDefaults('Billing', $contactID);
+    $form->_defaults = array_merge($form->_defaults, $billingDefaults);
+
+    // set default country & state from config if no country set
+    // note the effect of this is to set the billing country to default to the site default
+    // country if the person has an address but no country (for anonymous country is set above)
+    // this could have implications if the billing profile is filled but hidden.
+    // this behaviour has been in place for a while but the use of js to hide things has increased
+    if (empty($form->_defaults["billing_country_id-{$form->_bltID}"])) {
+      $form->_defaults["billing_country_id-{$form->_bltID}"] = CRM_Core_Config::singleton()->defaultContactCountry;
+    }
+    if (empty($form->_defaults["billing_state_province_id-{$form->_bltID}"])) {
+      $form->_defaults["billing_state_province_id-{$form->_bltID}"] = CRM_Core_Config::singleton()
+        ->defaultContactStateProvince;
+    }
+  }
+
   /**
    * Make sure that credit card number and cvv are valid.
    * Called within the scope of a QF formRule function
index 68a4b168d2ed588baecfcda90a1425babbd22819..7a6f58e0381db703828c92303a2a49925ae5d15f 100644 (file)
@@ -936,6 +936,21 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment {
     return $result;
   }
 
+  /**
+   * Get array of fields that should be displayed on the payment form.
+   *
+   * @return array
+   * @throws CiviCRM_API3_Exception
+   */
+  public function getPaymentFormFields() {
+    if ($this->_processorName == ts('PayPal Pro')) {
+      return $this->getCreditCardFormFields();
+    }
+    else {
+      return array();
+    }
+  }
+
   /**
    * Map the paypal params to CiviCRM params using a field map.
    *
index cd1c2a6cf53a0e19bdfef047a45757b373a2502c..0cd114e3b027fb3cc43cdcd71988d0771e5d50d7 100644 (file)
@@ -520,7 +520,7 @@ INNER JOIN civicrm_membership_payment mp ON m.id = mp.membership_id AND mp.contr
     $input['fee_amount'] = self::retrieve('mc_fee', 'Money', 'POST', FALSE);
     $input['net_amount'] = self::retrieve('settle_amount', 'Money', 'POST', FALSE);
     $input['trxn_id'] = self::retrieve('txn_id', 'String', 'POST', FALSE);
-    $input['payment_date'] = self::retrieve('payment_date', 'String', 'POST', FALSE);
+    $input['payment_date'] = $input['receive_date'] = self::retrieve('payment_date', 'String', 'POST', FALSE);
   }
 
   /**
index e422547419b3e99b7e9b212affa459593cfee42b..44eca40ccdbaa10e6b3fee4d9c11a33ef4081ace 100644 (file)
@@ -582,7 +582,7 @@ class CRM_Core_Resources {
 
       // Add resources from coreResourceList
       $jsWeight = -9999;
-      foreach ($this->coreResourceList() as $item) {
+      foreach ($this->coreResourceList($region) as $item) {
         if (is_array($item)) {
           $this->addSetting($item);
         }
@@ -685,9 +685,10 @@ class CRM_Core_Resources {
    *
    * Note: non-compressed versions of .min files will be used in debug mode
    *
+   * @param string $region
    * @return array
    */
-  public function coreResourceList() {
+  public function coreResourceList($region) {
     $config = CRM_Core_Config::singleton();
 
     // Scripts needed by everyone, everywhere
@@ -756,8 +757,8 @@ class CRM_Core_Resources {
       }
     }
 
-    // CMS-specific resources
-    $config->userSystem->appendCoreResources($items);
+    // Allow hooks to modify this list
+    CRM_Utils_Hook::coreResourceList($items, $region);
 
     return $items;
   }
index 6c2a9fb5380b6b31f038754d1667856b2660497a..506fce1804717b7e847fc699da3d73592e79cecf 100644 (file)
@@ -553,8 +553,8 @@ class CRM_Core_SelectValues {
       '{contribution.fee_amount}' => ts('Fee Amount'),
       '{contribution.net_amount}' => ts('Net Amount'),
       '{contribution.non_deductible_amount}' => ts('Non-deductible Amount'),
-      '{contribution.receive_date}' => ts('Contribution Receive Date'),
-      '{contribution.payment_instrument}' => ts('Payment Instrument'),
+      '{contribution.receive_date}' => ts('Contribution Date Received'),
+      '{contribution.payment_instrument}' => ts('Payment Method'),
       '{contribution.trxn_id}' => ts('Transaction ID'),
       '{contribution.invoice_id}' => ts('Invoice ID'),
       '{contribution.currency}' => ts('Currency'),
index 46f3a1c0f0f6487c6c481c0c6308d50108696dfd..62879af0e8a3419e40b691c62e9450307e69310b 100644 (file)
@@ -59,13 +59,6 @@ class CRM_Custom_Form_Group extends CRM_Core_Form {
    */
   protected $_subtypes = array();
 
-  /**
-   * Array of default params.
-   *
-   * @var array
-   */
-  protected $_defaults = array();
-
   /**
    * Set variables up before form is built.
    *
index b4bc680cb04dab4ed46c3ad98a640e70a509c134..eabe16f097f1ec00e46ef4abb7fe1307949e2257 100644 (file)
@@ -62,7 +62,7 @@ class CRM_Custom_Page_AJAX {
       'class',
     );
 
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($options, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
   }
index 8566e7a18344904072fd4fd2c95875ece70b70ad..119164cbbb178b02317546519464ca20059bfadd 100644 (file)
@@ -1315,7 +1315,7 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
           }
 
           // overwrite - need to delete block which belongs to main-contact.
-          if ($mainBlockId && ($operation == 2)) {
+          if (isset($mainBlockId) && $mainBlockId && ($operation == 2)) {
             $deleteDAO = new $daoName();
             $deleteDAO->id = $mainBlockId;
             $deleteDAO->find(TRUE);
index ccb51a9d65cdf78d3f69b5a7ec6f8658805170cc..404d9045f2743b3d7f94d1d33db74c6750887f33 100644 (file)
@@ -1176,7 +1176,7 @@ WHERE civicrm_event.is_active = 1
         // CRM-13890 : NOTE wait list condition need to be given so that
         // wait list message is shown properly in email i.e. WRT online event registration template
         if (empty($tplParams['participant_status']) && empty($values['params']['isOnWaitlist'])) {
-          $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $participantId, 'status_id', 'id');
+          $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $participantId, 'status_id', 'id', TRUE);
           $tplParams['participant_status'] = CRM_Event_PseudoConstant::participantStatus($statusId, NULL, 'label');
         }
         //CRM-15754 - if participant_status contains status ID
index 389f25de578c55b947a360a242fdec45c3d1597e..b0e7d66a16485cac8b0b4b3514a0dda003aa507b 100644 (file)
@@ -426,7 +426,7 @@ SELECT  id, html_type
         $form->addDateTime('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDateTime'));
 
         $form->add('select', 'payment_instrument_id',
-          ts('Paid By'),
+          ts('Payment Method'),
           array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
           FALSE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
         );
index a3ef71f36bebd8b1ba10bac16b106bc8d4685fc7..898b81f0a6bf235b9362cf431ca5cbfc8ff3109a 100644 (file)
@@ -814,7 +814,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment
         $errorMsg['financial_type_id'] = ts('Please enter the associated Financial Type');
       }
       if (empty($values['payment_instrument_id'])) {
-        $errorMsg['payment_instrument_id'] = ts('Paid By is a required field.');
+        $errorMsg['payment_instrument_id'] = ts('Payment Method is a required field.');
       }
     }
 
index 5c46aa8d0d285e5afffe165a9b21fdbe9cf8edc2..3cf1821f0c1ea0fe04390de821ee5726b7a36ade 100644 (file)
  */
 class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_Registration {
 
-  /**
-   * The defaults involved in this page.
-   */
-  public $_defaults = array();
-
   /**
    * Pre-registered additional participant id.
    */
index f4a7c8baa266943c4c33aeb430c2462f7fa8fc31..8900cdb6624cef31b4fdfd0814a7aec6b4c396e1 100644 (file)
@@ -30,8 +30,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -45,11 +43,6 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
    */
   public $_fields;
 
-  /**
-   * The defaults involved in this page.
-   */
-  public $_defaults;
-
   /**
    * The status message that user view.
    */
@@ -123,38 +116,12 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration {
   }
 
   /**
-   * Set default values for the form. For edit/view mode
-   * the default values are retrieved from the database
-   * Adding discussion from CRM-11915 as code comments
-   * When multiple payment processors are configured for a event and user does any selection changes for them on online event registeration page :
-   * The 'Register' page gets loaded through ajax and following happens :
-   * the setDefaults function is called with the variable _ppType set with selected payment processor type,
-   * so in the 'if' condition checked whether the selected payment processor's billing mode is of 'billing form mode'. If its not, don't setDefaults for billing form and return instead.
-   * - For payment processors of billing mode 'Notify' - return from setDefaults before the code for billing profile population execution .
-   * (done this is because for payment processors with 'Notify' mode billing profile form doesn't get rendered on UI)
-   *
-   * @return void
+   * Set default values for the form.
    */
   public function setDefaultValues() {
     $this->_defaults = array();
     $contactID = $this->getContactID();
-    $billingDefaults = $this->getProfileDefaults('Billing', $contactID);
-    $this->_defaults = array_merge($this->_defaults, $billingDefaults);
-
-    $config = CRM_Core_Config::singleton();
-    // set default country from config if no country set
-    // note the effect of this is to set the billing country to default to the site default
-    // country if the person has an address but no country (for anonymous country is set above)
-    // this could have implications if the billing profile is filled but hidden.
-    // this behaviour has been in place for a while but the use of js to hide things has increased
-    if (empty($this->_defaults["billing_country_id-{$this->_bltID}"])) {
-      $this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
-    }
-
-    // set default state/province from config if no state/province set
-    if (empty($this->_defaults["billing_state_province_id-{$this->_bltID}"])) {
-      $this->_defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
-    }
+    CRM_Core_Payment_Form::setDefaultValues($this, $contactID);
 
     if ($contactID) {
       $fields = array();
index 0834673f1b06110fdff84c57cc1dce19f9279a05..45b6b0259d23a05993f84cd847ddd7249ea54ebc 100644 (file)
@@ -68,8 +68,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_prefix = "event_";
 
-  protected $_defaults;
-
   /**
    * The saved search ID retrieved from the GET vars.
    *
@@ -284,7 +282,7 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search {
       $this->_formValues["participant_test"] = 0;
     }
 
-    CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
+    CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
 
     $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
 
index cd248ba4a56e4cfaa2771b3bf21a7d383d480d9f..bb0c5900a54e634273de8093a0f12d61a9f18cc7 100644 (file)
@@ -383,7 +383,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task {
       'componentName' => 'Event',
       'contribution_id' => $contributionId,
       'contribution_status_id' => $contributionStatusId,
-      'skipComponentSync' => 1,
+      'IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved' => 1,
     );
 
     //change related contribution status.
@@ -463,7 +463,7 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task {
       'labelColumn' => 'name',
       'flip' => 1,
     ));
-    $input['skipComponentSync'] = CRM_Utils_Array::value('skipComponentSync', $params);
+    $input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'] = CRM_Utils_Array::value('IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved', $params);
     if ($statusId == $contributionStatuses['Cancelled']) {
       $baseIPN->cancelled($objects, $transaction, $input);
       $transaction->commit();
index 8d72d37ddce8d3c409b04e3dfee549b2ea258e7c..02fdeb1bde8bded0c7d8af0118cf3b25060c2913 100644 (file)
@@ -453,7 +453,7 @@ class CRM_Event_Import_Parser_Participant extends CRM_Event_Import_Parser {
         $checkCid->external_identifier = $formatValues['external_identifier'];
         $checkCid->find(TRUE);
         if ($checkCid->id != $formatted['contact_id']) {
-          array_unshift($values, 'Mismatch of External identifier :' . $formatValues['external_identifier'] . ' and Contact Id:' . $formatted['contact_id']);
+          array_unshift($values, 'Mismatch of External ID:' . $formatValues['external_identifier'] . ' and Contact Id:' . $formatted['contact_id']);
           return CRM_Import_Parser::ERROR;
         }
       }
index 41c83b3081b817db9065c4e6dbd8df8fe7b6017b..c560444b4b537e2210255228f713ae48059b0fd3 100644 (file)
@@ -1251,11 +1251,11 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
         $errorFileName = $parserName::errorFileName($type);
         $saveFileName = $parserName::saveFileName($type);
         if (!empty($errorFileName) && !empty($saveFileName)) {
-          header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-          header('Content-Description: File Transfer');
-          header('Content-Type: text/csv');
-          header('Content-Length: ' . filesize($errorFileName));
-          header('Content-Disposition: attachment; filename=' . $saveFileName);
+          CRM_Utils_System::setHttpHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0');
+          CRM_Utils_System::setHttpHeader('Content-Description', 'File Transfer');
+          CRM_Utils_System::setHttpHeader('Content-Type', 'text/csv');
+          CRM_Utils_System::setHttpHeader('Content-Length', filesize($errorFileName));
+          CRM_Utils_System::setHttpHeader('Content-Disposition', 'attachment; filename=' . $saveFileName);
 
           readfile($errorFileName);
         }
@@ -2038,8 +2038,8 @@ WHERE  {$whereClause}";
       $componentPaymentFields = array(
         'componentPaymentField_total_amount' => ts('Total Amount'),
         'componentPaymentField_contribution_status' => ts('Contribution Status'),
-        'componentPaymentField_received_date' => ts('Received Date'),
-        'componentPaymentField_payment_instrument' => ts('Payment Instrument'),
+        'componentPaymentField_received_date' => ts('Date Received'),
+        'componentPaymentField_payment_instrument' => ts('Payment Method'),
         'componentPaymentField_transaction_id' => ts('Transaction ID'),
       );
     }
index 7b1e0cb33278c2a9dd86e9d50515215442f3dbd7..e0ffac1bbcb2ffdf28c5d6d7165768df898925a9 100644 (file)
@@ -155,9 +155,9 @@ class CRM_Financial_BAO_ExportFormat {
       $zip = $config->customFileUploadDir . 'Financial_Transactions_' . date('YmdHis') . '.zip';
       $result = $this->createZip($this->_downloadFile, $zip, TRUE);
       if ($result) {
-        header('Content-Type: application/zip');
-        header('Content-Disposition: attachment; filename=' . CRM_Utils_File::cleanFileName(basename($zip)));
-        header('Content-Length: ' . filesize($zip));
+        CRM_Utils_System::setHttpHeader('Content-Type', 'application/zip');
+        CRM_Utils_System::setHttpHeader('Content-Disposition', 'attachment; filename=' . CRM_Utils_File::cleanFileName(basename($zip)));
+        CRM_Utils_System::setHttpHeader('Content-Length', '' . filesize($zip));
         ob_clean();
         flush();
         readfile($config->customFileUploadDir . CRM_Utils_File::cleanFileName(basename($zip)));
@@ -166,9 +166,9 @@ class CRM_Financial_BAO_ExportFormat {
       }
     }
     else {
-      header('Content-Type: text/plain');
-      header('Content-Disposition: attachment; filename=' . CRM_Utils_File::cleanFileName(basename($this->_downloadFile[0])));
-      header('Content-Length: ' . filesize($this->_downloadFile[0]));
+      CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain');
+      CRM_Utils_System::setHttpHeader('Content-Disposition', 'attachment; filename=' . CRM_Utils_File::cleanFileName(basename($this->_downloadFile[0])));
+      CRM_Utils_System::setHttpHeader('Content-Length', '' . filesize($this->_downloadFile[0]));
       ob_clean();
       flush();
       readfile($config->customFileUploadDir . CRM_Utils_File::cleanFileName(basename($this->_downloadFile[0])));
@@ -195,7 +195,7 @@ class CRM_Financial_BAO_ExportFormat {
       $paymentInstrument = array_flip(CRM_Contribute_PseudoConstant::paymentInstrument('label'));
       $values['payment_instrument_id'] = array_search($values['payment_instrument_id'], $paymentInstrument);
     }
-    $details = '<p>' . ts('Record:') . ' ' . $values['title'] . '</p><p>' . ts('Description:') . '</p><p>' . ts('Created By:') . " $createdBy" . '</p><p>' . ts('Created Date:') . ' ' . $values['created_date'] . '</p><p>' . ts('Last Modified By:') . ' ' . $modifiedBy . '</p><p>' . ts('Payment Instrument:') . ' ' . $values['payment_instrument_id'] . '</p>';
+    $details = '<p>' . ts('Record:') . ' ' . $values['title'] . '</p><p>' . ts('Description:') . '</p><p>' . ts('Created By:') . " $createdBy" . '</p><p>' . ts('Created Date:') . ' ' . $values['created_date'] . '</p><p>' . ts('Last Modified By:') . ' ' . $modifiedBy . '</p><p>' . ts('Payment Method:') . ' ' . $values['payment_instrument_id'] . '</p>';
     $subject = '';
     if (!empty($values['total'])) {
       $subject .= ts('Total') . '[' . CRM_Utils_Money::format($values['total']) . '],';
index 7f5535adc77435a6435dbab570ac929ebb0d07de..4eb174139bf423c03d5d11a3d431350f9442ae21 100644 (file)
@@ -381,6 +381,25 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces
   /**
    * Retrieve payment processor id / info/ object based on component-id.
    *
+   * @todo function needs revisiting. The whole 'info / obj' thing is an overload. Recommend creating new functions
+   * that are entity specific as there is little shared code specific to obj or info
+   *
+   * Also, it does not accurately derive the processor - for a completed contribution the best place to look is in the
+   * relevant financial_trxn record. For a recurring contribution it is in the contribution_recur table.
+   *
+   * For a membership the relevant contribution_recur should be derived & then resolved as above. The contribution page
+   * is never a reliable place to look as there can be more than one configured. For a pending contribution there is
+   * no way to derive the processor - but hey - what processor? it didn't go through!
+   *
+   * Query for membership might look something like:
+   * SELECT fte.payment_processor_id
+   * FROM civicrm_membership mem
+   * INNER JOIN civicrm_line_item li  ON ( mem.id = li.entity_id AND li.entity_table = 'civicrm_membership')
+   * INNER JOIN civicrm_contribution       con ON ( li.contribution_id = con.id )
+   * LEFT JOIN civicrm_entity_financial_trxn ft ON ft.entity_id = con.id AND ft.entity_table =
+   * 'civicrm_contribution'
+   * LEFT JOIN civicrm_financial_trxn fte ON fte.id = ft.financial_trxn_id
+   *
    * @param int $entityID
    * @param string $component
    *   Component.
@@ -445,11 +464,17 @@ INNER JOIN civicrm_contribution       con ON ( mp.contribution_id = con.id )
     elseif ($type == 'info') {
       $result = self::getPayment($ppID, $mode);
     }
-    elseif ($type == 'obj') {
-      $payment = self::getPayment($ppID, $mode);
-      $result = Civi\Payment\System::singleton()->getByProcessor($payment);
+    elseif ($type == 'obj' && is_numeric($ppID)) {
+      try {
+        $paymentProcessor = civicrm_api3('PaymentProcessor', 'getsingle', array('id' => $ppID));
+      }
+      catch (API_Exception $e) {
+        // Unable to load the processor because this function uses an unreliable method to derive it.
+        // The function looks to load the payment processor ID from the contribution page, which
+        // can support multiple processors.
+      }
+      $result = Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
     }
-
     return $result;
   }
 
index 45c9afce8c1305684b58ed15eac359d785c313ae..1325538fb34b7a79010b84cc40c100975c8abef8 100644 (file)
@@ -64,7 +64,7 @@ class CRM_Financial_Form_BatchTransaction extends CRM_Contribute_Form {
         'created_by' => ts('Created By'),
         'status' => ts('Status'),
         'description' => ts('Description'),
-        'payment_instrument' => ts('Payment Instrument'),
+        'payment_instrument' => ts('Payment Method'),
         'item_count' => ts('Entered Transactions'),
         'assigned_item_count' => ts('Assigned Transactions'),
         'total' => ts('Entered Total'),
index 2a4599d57b1fd489b61be1a86f1c8e1bbb6ae1bb..031319f9da73fb268db214ea0b6eb40be713536b 100644 (file)
@@ -137,7 +137,7 @@ class CRM_Financial_Form_FinancialBatch extends CRM_Contribute_Form {
 
     $this->add('textarea', 'description', ts('Description'), $attributes['description']);
 
-    $this->add('select', 'payment_instrument_id', ts('Payment Instrument'),
+    $this->add('select', 'payment_instrument_id', ts('Payment Method'),
       array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
       FALSE
     );
index 699ecfffb2a4d880aed94228f4531aefc63b73ea..a415b02d1ac271f81fdc689505db091111b7b653 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 class CRM_Financial_Form_Payment extends CRM_Core_Form {
   /**
@@ -57,6 +55,15 @@ class CRM_Financial_Form_Payment extends CRM_Core_Form {
     CRM_Core_Payment_ProcessorForm::buildQuickForm($this);
   }
 
+  /**
+   * Set default values for the form.
+   */
+  public function setDefaultValues() {
+    $contactID = $this->getContactID();
+    CRM_Core_Payment_Form::setDefaultValues($this, $contactID);
+    return $this->_defaults;
+  }
+
   /**
    * Add JS to show icons for the accepted credit cards
    */
index 1dfcc15e0c2a40b8c98935471dad4500196b37b2..aefc5ec7ec446e2b0fc2b136aa523dd32865ba94 100644 (file)
@@ -78,7 +78,7 @@ class CRM_Financial_Form_Search extends CRM_Core_Form {
     $this->add(
       'select',
       'payment_instrument_id',
-      ts('Payment Instrument'),
+      ts('Payment Method'),
       array('' => ts('- any -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
       FALSE
     );
index 907a4b20bf7b07eb3d29d4947c705a773dec9e9a..f8cfa05a78a6205f497a8a137baba66de7b44bd7 100644 (file)
@@ -460,7 +460,7 @@ class CRM_Financial_Page_AJAX {
       'action',
     );
 
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo CRM_Utils_JSON::encodeDataTableSelector($financialitems, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
     CRM_Utils_System::civiExit();
   }
index 05c0f1d4d92e10a8e3ca5c59bf50f353eaae437b..168baf0c544956888a36dcdad269458946bef112 100644 (file)
@@ -68,8 +68,6 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_prefix = "grant_";
 
-  protected $_defaults;
-
   /**
    * Processing needed for buildForm and later.
    *
@@ -210,6 +208,8 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search {
       $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
     }
 
+    CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
+
     $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
 
     $this->set('formValues', $this->_formValues);
index 6844ef559ecdd0c83d0dde238e8fe1085eaa8c45..aca4ddc1333b8bd4dddeb1d9bf63e71e448f58d0 100644 (file)
@@ -112,7 +112,7 @@ class CRM_Group_Page_AJAX {
       if (!empty($params['is_unit_test'])) {
         return array($groups, $iFilteredTotal);
       }
-      header('Content-Type: application/json');
+      CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
       echo CRM_Utils_JSON::encodeDataTableSelector($groups, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
       CRM_Utils_System::civiExit();
     }
index 18c7fd3f077a5ba80f3fd767e5bdc71022f5b469..b7ebdc163cc23abb9274d033389f352ada5259d3 100644 (file)
@@ -96,13 +96,14 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
   }
 
   /**
+   * @deprecated
+   *
    * @param int $job_id
    * @param int $mailing_id
-   * @param null $mode
    *
    * @return int
    */
-  public static function &getRecipientsCount($job_id, $mailing_id = NULL, $mode = NULL) {
+  public static function getRecipientsCount($job_id, $mailing_id = NULL) {
     // need this for backward compatibility, so we can get count for old mailings
     // please do not use this function if possible
     $eq = self::getRecipients($job_id, $mailing_id);
@@ -115,19 +116,15 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
    * @param int $job_id
    *   (misnomer) a nonce value used to name temporary tables.
    * @param int $mailing_id
-   * @param null $offset
-   * @param null $limit
    * @param bool $storeRecipients
    * @param bool $dedupeEmail
    * @param null $mode
    *
    * @return CRM_Mailing_Event_BAO_Queue|string
    */
-  public static function &getRecipients(
+  public static function getRecipients(
     $job_id,
     $mailing_id = NULL,
-    $offset = NULL,
-    $limit = NULL,
     $storeRecipients = FALSE,
     $dedupeEmail = FALSE,
     $mode = NULL) {
@@ -137,8 +134,6 @@ class CRM_Mailing_BAO_Mailing extends CRM_Mailing_DAO_Mailing {
     $job = CRM_Mailing_BAO_MailingJob::getTableName();
     $mg = CRM_Mailing_DAO_MailingGroup::getTableName();
     $eq = CRM_Mailing_Event_DAO_Queue::getTableName();
-    $ed = CRM_Mailing_Event_DAO_Delivered::getTableName();
-    $eb = CRM_Mailing_Event_DAO_Bounce::getTableName();
 
     $email = CRM_Core_DAO_Email::getTableName();
     if ($mode == 'sms') {
@@ -530,19 +525,10 @@ AND    $mg.mailing_id = {$mailing_id}
     }
     $mailingGroup->query($query);
 
-    $results = array();
-
     $eq = new CRM_Mailing_Event_BAO_Queue();
 
     list($aclFrom, $aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause();
     $aclWhere = $aclWhere ? "WHERE {$aclWhere}" : '';
-    $limitString = NULL;
-    if ($limit && $offset !== NULL) {
-      $offset = CRM_Utils_Type::escape($offset, 'Int');
-      $limit = CRM_Utils_Type::escape($limit, 'Int');
-
-      $limitString = "LIMIT $offset, $limit";
-    }
 
     if ($storeRecipients && $mailing_id) {
       $sql = "
@@ -625,7 +611,7 @@ ORDER BY   i.contact_id, i.{$tempColumn}
   /**
    * Returns the regex patterns that are used for preparing the text and html templates.
    */
-  private function &getPatterns($onlyHrefs = FALSE) {
+  private function getPatterns($onlyHrefs = FALSE) {
 
     $patterns = array();
 
@@ -1171,14 +1157,14 @@ ORDER BY   civicrm_email.is_bulkmail DESC
    *
    * @return Mail_mime               The mail object
    */
-  public function &compose(
+  public function compose(
     $job_id, $event_queue_id, $hash, $contactId,
     $email, &$recipient, $test,
     $contactDetails, &$attachments, $isForward = FALSE,
     $fromEmail = NULL, $replyToEmail = NULL
   ) {
     $config = CRM_Core_Config::singleton();
-    $knownTokens = $this->getTokens();
+    $this->getTokens();
 
     if ($this->_domain == NULL) {
       $this->_domain = CRM_Core_BAO_Domain::getDomain();
@@ -1212,7 +1198,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
     }
     else {
       $params = array(array('contact_id', '=', $contactId, 0, 0));
-      list($contact, $_) = CRM_Contact_BAO_Query::apiQuery($params);
+      list($contact) = CRM_Contact_BAO_Query::apiQuery($params);
 
       //CRM-4524
       $contact = reset($contact);
@@ -1752,7 +1738,7 @@ ORDER BY   civicrm_email.is_bulkmail DESC
 
       // Populate the recipients.
       if (empty($params['_skip_evil_bao_auto_recipients_'])) {
-        self::getRecipients($job->id, $mailing->id, NULL, NULL, TRUE, $mailing->dedupe_email);
+        self::getRecipients($job->id, $mailing->id, TRUE, $mailing->dedupe_email);
       }
     }
 
@@ -2836,7 +2822,7 @@ WHERE  civicrm_mailing_job.id = %1
    * @throws Exception
    */
   public static function processQueue($mode = NULL) {
-    $config = &CRM_Core_Config::singleton();
+    $config = CRM_Core_Config::singleton();
 
     if ($mode == NULL && CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG") {
       throw new CRM_Core_Exception(ts('The <a href="%1">default mailbox</a> has not been configured. You will find <a href="%2">more info in the online user and administrator guide</a>', array(
index 247de4ad7ac735f0d5138288e59bd90b4dbe61c8..4728b203b8a23c58b85409f4b93c4470f0bab617 100644 (file)
@@ -151,7 +151,7 @@ class CRM_Mailing_BAO_MailingAB extends CRM_Mailing_DAO_MailingAB {
    * @param CRM_Mailing_DAO_MailingAB $dao
    */
   public static function distributeRecipients(CRM_Mailing_DAO_MailingAB $dao) {
-    CRM_Mailing_BAO_Mailing::getRecipients($dao->mailing_id_a, $dao->mailing_id_a, NULL, NULL, TRUE);
+    CRM_Mailing_BAO_Mailing::getRecipients($dao->mailing_id_a, $dao->mailing_id_a, TRUE);
 
     //calculate total number of random recipients for mail C from group_percentage selected
     $totalCount = CRM_Mailing_BAO_Recipients::mailingSize($dao->mailing_id_a);
index bfb63f20d1f1c383129bbf61642299dc9de08136..035f88a593f44b4ca4cc70484da006d65e607e7b 100644 (file)
@@ -71,7 +71,7 @@ class CRM_Mailing_BAO_MailingJob extends CRM_Mailing_DAO_MailingJob {
     $mailing = new CRM_Mailing_BAO_Mailing();
     $mailing->id = $params['mailing_id'];
     if ($mailing->id && $mailing->find(TRUE)) {
-      $mailing->getRecipients($job->id, $params['mailing_id'], NULL, NULL, TRUE, $mailing->dedupe_email);
+      $mailing->getRecipients($job->id, $params['mailing_id'], TRUE, $mailing->dedupe_email);
       return $job;
     }
     else {
index 9ff03260a12668e100452d5677ab162ac663c8c4..e6e18ecad6fe577a58ee6ad641192d763ca73a56 100644 (file)
@@ -483,8 +483,6 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task {
     CRM_Mailing_BAO_Mailing::getRecipients(
       $mailing->id,
       $mailing->id,
-      NULL,
-      NULL,
       TRUE,
       $dedupeEmail
     );
index 1905d16ed0dc47b8fc8cee0b4d5fa547d8c5740d..2bed417cb922f85de163ef06fa749257311f1ec8 100644 (file)
@@ -117,6 +117,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
 
     $groupNames = civicrm_api3('Group', 'get', $params + array(
       'is_active' => 1,
+      'check_permissions' => TRUE,
       'return' => array('title', 'visibility', 'group_type', 'is_hidden'),
     ));
     $headerfooterList = civicrm_api3('MailingComponent', 'get', $params + array(
@@ -143,6 +144,7 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
     ));
     $fromAddress = civicrm_api3('OptionValue', 'get', $params + array(
       'option_group_id' => "from_email_address",
+      'domain_id' => CRM_Core_Config::domainID(),
     ));
     CRM_Core_Resources::singleton()
       ->addSetting(array(
index cc615381aff5555b552d91bd047233d52b7fc60f..7b96ff1cfd6878c59211b22cef05ccc5d208bf8b 100644 (file)
@@ -92,11 +92,11 @@ class CRM_Mailing_Page_Preview extends CRM_Core_Page {
     );
 
     if ($type == 'html') {
-      header('Content-Type: text/html; charset=utf-8');
+      CRM_Utils_System::setHttpHeader('Content-Type', 'text/html; charset=utf-8');
       print $mime->getHTMLBody();
     }
     else {
-      header('Content-Type: text/plain; charset=utf-8');
+      CRM_Utils_System::setHttpHeader('Content-Type', 'text/plain; charset=utf-8');
       print $mime->getTXTBody();
     }
     CRM_Utils_System::civiExit();
index d4d8b0e39fda8e59fd46d45a089b51eb0f57e795..f9650ed85991b11fd3779989f643091d9182e497 100644 (file)
@@ -630,7 +630,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
       $this->addDate('receive_date', ts('Received'), FALSE, array('formatType' => 'activityDateTime'));
 
       $this->add('select', 'payment_instrument_id',
-        ts('Paid By'),
+        ts('Payment Method'),
         array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
         FALSE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
       );
@@ -804,7 +804,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
     }
 
     if (!empty($params['record_contribution']) && empty($params['payment_instrument_id'])) {
-      $errors['payment_instrument_id'] = ts('Paid By is a required field.');
+      $errors['payment_instrument_id'] = ts('Payment Method is a required field.');
     }
 
     if (!empty($params['is_different_contribution_contact'])) {
@@ -1793,7 +1793,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
     CRM_Core_Session::setStatus($statusMsg, ts('Complete'), 'success');
     //CRM-15187
     // dusplay message when membership type is changed
-    if ($this->_id && !in_array($this->_memType, $this->_memTypeSelected)) {
+    if (($this->_action & CRM_Core_Action::UPDATE) && $this->_id && !in_array($this->_memType, $this->_memTypeSelected)) {
       CRM_Core_Session::setStatus(
         ts('The financial types associated with the old and new membership types are different. You may want to edit the contribution associated with this membership to adjust its financial type.'),
         ts('Warning')
index 700f1a8e893f06fd3b6cbd1133a7bdd0f20ecdc4..8c63c91165a0c29f3739974894b0061ec0f50352 100644 (file)
@@ -354,7 +354,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
       $this->add('text', 'num_terms', ts('Extend Membership by'), array('onchange' => "setPaymentBlock();"), TRUE);
       $this->addRule('num_terms', ts('Please enter a whole number for how many periods to renew.'), 'integer');
 
-      $this->add('select', 'payment_instrument_id', ts('Paid By'),
+      $this->add('select', 'payment_instrument_id', ts('Payment Method'),
         array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
         FALSE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
       );
@@ -439,7 +439,7 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
         $errors['total_amount'] = ts('Please enter a Contribution Amount.');
       }
       if (empty($params['payment_instrument_id'])) {
-        $errors['payment_instrument_id'] = ts('Paid By is a required field.');
+        $errors['payment_instrument_id'] = ts('Payment Method is a required field.');
       }
     }
     return empty($errors) ? TRUE : $errors;
index 0e69f987cda298d0bb5fc258efcdbe7b425bdd64..4d7129a98827cd3a1256be0f7edcda46d80dfc4c 100644 (file)
@@ -63,8 +63,6 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_limit = NULL;
 
-  protected $_defaults;
-
   /**
    * Prefix for the controller.
    */
@@ -220,7 +218,7 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search {
       }
     }
 
-    CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
+    CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
 
     $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
 
index 303d7800e31f84a378043bee48d6d39c762cda9e..7a69be4cbdfda24b82a06b7fa786cc2a411977c2 100644 (file)
@@ -516,7 +516,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser {
           $checkCid->external_identifier = $formatValues['external_identifier'];
           $checkCid->find(TRUE);
           if ($checkCid->id != $formatted['contact_id']) {
-            array_unshift($values, 'Mismatch of External identifier :' . $formatValues['external_identifier'] . ' and Contact Id:' . $formatted['contact_id']);
+            array_unshift($values, 'Mismatch of External ID:' . $formatValues['external_identifier'] . ' and Contact Id:' . $formatted['contact_id']);
             return CRM_Import_Parser::ERROR;
           }
         }
index cf1d10f3d6b546581fa765aff1576c5249a7eb68..9e3156a8dcd5e504600d1faa1f6ac0d2de8d0413 100644 (file)
@@ -99,12 +99,18 @@ class CRM_Member_Page_Tab extends CRM_Core_Page {
         }
 
         $isUpdateBilling = FALSE;
+        // It would be better to determine if there is a recurring contribution &
+        // is so get the entity for the recurring contribution (& skip if not).
         $paymentObject = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity(
           $membership[$dao->id]['membership_id'], 'membership', 'obj');
         if (!empty($paymentObject)) {
+          // @todo - get this working with syntax style $paymentObject->supports(array
+          //('updateSubscriptionBillingInfo'));
           $isUpdateBilling = $paymentObject->isSupported('updateSubscriptionBillingInfo');
         }
 
+        // @todo - get this working with syntax style $paymentObject->supports(array
+        //('CancelSubscriptionSupported'));
         $isCancelSupported = CRM_Member_BAO_Membership::isCancelSubscriptionSupported(
           $membership[$dao->id]['membership_id']);
 
index 584a7f7565e20119dc6879cefc90c8dd3aa5c034..0167b59ef5315f8475527634be0fd9fe4de3589d 100644 (file)
@@ -52,14 +52,6 @@ class CRM_PCP_Form_PCPAccount extends CRM_Core_Form {
    */
   public $_single;
 
-  /**
-   * The default values for the form.
-   *
-   * @var array
-   */
-  protected $_defaults;
-
-
   public function preProcess() {
     $session = CRM_Core_Session::singleton();
     $config = CRM_Core_Config::singleton();
index 513344cdb83b88ced8d1b95ac930186919fe2d1f..bf6eb30709ba1cd862d416e6f3450c8459957b2f 100644 (file)
@@ -64,12 +64,8 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search {
    */
   protected $_prefix = "pledge_";
 
-  protected $_defaults;
-
   /**
    * Processing needed for buildForm and later.
-   *
-   * @return void
    */
   public function preProcess() {
 
@@ -218,7 +214,7 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search {
       $this->_formValues = CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID);
     }
 
-    CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($this->_formValues);
+    CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
 
     $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
 
index 3fdb20fafb7cb0e2dbd0f48a3afabbaa732619eb..59a7096096c761c31309f07c7bd9e47c96018f30 100644 (file)
@@ -135,8 +135,6 @@ class CRM_Profile_Form extends CRM_Core_Form {
    */
   protected $_ctype = NULL;
 
-  protected $_defaults = NULL;
-
   /**
    * Store profile ids if multiple profile ids are passed using comma separated.
    * Currently lets implement this functionality only for dialog mode
index 8f252b32643331761d33f045481b3c09b2743cd3..b4aec7d9345833c7a9df1b896c9f06e97a80c04f 100644 (file)
@@ -90,8 +90,6 @@ class CRM_Report_Form extends CRM_Core_Form {
    */
   protected $_options = array();
 
-  protected $_defaults = array();
-
   /**
    * By default most reports hide contact id.
    * Setting this to true makes it available
@@ -3144,7 +3142,7 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND
           //Load the image
           $chart = imagecreatefrompng($uploadUrl);
           //convert it into formatted png
-          header('Content-type: image/png');
+          CRM_Utils_System::setHttpHeader('Content-type', 'image/png');
           //overwrite with same image
           imagepng($chart, $uploadImg);
           //delete the object
index 864aacba44cf4edd1b0b65084932e3926112c9c4..662f49762922626f4f6733410eeb3ed72233afbd 100644 (file)
@@ -268,7 +268,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
             'default' => TRUE,
           ),
           'payment_instrument_id' => array(
-            'title' => ts('Payment Instrument'),
+            'title' => ts('Payment Method'),
             'default' => TRUE,
           ),
           'currency' => array(
@@ -287,7 +287,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
         ),
         'filters' => array(
           'payment_instrument_id' => array(
-            'title' => ts('Payment Instrument'),
+            'title' => ts('Payment Method'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => CRM_Contribute_PseudoConstant::paymentInstrument(),
           ),
@@ -305,7 +305,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
           ),
         ),
         'order_bys' => array(
-          'payment_instrument_id' => array('title' => ts('Payment Instrument')),
+          'payment_instrument_id' => array('title' => ts('Payment Method')),
         ),
       ),
       'civicrm_entity_financial_trxn' => array(
index 72f848fc516c6c56dbb48660229715284dd63037..6795ec97887525f1645c5d49b8213a79b448112c 100644 (file)
@@ -282,8 +282,8 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
         'order_bys' => array(
           'financial_type_id' => array('title' => ts('Financial Type')),
           'contribution_status_id' => array('title' => ts('Contribution Status')),
-          'payment_instrument_id' => array('title' => ts('Payment Instrument')),
-          'receive_date' => array('title' => ts('Receive Date')),
+          'payment_instrument_id' => array('title' => ts('Payment Method')),
+          'receive_date' => array('title' => ts('Date Received')),
         ),
         'grouping' => 'contri-fields',
       ),
index 95aefff3f5bd0630fc9f1adff0ff506857dd3fb6..60934193d764dc25fa02616f0be965de8f17691c 100644 (file)
@@ -517,7 +517,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
             'alter_display' => 'alterContributionType',
           ),
           'payment_instrument_id' => array(
-            'title' => ts('Payment Instrument'),
+            'title' => ts('Payment Method'),
             'alter_display' => 'alterPaymentType',
           ),
           'source' => array('title' => 'Contribution Source'),
@@ -553,7 +553,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
         ),
         'order_bys' => array(
           'payment_instrument_id' => array(
-            'title' => ts('Payment Instrument'),
+            'title' => ts('Payment Method'),
           ),
           'financial_type_id' => array(
             'title' => ts('Financial Type'),
@@ -561,7 +561,7 @@ class CRM_Report_Form_Extended extends CRM_Report_Form {
         ),
         'group_bys' => array(
           'financial_type_id' => array('title' => ts('Financial Type')),
-          'payment_instrument_id' => array('title' => ts('Payment Instrument')),
+          'payment_instrument_id' => array('title' => ts('Payment Method')),
           'contribution_id' => array(
             'title' => ts('Individual Contribution'),
             'name' => 'id',
index d53ba5841d3f1fea058d057156ce18b8b9ce6c35..52e3e3f38ae65fdc32eba65cd72489c0d95fcab3 100644 (file)
@@ -146,7 +146,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
       'dao' => 'CRM_Mailing_DAO_Mailing',
       'fields' => array(
         'delivered_count' => array(
-          'name' => 'id',
+          'name' => 'event_queue_id',
           'title' => ts('Delivered'),
         ),
         'accepted_rate' => array(
@@ -164,7 +164,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
       'dao' => 'CRM_Mailing_DAO_Mailing',
       'fields' => array(
         'bounce_count' => array(
-          'name' => 'id',
+          'name' => 'event_queue_id',
           'title' => ts('Bounce'),
         ),
         'bounce_rate' => array(
@@ -182,7 +182,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
       'dao' => 'CRM_Mailing_DAO_Mailing',
       'fields' => array(
         'open_count' => array(
-          'name' => 'id',
+          'name' => 'event_queue_id',
           'title' => ts('Opened'),
         ),
         'open_rate' => array(
@@ -200,7 +200,7 @@ class CRM_Report_Form_Mailing_Summary extends CRM_Report_Form {
       'dao' => 'CRM_Mailing_DAO_Mailing',
       'fields' => array(
         'click_count' => array(
-          'name' => 'id',
+          'name' => 'event_queue_id',
           'title' => ts('Clicks'),
         ),
         'CTR' => array(
index d5fb73c29d27f846dca83f5723876f0033877a3d..1c6bdbd91d870a9088784d272c2b157535536b5f 100644 (file)
@@ -264,7 +264,7 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form {
         ),
         'order_bys' => array(
           'receive_date' => array(
-            'title' => ts('Receive Date'),
+            'title' => ts('Date Received'),
             'default_weight' => '2',
             'default_order' => 'DESC',
           ),
index ca511b13b05cd03a1c96a5715a7755d6f271ab5a..74ce2c21c7ba46b655703fc65f8bfd78a69ed08e 100644 (file)
@@ -223,11 +223,11 @@ WHERE  inst.report_id = %1";
    */
   public static function export2csv(&$form, &$rows) {
     //Mark as a CSV file.
-    header('Content-Type: text/csv');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'text/csv');
 
     //Force a download and name the file using the current timestamp.
     $datetime = date('Ymd-Gi', $_SERVER['REQUEST_TIME']);
-    header('Content-Disposition: attachment; filename=Report_' . $datetime . '.csv');
+    CRM_Utils_System::setHttpHeader('Content-Disposition', 'attachment; filename=Report_' . $datetime . '.csv');
     echo self::makeCsv($form, $rows);
     CRM_Utils_System::civiExit();
   }
index 315e7beea01a4819b53b60209b489d50427277ba..2d546d955820d0a43fa280b76ff5f42b7264b869 100644 (file)
@@ -278,8 +278,6 @@ class CRM_SMS_Form_Group extends CRM_Contact_Form_Task {
     // also compute the recipients and store them in the mailing recipients table
     CRM_Mailing_BAO_Mailing::getRecipients($mailing->id,
       $mailing->id,
-      NULL,
-      NULL,
       TRUE,
       FALSE,
       'sms'
index 78de6adb7c5519d69d7e8130c5fd9c1cce4be7f1..9e4b6d29d66cb514b6ed368241ecb4c30d5dc609 100644 (file)
@@ -18,7 +18,7 @@
     {/if}
   </p>
   <table width="620" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">
-    <tr><td>{ts}Receive Date{/ts}:</td><td> {$receive_date|crmDate}</td></tr>
+    <tr><td>{ts}Received{/ts}:</td><td> {$receive_date|crmDate}</td></tr>
     <tr><td>{ts}Amount{/ts}:</td><td> {$total_amount|crmMoney:$currency}</td></tr>
     <tr><td>{ts}Name{/ts}:</td><td> {$donors_display_name}</td></tr>
     <tr><td>{ts}Email{/ts}:</td><td> {$donors_email}</td></tr>
index ea9ae9b2c231e0c29b297a544e444690a6978aa5..4c7f7841afc62385dbccb70149426758e4511e87 100644 (file)
@@ -11,7 +11,7 @@
     {ts}The donor's name has been added to your honor roll unless they asked not to be included.{/ts}
 {/if}
 
-{ts}Receive Date{/ts}: {$receive_date|crmDate}
+{ts}Received{/ts}: {$receive_date|crmDate}
 
 {ts}Amount{/ts}: {$total_amount|crmMoney:$currency}
 
index ca7ccf6efc183d0a8b884e8f3d60ce08d38ca1cc..c2ccfde1bd91de58d77cd7f6f4fc337a9a902e4a 100644 (file)
@@ -177,4 +177,21 @@ class CRM_Upgrade_Incremental_php_FourSix extends CRM_Upgrade_Incremental_Base {
     return TRUE;
   }
 
+  /**
+   * Queue Task Callback for CRM-16846
+   *
+   * Run a sql file without resetting locale to that version
+   */
+  public static function task_4_6_x_runOnlySql(CRM_Queue_TaskContext $ctx, $rev) {
+    $upgrade = new CRM_Upgrade_Form();
+    $smarty = CRM_Core_Smarty::singleton();
+    $smarty->assign('domainID', CRM_Core_Config::domainID());
+
+    $fileName = "CRM/Upgrade/Incremental/sql/$rev.mysql.tpl";
+
+    $upgrade->source($smarty->fetch($fileName), TRUE);
+
+    return TRUE;
+  }
+
 }
index 3da4eb64e2e37a9068e1df0b197eebef777b9099..2e0516f0a15bc7b426c0e20cfcf32dc69bbc8bcc 100644 (file)
@@ -1,3 +1,4 @@
+
 {* file to handle db changes in 4.6.6 during upgrade *}
 
 -- CRM-16846 - This upgrade may have been previously skipped so moving it to 4.6.6
@@ -9,3 +10,35 @@ UPDATE `civicrm_navigation`
 SET `permission` = 'edit message templates'
 WHERE `parent_id` = @messages_menu_id
 AND name = 'Message Templates';
+
+-- CRM-16907
+SELECT @adminHelplastID := id FROM civicrm_navigation WHERE name = 'Help';
+UPDATE civicrm_navigation
+SET name = 'Support', label = 'Support'
+WHERE id = @adminHelplastID;
+
+DELETE FROM civicrm_navigation where parent_id = @adminHelplastID;
+
+INSERT INTO civicrm_navigation
+     ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
+ VALUES
+     ( {$domainID}, 'http://civicrm.org/get-started?src=iam',        '{ts escape="sql" skip="true"}Get started{/ts}',        'Get started',        NULL, 'AND', @adminHelplastID, '1', NULL, 1 ),
+     ( {$domainID}, 'http://civicrm.org/documentation?src=iam',      '{ts escape="sql" skip="true"}Documentation{/ts}',      'Documentation',      NULL, 'AND', @adminHelplastID, '1', NULL, 2 ),
+     ( {$domainID}, 'http://civicrm.org/ask-a-question?src=iam',     '{ts escape="sql" skip="true"}Ask a question{/ts}',     'Ask a question',     NULL, 'AND', @adminHelplastID, '1', NULL, 3 ),
+     ( {$domainID}, 'http://civicrm.org/experts?src=iam',            '{ts escape="sql" skip="true"}Get expert help{/ts}',    'Get expert help',    NULL, 'AND', @adminHelplastID, '1', NULL, 4 ),
+     ( {$domainID}, 'http://civicrm.org/about?src=iam',              '{ts escape="sql" skip="true"}About CiviCRM{/ts}',      'About CiviCRM',      NULL, 'AND', @adminHelplastID, '1', 1, 5 ),
+     ( {$domainID}, 'http://civicrm.org/register-your-site?src=iam', '{ts escape="sql" skip="true"}Register your site{/ts}', 'Register your site', NULL, 'AND', @adminHelplastID, '1', NULL, 6 ),    
+     ( {$domainID}, 'http://civicrm.org/become-member?src=iam',      '{ts escape="sql" skip="true"}Join CiviCRM{/ts}',       'Join CiviCRM',       NULL, 'AND', @adminHelplastID, '1', NULL, 7 );
+
+INSERT INTO civicrm_navigation
+     ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
+ VALUES
+     ( {$domainID}, NULL, '{ts escape="sql" skip="true"}Developer{/ts}', 'Developer', 'administer CiviCRM', '', @adminHelplastID, '1', 1, 8 );
+
+SET @devellastID:=LAST_INSERT_ID();
+INSERT INTO civicrm_navigation
+     ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
+ VALUES
+     ( {$domainID}, 'civicrm/api', '{ts escape="sql" skip="true"}API Explorer{/ts}','API Explorer', 'administer CiviCRM', '', @devellastID, '1', NULL, 1 ),
+     ( {$domainID}, 'http://civicrm.org/developer-documentation?src=iam', '{ts escape="sql" skip="true"}Developer Docs{/ts}', 'Developer Docs', 'administer CiviCRM', '', @devellastID, '1', NULL, 3 );
\ No newline at end of file
diff --git a/CRM/Upgrade/Incremental/sql/4.6.7.mysql.tpl b/CRM/Upgrade/Incremental/sql/4.6.7.mysql.tpl
new file mode 100644 (file)
index 0000000..3371bfa
--- /dev/null
@@ -0,0 +1 @@
+{* file to handle db changes in 4.6.7 during upgrade *}
index d9aaee70e3ff67800d18f368ec68a749f2bebea3..f584166bd54f6bdc1620ac096ef0f67a002a60b1 100644 (file)
@@ -43,3 +43,24 @@ UPDATE civicrm_country SET `name` = UPPER( `name` );
 
 -- CRM-16447
 UPDATE civicrm_state_province SET name = 'Northern Ostrobothnia' WHERE name = 'Nothern Ostrobothnia';
+
+-- CRM-14078
+UPDATE civicrm_option_group SET {localize field="title"}title = '{ts escape="sql"}Payment Methods{/ts}'{/localize} WHERE name = 'payment_instrument';
+UPDATE civicrm_navigation SET label = '{ts escape="sql"}Payment Methods{/ts}' WHERE name = 'Payment Instruments';
+
+-- CRM-16176
+{if $multilingual}
+  {foreach from=$locales item=locale}
+     ALTER TABLE civicrm_relationship_type ADD label_a_b_{$locale} varchar(64);
+     ALTER TABLE civicrm_relationship_type ADD label_b_a_{$locale} varchar(64);
+     ALTER TABLE civicrm_relationship_type ADD description_{$locale} varchar(255);
+
+     UPDATE civicrm_relationship_type SET label_a_b_{$locale} = label_a_b;
+     UPDATE civicrm_relationship_type SET label_b_a_{$locale} = label_b_a;
+     UPDATE civicrm_relationship_type SET description_{$locale} = description;
+  {/foreach}
+
+  ALTER TABLE civicrm_relationship_type DROP label_a_b;
+  ALTER TABLE civicrm_relationship_type DROP label_b_a;
+  ALTER TABLE civicrm_relationship_type DROP description;
+{/if}
index 162d408516657d435f98fbf54f4f59f1adf900ed..af863ab62f9577dfdc075fc3934ac9f58c2b0c2a 100644 (file)
@@ -80,6 +80,7 @@ class CRM_Utils_API_ReloadOption implements API_Wrapper {
       if (!CRM_Utils_Array::value('is_error', $result, FALSE)) {
         $reloadMode = $apiRequest['params']['options']['reload'];
       }
+      $id = (!empty($apiRequest['params']['sequential'])) ? 0 : $result['id'];
     }
 
     switch ($reloadMode) {
@@ -98,16 +99,16 @@ class CRM_Utils_API_ReloadOption implements API_Wrapper {
         if ($reloadResult['is_error']) {
           throw new API_Exception($reloadResult['error_message']);
         }
-        $result['values'][$result['id']] = array_merge($result['values'][$result['id']], $reloadResult['values'][$result['id']]);
+        $result['values'][$id] = array_merge($result['values'][$id], $reloadResult['values'][$result['id']]);
         return $result;
 
       case 'selected':
         $params = array(
-          'id' => $result['id'],
+          'id' => $id,
           'return' => $this->pickReturnFields($apiRequest),
         );
         $reloadResult = civicrm_api3($apiRequest['entity'], 'get', $params);
-        $result['values'][$result['id']] = array_merge($result['values'][$result['id']], $reloadResult['values'][$result['id']]);
+        $result['values'][$id] = array_merge($result['values'][$id], $reloadResult['values'][$id]);
         return $result;
 
       default:
index 2c12372b18d06dccd55ff2c6e8aadf6013dbd83e..9f001877a27643a75f6003535d7b238ef92ea2e4 100644 (file)
@@ -1939,4 +1939,22 @@ abstract class CRM_Utils_Hook {
     );
   }
 
+  /**
+   * This hook is called when core resources are being loaded
+   *
+   * @see CRM_Core_Resources::coreResourceList
+   *
+   * @param array $list
+   * @param string $region
+   */
+  public static function coreResourceList(&$list, $region) {
+    // First allow the cms integration to add to the list
+    CRM_Core_Config::singleton()->userSystem->appendCoreResources($list);
+
+    self::singleton()->invoke(2, $list, $region,
+      self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject,
+      'civicrm_coreResourceList'
+    );
+  }
+
 }
index 096ce70f7613bd45f648d32909ac526ec68b3af8..0f460658fd498a88c0b032d8e82232941f0f1a7a 100644 (file)
@@ -109,16 +109,15 @@ class CRM_Utils_ICalendar {
   public static function send($calendar, $content_type = 'text/calendar', $charset = 'us-ascii', $fileName = NULL, $disposition = NULL) {
     $config = CRM_Core_Config::singleton();
     $lang = $config->lcMessages;
-    header("Content-Language: $lang");
-    // header( "Content-Type: $content_type; charset=$charset; profile=\"ICalendar\"" );
-    header("Content-Type: $content_type; charset=$charset");
+    CRM_Utils_System::setHttpHeader("Content-Language", $lang);
+    CRM_Utils_System::setHttpHeader("Content-Type", "$content_type; charset=$charset");
 
     if ($content_type == 'text/calendar') {
-      header('Content-Length: ' . strlen($calendar));
-      header("Content-Disposition: $disposition; filename=\"$fileName\"");
-      header("Pragma: no-cache");
-      header("Expires: 0");
-      header("Cache-Control: no-cache, must-revalidate");
+      CRM_Utils_System::setHttpHeader('Content-Length', strlen($calendar));
+      CRM_Utils_System::setHttpHeader("Content-Disposition", "$disposition; filename=\"$fileName\"");
+      CRM_Utils_System::setHttpHeader("Pragma", "no-cache");
+      CRM_Utils_System::setHttpHeader("Expires", "0");
+      CRM_Utils_System::setHttpHeader("Cache-Control", "no-cache, must-revalidate");
     }
 
     echo $calendar;
index f210f1dfa6fcfc68fdd8dd9eed98b0f118f5c0a7..01e0b60bbf32f4fd108d0ad2a2611aad7c50c037 100644 (file)
@@ -43,7 +43,7 @@ class CRM_Utils_JSON {
    * @param mixed $input
    */
   public static function output($input) {
-    header('Content-Type: application/json');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
     echo json_encode($input);
     CRM_Utils_System::civiExit();
   }
index f2c9bd85588899f41ae18255cca136052f400bbd..62d592e5c2557b894715439b1aa13479e81d633c 100644 (file)
@@ -233,8 +233,8 @@ class CRM_Utils_PDF_Utils {
       return $pdf;
     }
     else {
-      header('Content-Type: application/pdf');
-      header('Content-Disposition: attachment; filename="' . $fileName . '"');
+      CRM_Utils_System::setHttpHeader('Content-Type', 'application/pdf');
+      CRM_Utils_System::setHttpHeader('Content-Disposition', 'attachment; filename="' . $fileName . '"');
       echo $pdf;
     }
   }
@@ -400,9 +400,9 @@ class CRM_Utils_PDF_Utils {
       $len = strlen($buf);
 
       if ($echo) {
-        header('Content-type: application/pdf');
-        header("Content-Length: $len");
-        header("Content-Disposition: inline; filename={$output}.pdf");
+        CRM_Utils_System::setHttpHeader('Content-type', 'application/pdf');
+        CRM_Utils_System::setHttpHeader("Content-Length", $len);
+        CRM_Utils_System::setHttpHeader("Content-Disposition", "inline; filename={$output}.pdf");
         echo $buf;
         CRM_Utils_System::civiExit();
       }
index 4bac9b7db502bf026e45019df4d33707e34e9bde..f00f96a3afb22869c0b938e54b84cf92f210955a 100644 (file)
@@ -145,11 +145,11 @@ class CRM_Utils_REST {
     }
 
     if (!empty($requestParams['json'])) {
-      header('Content-Type: application/json');
       if (!empty($requestParams['prettyprint'])) {
-        // Used by the api explorer
+        // Don't set content-type header for api explorer output
         return self::jsonFormated(array_merge($result));
       }
+      CRM_Utils_System::setHttpHeader('Content-Type', 'application/json');
       return json_encode(array_merge($result));
     }
 
@@ -451,7 +451,7 @@ class CRM_Utils_REST {
    * @param $pearError
    */
   public static function fatal($pearError) {
-    header('Content-Type: text/xml');
+    CRM_Utils_System::setHttpHeader('Content-Type', 'text/xml');
     $error = array();
     $error['code'] = $pearError->getCode();
     $error['error_message'] = $pearError->getMessage();
@@ -484,7 +484,7 @@ class CRM_Utils_REST {
     $smarty = CRM_Core_Smarty::singleton();
     CRM_Utils_System::setTitle("$entity::$tplfile inline $tpl");
     if (!$smarty->template_exists($tpl)) {
-      header("Status: 404 Not Found");
+      CRM_Utils_System::setHttpHeader("Status", "404 Not Found");
       die ("Can't find the requested template file templates/$tpl");
     }
     if (array_key_exists('id', $_GET)) {// special treatmenent, because it's often used
index a9d1e3a901a7ce5bd1f2c2551b916c4efb3dab6c..3ea64b468137955b270e9b497aad68153f135b4a 100644 (file)
@@ -410,7 +410,7 @@ class CRM_Utils_System {
       ));
     }
 
-    header('Location: ' . $url);
+    self::setHttpHeader('Location', $url);
     self::civiExit();
   }
 
@@ -813,8 +813,8 @@ class CRM_Utils_System {
   ) {
     $now = gmdate('D, d M Y H:i:s') . ' GMT';
 
-    header('Content-Type: ' . $mimeType);
-    header('Expires: ' . $now);
+    self::setHttpHeader('Content-Type', $mimeType);
+    self::setHttpHeader('Expires', $now);
 
     // lem9 & loic1: IE need specific headers
     $isIE = strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE');
@@ -825,13 +825,13 @@ class CRM_Utils_System {
       $fileString = "filename=\"{$name}\"";
     }
     if ($isIE) {
-      header("Content-Disposition: inline; $fileString");
-      header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
-      header('Pragma: public');
+      self::setHttpHeader("Content-Disposition", "inline; $fileString");
+      self::setHttpHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0');
+      self::setHttpHeader('Pragma', 'public');
     }
     else {
-      header("Content-Disposition: $disposition; $fileString");
-      header('Pragma: no-cache');
+      self::setHttpHeader("Content-Disposition", "$disposition; $fileString");
+      self::setHttpHeader('Pragma', 'no-cache');
     }
 
     if ($output) {
@@ -1880,4 +1880,12 @@ class CRM_Utils_System {
     return NULL;
   }
 
+  /**
+   * @param string $name
+   * @param string $value
+   */
+  public static function setHttpHeader($name, $value) {
+    CRM_Core_Config::singleton()->userSystem->setHttpHeader($name, $value);
+  }
+
 }
index 866aeeafed11b172cbb36a1179a544dc58fab961..dec96a5dbc370fc491f804b64879a2628fa5aea2 100644 (file)
@@ -740,4 +740,12 @@ abstract class CRM_Utils_System_Base {
   public function appendCoreResources(&$list) {
   }
 
+  /**
+   * @param string $name
+   * @param string $value
+   */
+  public function setHttpHeader($name, $value) {
+    header("$name: $value");
+  }
+
 }
index 105bab57df2488e3d751303d3f51cec22e66e1b4..c3f3921f945bfa6c08dd823b4db6ff9545f172e7 100644 (file)
@@ -773,4 +773,11 @@ AND    u.status = 1
     return $timezone;
   }
 
+  /**
+   * @inheritDoc
+   */
+  public function setHttpHeader($name, $value) {
+    drupal_add_http_header($name, $value);
+  }
+
 }
index 5d52afc3124aaf43432f5843eb2abc54c569c877..cd354b9357a9f85418faf632cd22bdbf8c93cd87 100644 (file)
@@ -741,4 +741,11 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase {
     return $timezone;
   }
 
+  /**
+   * @inheritDoc
+   */
+  public function setHttpHeader($name, $value) {
+    drupal_set_header("$name: $value");
+  }
+
 }
index 9a714a7d077f7015ab18b40532ae97eaf0bdc897..e824e5d31e1093a1fe36934ef41a3d5ce6164cd1 100644 (file)
@@ -540,4 +540,22 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase {
     return 'sidebar_first';
   }
 
+  /**
+   * @inheritDoc
+   */
+  public function flush() {
+    // CiviCRM and Drupal both provide (different versions of) Symfony (and possibly share other classes too).
+    // If we call drupal_flush_all_caches(), Drupal will attempt to rediscover all of its classes, use Civicrm's
+    // alternatives instead and then die. Instead, we only clear cache bins and no more.
+    foreach (Drupal\Core\Cache\Cache::getBins() as $service_id => $cache_backend) {
+      $cache_backend->deleteAll();
+    }
+  }
+
+  /**
+   * @inheritDoc
+   */
+  public function setHttpHeader($name, $value) {
+    \Symfony\Component\HttpFoundation\Response->headers->set($name, $value);
+  }
 }
index a8431f47b948a38c7b98f5bdc7f19fa27883317b..daa5c84964f5e1845f557d28806f45e8f9d1f14c 100644 (file)
@@ -456,7 +456,7 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base {
    */
   public function logout() {
     session_destroy();
-    header("Location:index.php");
+    CRM_Utils_System::setHttpHeader("Location", "index.php");
   }
 
   /**
index f2014b027f971beb65634ec53efee7ec597a1059..e24468a094396a9ac8c124ff1d453a67dccba9f7 100644 (file)
@@ -162,7 +162,7 @@ class CRM_Utils_System_UnitTests extends CRM_Utils_System_Base {
    */
   public function logout() {
     session_destroy();
-    header("Location:index.php");
+    CRM_Utils_System::setHttpHeader("Location", "index.php");
   }
 
   /**
index 4e66cce043cec6415a2d8e6f57a0bf0a14603de4..074753bd205ab004e0ca562980f8bbba028d14fc 100644 (file)
@@ -183,7 +183,7 @@ class ChainSubscriber implements EventSubscriberInterface {
             foreach ($newparams as $entityparams) {
               $subParams = array_merge($genericParams, $entityparams);
               _civicrm_api_replace_variables($subParams, $result['values'][$idIndex], $separator);
-              $result['values'][$result['id']][$field][] = $apiKernel->run($subEntity, $subaction, $subParams);
+              $result['values'][$idIndex][$field][] = $apiKernel->run($subEntity, $subaction, $subParams);
               if ($result['is_error'] === 1) {
                 throw new \Exception($subEntity . ' ' . $subaction . 'call failed with' . $result['error_message']);
               }
index 4f53c542fc0324b54e6361ee65a70ba28f963cc5..8b55d97347e26335c6a7e5a35d93db3ac4556a8d 100644 (file)
@@ -158,6 +158,10 @@ function _civicrm_api_replace_variables(&$params, &$parentResult, $separator = '
           $count = count($stringParts);
         }
       }
+      // CRM-16168 If we have failed to swap it out we should unset it rather than leave the placeholder.
+      if (substr($params[$field], 0, 6) == '$value') {
+        $params[$field] = NULL;
+      }
     }
   }
 }
index 3ba552797023a045734ec88d15ce9da8c1c3d9fd..ff022630919db25012d056a9fd8cba5fb6bf3340 100644 (file)
@@ -37,6 +37,7 @@
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_acl_create($params) {
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -48,7 +49,7 @@ function civicrm_api3_acl_create($params) {
  * @param array $params
  *
  * @return array
- *   Array of retrieved Acl property values.
+ *   API result array
  */
 function civicrm_api3_acl_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -60,7 +61,7 @@ function civicrm_api3_acl_get($params) {
  * @param array $params
  *
  * @return array
- *   Array of deleted values.
+ *   API result array
  */
 function civicrm_api3_acl_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
index 3fd3827f5cdd01bee2832f157f0b6edd2c78dadc..d141111dd5f8c777c0d6142fd192baf8c2d8f006 100644 (file)
@@ -37,6 +37,7 @@
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_acl_role_create($params) {
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -48,7 +49,7 @@ function civicrm_api3_acl_role_create($params) {
  * @param array $params
  *
  * @return array
- *   Array of retrieved AclRole property values.
+ *   API result array
  */
 function civicrm_api3_acl_role_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -60,7 +61,7 @@ function civicrm_api3_acl_role_get($params) {
  * @param array $params
  *
  * @return array
- *   Array of deleted values.
+ *   API result array
  */
 function civicrm_api3_acl_role_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
index 44152465dcf5d7b10547a5a9393026952dc00721..1d566491104f84cc4f0ecc6d5c77f57a7ba92adb 100644 (file)
@@ -37,6 +37,7 @@
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_action_schedule_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'ActionSchedule');
index 1e6fbf22f4a66a992c621ea542825c9336bec2c8..cd6f3bbee1283fa09f53d37c0df983a908ae851e 100644 (file)
@@ -40,7 +40,7 @@
  *
  * @throws API_Exception
  * @return array
- *   Array containing 'is_error' to denote success or failure and details of the created activity.
+ *   API result array
  */
 function civicrm_api3_activity_create($params) {
 
@@ -230,6 +230,7 @@ function _civicrm_api3_activity_create_spec(&$params) {
  *   Array per getfields documentation.
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_activity_get($params) {
   if (!empty($params['contact_id'])) {
@@ -325,6 +326,7 @@ function _civicrm_api3_activity_get_formatResult($params, $activities) {
  * @throws API_Exception
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_activity_delete($params) {
 
index 36904b0de09265767f91b8ed4b10b803da2b150b..addc2008cc76a4a3a80f1b38dbe02a70e3af9689 100644 (file)
@@ -62,7 +62,7 @@ function _civicrm_api3_activity_contact_create_spec(&$params) {
  * @param array $params
  *
  * @return array
- *   Api Result
+ *   API result array
  */
 function civicrm_api3_activity_contact_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -75,7 +75,7 @@ function civicrm_api3_activity_contact_delete($params) {
  *   An associative array of name/value pairs.
  *
  * @return array
- *   details of found tags else error
+ *   API result array
  */
 function civicrm_api3_activity_contact_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
index 7c95d30d38acefc8c3b967768184a006e8cea24b..dbea8c560ea9ae753058965e3de26f67a7967cfc 100644 (file)
@@ -38,6 +38,7 @@
  *   Array per getfields metadata.
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_address_create(&$params) {
   /**
@@ -123,7 +124,7 @@ function _civicrm_api3_address_get_spec(&$params) {
  *   Array per getfields metadata.
  *
  * @return array
- *   api result array
+ *   API result array
  */
 function civicrm_api3_address_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -136,7 +137,7 @@ function civicrm_api3_address_delete($params) {
  *   Array per getfields metadata.
  *
  * @return array
- *   details of found addresses else error
+ *   API result array
  */
 function civicrm_api3_address_get(&$params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Address');
index 1e7cfc23fca78621ab83a7e4a74dda0e39483316..eb6b5d73583d22ef82a026be99664ee3b95890fd 100644 (file)
@@ -131,6 +131,7 @@ function _civicrm_api3_contact_create_spec(&$params) {
   );
   $params['prefix_id']['api.aliases'] = array('individual_prefix', 'individual_prefix_id');
   $params['suffix_id']['api.aliases'] = array('individual_suffix', 'individual_suffix_id');
+  $params['gender_id']['api.aliases'] = array('gender');
 }
 
 /**
index 0cf23a94c8e972bac028b040c02f04461dfc51ff..1f393bbaae800ff3673e3b1374b8b5ec57f2d8d6 100644 (file)
@@ -134,7 +134,7 @@ function _civicrm_api3_contribution_create_spec(&$params) {
   $params['skipLineItem'] = array(
     'name' => 'skipLineItem',
     'title' => 'Skip adding line items',
-    'type' => 1,
+    'type' => CRM_Utils_Type::T_BOOLEAN,
     'api.default' => 0,
     'description' => 'Do not add line items by default (if you wish to add your own)',
   );
@@ -351,7 +351,7 @@ function civicrm_api3_contribution_sendconfirmation($params) {
     throw new Exception('Contribution does not exist');
   }
   $input = $ids = $cvalues = array('receipt_from_email' => $params['receipt_from_email']);
-  $contribution->loadRelatedObjects($input, $ids, FALSE, TRUE);
+  $contribution->loadRelatedObjects($input, $ids, TRUE);
   $contribution->composeMessageArray($input, $ids, $cvalues, FALSE, FALSE);
 }
 
@@ -420,7 +420,7 @@ function civicrm_api3_contribution_completetransaction(&$params) {
     throw new API_Exception('A valid contribution ID is required', 'invalid_data');
   }
 
-  if (!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)) {
+  if (!$contribution->loadRelatedObjects($input, $ids, TRUE)) {
     throw new API_Exception('failed to load related objects');
   }
   elseif ($contribution->contribution_status_id == CRM_Core_OptionGroup::getValue('contribution_status', 'Completed', 'name')) {
@@ -493,7 +493,7 @@ function civicrm_api3_contribution_repeattransaction(&$params) {
   }
   $original_contribution = clone $contribution;
   try {
-    if (!$contribution->loadRelatedObjects($input, $ids, FALSE, TRUE)) {
+    if (!$contribution->loadRelatedObjects($input, $ids, TRUE)) {
       throw new API_Exception('failed to load related objects');
     }
 
@@ -550,10 +550,9 @@ function _ipn_process_transaction(&$params, $contribution, $input, $ids, $firstC
     $input['receipt_from_name'] = CRM_Utils_Array::value('receipt_from_name', $params, $domainFromName);
     $input['receipt_from_email'] = CRM_Utils_Array::value('receipt_from_email', $params, $domainFromEmail);
   }
-  // @todo required for base ipn but problematic as api layer handles this
   $transaction = new CRM_Core_Transaction();
-  $ipn = new CRM_Core_Payment_BaseIPN();
-  $ipn->completeTransaction($input, $ids, $objects, $transaction, !empty($contribution->contribution_recur_id));
+  CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects, $transaction, !empty($contribution->contribution_recur_id), $contribution,
+    FALSE, FALSE);
   return $params;
 }
 
index 14e467467278f454490e666ca1547d47db2fe978..88dc250efbd4f34bfa4f4632a2712fae7cc0f566 100644 (file)
 /**
  * Retrieve custom searches.
  *
- * FIXME This is a bare-minimum placeholder
- *
  * @param array $params
  *
  * @return array
- *   details of found Option Values
+ *   API result array
  */
 function civicrm_api3_custom_search_get($params) {
   require_once 'api/v3/OptionValue.php';
@@ -55,6 +53,7 @@ function civicrm_api3_custom_search_get($params) {
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_custom_search_create($params) {
   require_once 'api/v3/OptionValue.php';
@@ -86,12 +85,12 @@ function _civicrm_api3_custom_search_create_spec(&$params) {
 }
 
 /**
- * Deletes an existing ReportTemplate.
+ * Deletes an existing CustomSearch.
  *
  * @param array $params
  *
  * @return array
- *   Api result
+ *   API result array
  */
 function civicrm_api3_custom_search_delete($params) {
   require_once 'api/v3/OptionValue.php';
index a5d7cfeb231af4c72448fba2800e3003cbc7f6da..9326dd2cf41abbd50233ff614abae162f4475a40 100644 (file)
@@ -71,13 +71,18 @@ function _civicrm_api3_group_create_spec(&$params) {
  */
 function civicrm_api3_group_get($params) {
   $options = _civicrm_api3_get_options_from_params($params, TRUE, 'Group', 'get');
-  if (empty($options['return']) || !in_array('member_count', $options['return'])) {
+  if ((empty($options['return']) || !in_array('member_count', $options['return'])) && empty($params['check_permissions'])) {
     return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Group');
   }
 
   $groups = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Group');
   foreach ($groups as $id => $group) {
-    $groups[$id]['member_count'] = CRM_Contact_BAO_Group::memberCount($id);
+    if (!empty($params['check_permissions']) && !CRM_Contact_BAO_Group::checkPermission($group['id'])) {
+      unset($groups[$id]);
+    }
+    elseif (!empty($options['return']) && in_array('member_count', $options['return'])) {
+      $groups[$id]['member_count'] = CRM_Contact_BAO_Group::memberCount($id);
+    }
   }
   return civicrm_api3_create_success($groups, $params, 'Group', 'get');
 }
index e7e76659d44ac5ea7e4c908a915e2e80d4b024af..824afc828447627a74ce4f36162311da5a85c71f 100644 (file)
@@ -69,10 +69,20 @@ function civicrm_api3_group_contact_get($params) {
   $status = CRM_Utils_Array::value('status', $params, 'Added');
 
   $groupId = CRM_Utils_Array::value('group_id', $params);
-  $values = &CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], $status, NULL, FALSE, TRUE, FALSE, TRUE, $groupId);
+  $values = CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], $status, NULL, FALSE, TRUE, FALSE, TRUE, $groupId);
   return civicrm_api3_create_success($values, $params, 'GroupContact');
 }
 
+/**
+ * Adjust metadata for Create action.
+ *
+ * @param array $params
+ */
+function _civicrm_api3_group_contact_create_spec(&$params) {
+  $params['contact_id']['api.required'] = 1;
+  $params['group_id']['api.required'] = 1;
+}
+
 /**
  * Add contact(s) to group(s).
  *
@@ -101,12 +111,13 @@ function civicrm_api3_group_contact_get($params) {
  * @endcode
  *
  * @param array $params
- *   Input parameters.
- *   - "contact_id" (required) : first contact to add
- *   - "group_id" (required): first group to add contact(s) to
- *   - "contact_id.1" etc. (optional) : another contact to add
- *   - "group_id.1" etc. (optional) : additional group to add contact(s) to
- *   - "status" (optional) : one of "Added", "Pending" or "Removed" (default is "Added")
+ *   Input parameters:
+ *   - "contact_id" (required): First contact to add, or array of Contact IDs
+ *   - "group_id" (required): First group to add contact(s) to, or array of Group IDs
+ *   - "status" (optional): "Added" (default), "Pending" or "Removed"
+ *   Legacy input parameters (will be deprecated):
+ *   - "contact_id.1" etc. (optional): Additional contact_id to add to group(s)
+ *   - "group_id.1" etc. (optional): Additional groups to add contact(s) to
  *
  * @return array
  *   Information about operation results
@@ -121,7 +132,6 @@ function civicrm_api3_group_contact_create($params) {
       $params['contact_id'] = $info['values'][$params['id']]['contact_id'];
     }
   }
-  civicrm_api3_verify_mandatory($params, NULL, array('group_id', 'contact_id'));
   $action = CRM_Utils_Array::value('status', $params, 'Added');
   return _civicrm_api3_group_contact_common($params, $action);
 }
@@ -179,23 +189,32 @@ function _civicrm_api3_group_contact_common($params, $op = 'Added') {
 
   $contactIDs = array();
   $groupIDs = array();
+
+  // CRM-16959: Handle multiple Contact IDs and Group IDs in legacy format
+  // (contact_id.1, contact_id.2) or as an array
   foreach ($params as $n => $v) {
     if (substr($n, 0, 10) == 'contact_id') {
-      $contactIDs[] = $v;
+      if (is_array($v)) {
+        foreach ($v as $arr_v) {
+          $contactIDs[] = $arr_v;
+        }
+      }
+      else {
+        $contactIDs[] = $v;
+      }
     }
     elseif (substr($n, 0, 8) == 'group_id') {
-      $groupIDs[] = $v;
+      if (is_array($v)) {
+        foreach ($v as $arr_v) {
+          $groupIDs[] = $arr_v;
+        }
+      }
+      else {
+        $groupIDs[] = $v;
+      }
     }
   }
 
-  if (empty($contactIDs)) {
-    return civicrm_api3_create_error('contact_id is a required field');
-  }
-
-  if (empty($groupIDs)) {
-    return civicrm_api3_create_error('group_id is a required field');
-  }
-
   $method = CRM_Utils_Array::value('method', $params, 'API');
   $status = CRM_Utils_Array::value('status', $params, $op);
   $tracking = CRM_Utils_Array::value('tracking', $params);
index b4b842c17967caa09186cb4cc02c74c953d94d95..5242a509667d717f4f7bb34a44e7b027a9584f40 100644 (file)
@@ -38,7 +38,7 @@
  *   An associative array of name/value property values of MembershipBlock.
  *
  * @return array
- *   newly created or updated membership block property values.
+ *   API result array
  */
 function civicrm_api3_membership_block_create($params) {
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -68,7 +68,7 @@ function _civicrm_api3_membership_block_create_spec(&$params) {
  * {getfields MembershipBlock_get}
  *
  * @return array
- *   api result array of all found membership block property values.
+ *   API result array
  */
 function civicrm_api3_membership_block_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -83,7 +83,7 @@ function civicrm_api3_membership_block_get($params) {
  * @param array $params
  *
  * @return array
- *   api result array
+ *   API result array
  */
 function civicrm_api3_membership_block_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
diff --git a/api/v3/MembershipLog.php b/api/v3/MembershipLog.php
new file mode 100644 (file)
index 0000000..d3307b1
--- /dev/null
@@ -0,0 +1,88 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * This api exposes CiviCRM MembershipLog records.
+ *
+ * @package CiviCRM_APIv3
+ */
+
+/**
+ * API to Create or update a MembershipLog.
+ *
+ * @param array $params
+ *   Values of MembershipLog.
+ *
+ * @return array
+ *   API result array.
+ */
+function civicrm_api3_membership_log_create($params) {
+  return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+}
+
+/**
+ * Adjust Metadata for Create action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
+ *
+ * @param array $params
+ *   Array of parameters determined by getfields.
+ */
+function _civicrm_api3_membership_log_create_spec(&$params) {
+  $params['membership_id']['api.required'] = TRUE;
+}
+
+/**
+ * Get a Membership Log.
+ *
+ * This api is used for finding an existing membership log.
+ *
+ * @param array $params
+ *   An associative array of name/value property values of civicrm_membership_log.
+ * {getfields MembershipLog_get}
+ *
+ * @return array
+ *   API result array
+ */
+function civicrm_api3_membership_log_get($params) {
+  return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+}
+
+/**
+ * Deletes an existing membership log.
+ *
+ * This API is used for deleting a membership log
+ * Required parameters : id of a membership log
+ *
+ * @param array $params
+ *
+ * @return array
+ *   API result array
+ */
+function civicrm_api3_membership_log_delete($params) {
+  return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+}
index 47a11e01af580b6ea468a8a71d4a553880783523..e7b5591de348c7c7ffd27125985a7e3fb7b8dd9c 100644 (file)
@@ -37,6 +37,7 @@
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_open_i_d_create($params) {
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -60,7 +61,7 @@ function _civicrm_api3_open_i_d_create_spec(&$params) {
  * @param array $params
  *
  * @return array
- *   API result Array
+ *   API result array
  */
 function civicrm_api3_open_i_d_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -73,7 +74,7 @@ function civicrm_api3_open_i_d_delete($params) {
  *   An associative array of name/value pairs.
  *
  * @return array
- *   details of found OpenID
+ *   API result array
  */
 function civicrm_api3_open_i_d_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
index 356e5e638916ba57ae180f03cecb89d76678a56b..86b94c21c7bee016ecbf002d6cee206f4f4b2d19 100644 (file)
@@ -39,7 +39,7 @@
  * @param array $params
  *
  * @return array
- *   Details of found Option Values
+ *   API result array
  */
 function civicrm_api3_option_value_get($params) {
 
@@ -62,6 +62,7 @@ function civicrm_api3_option_value_get($params) {
  *
  * @throws API_Exception
  * @return array
+ *   API result array
  */
 function civicrm_api3_option_value_create($params) {
   $result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -100,7 +101,7 @@ function _civicrm_api3_option_value_create_spec(&$params) {
  * @param array $params
  *
  * @return array
- *   Api result
+ *   API result array
  */
 function civicrm_api3_option_value_delete($params) {
   // We will get the option group id before deleting so we can flush pseudoconstants.
index 54ff1db80e166b519e8b94f8505b9ac0ffc1a825..e7718589d95218664ffe61ceeb18ab084c39f6e3 100644 (file)
@@ -37,6 +37,7 @@
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_payment_processor_create($params) {
   if (empty($params['id']) && empty($params['payment_instrument_id'])) {
@@ -68,7 +69,7 @@ function _civicrm_api3_payment_processor_create_spec(&$params) {
  * @param array $params
  *
  * @return array
- *   API result Array
+ *   API result array
  */
 function civicrm_api3_payment_processor_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -81,7 +82,7 @@ function civicrm_api3_payment_processor_delete($params) {
  *   Array of name/value pairs.
  *
  * @return array
- *   details of found PaymentProcessor
+ *   API result array
  */
 function civicrm_api3_payment_processor_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
index f72075eddd03519693ead19a5adbeb802dcf34e3..e47b4b712b280ef41840146d98e37ed4f1baaaff 100644 (file)
@@ -42,7 +42,7 @@
  *   Array per getfields metadata.
  *
  * @return array
- *   details of found phones else error
+ *   API result array
  */
 function civicrm_api3_phone_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
index cbb7e8e5b5e58e626b958befa67b7f6a198379e7..66a19b965a48e967fbedbcf1d59d3bffce1c536f 100644 (file)
@@ -38,7 +38,7 @@
  *   Input parameters.
  *
  * @return array
- *   Details of found instances
+ *   API result array
  */
 function civicrm_api3_report_instance_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -50,6 +50,7 @@ function civicrm_api3_report_instance_get($params) {
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_report_instance_create($params) {
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -74,7 +75,7 @@ function _civicrm_api3_report_instance_create_spec(&$params) {
  * @param array $params
  *
  * @return array
- *   Api result
+ *   API result array
  */
 function civicrm_api3_report_instance_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
index bf0cea90d712461df70137438d4f910999662a95..19add4e91d493a97a4870f9273a4d0880d3f971e 100644 (file)
 /**
  * Retrieve a report template.
  *
- * FIXME This is a bare-minimum placeholder
- *
  * @param array $params
  *
  * @return array
- *   details of found Option Values
+ *   API result array
  */
 function civicrm_api3_report_template_get($params) {
   require_once 'api/v3/OptionValue.php';
@@ -57,6 +55,7 @@ function civicrm_api3_report_template_get($params) {
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_report_template_create($params) {
   require_once 'api/v3/OptionValue.php';
@@ -95,7 +94,7 @@ function _civicrm_api3_report_template_create_spec(&$params) {
  * @param array $params
  *
  * @return array
- *   Api result
+ *   API result array
  */
 function civicrm_api3_report_template_delete($params) {
   require_once 'api/v3/OptionValue.php';
@@ -109,7 +108,7 @@ function civicrm_api3_report_template_delete($params) {
  *   Input parameters.
  *
  * @return array
- *   details of found instances
+ *   API result array
  */
 function civicrm_api3_report_template_getrows($params) {
   civicrm_api3_verify_one_mandatory($params, NULL, array('report_id', 'instance_id'));
@@ -177,6 +176,7 @@ function _civicrm_api3_report_template_getrows($params) {
  * @param array $params
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_report_template_getstatistics($params) {
   list($rows, $reportInstance, $metadata) = _civicrm_api3_report_template_getrows($params);
index 21459c5dba8650d913fc2c3463688678353fe783..2ffe781adae938196aa25dfcb77fd304469da478 100644 (file)
@@ -45,6 +45,7 @@
  *   Array per getfields metadata.
  *
  * @return array
+ *   API result array
  */
 function civicrm_api3_tag_create($params) {
   return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
@@ -86,7 +87,7 @@ function civicrm_api3_tag_delete($params) {
  *   Array per getfields metadata.
  *
  * @return array
- *   details of found tags else error
+ *   API result array
  */
 function civicrm_api3_tag_get($params) {
 
index c808f580c44338db743030e860a3bff9cad43301..5f2776c4bed4056ad181a24f6b96125a86148936 100644 (file)
@@ -37,7 +37,7 @@
  * @param array $params
  *
  * @return array
- *   API result array.
+ *   API result array
  * @todo convert to using basic create - BAO function non-std
  */
 function civicrm_api3_website_create($params) {
@@ -69,7 +69,7 @@ function _civicrm_api3_website_create_spec(&$params) {
  * @param array $params
  *
  * @return array
- *   API result
+ *   API result array
  * @throws \API_Exception
  */
 function civicrm_api3_website_delete($params) {
@@ -95,7 +95,7 @@ function civicrm_api3_website_delete($params) {
  * @param array $params
  *
  * @return array
- *   details of found websites
+ *   API result array
  */
 function civicrm_api3_website_get($params) {
   return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Website');
index d45717fe3711f9fbcfb90576138a6b77c2df4229..2b10ae16bfb1621b2864ba0b12d50386a2e56457 100644 (file)
@@ -577,7 +577,7 @@ function contact_getfields_expectedresult() {
       'is_deceased' => array(
         'name' => 'is_deceased',
         'type' => 16,
-        'title' => 'Is Deceased',
+        'title' => 'Deceased',
         'import' => TRUE,
         'where' => 'civicrm_contact.is_deceased',
         'headerPattern' => '/i(s\\s)?d(eceased)$/i',
@@ -689,7 +689,7 @@ function contact_getfields_expectedresult() {
       'source' => array(
         'name' => 'source',
         'type' => 2,
-        'title' => 'Source of Contact Data',
+        'title' => 'Contact Source',
         'maxlength' => 255,
         'size' => 30,
         'import' => TRUE,
index 8e100bedf1cc9e5e7a3926934c8a452fee599646..6ef6552673d7dbceea4a27d88a6941a95c722336 100644 (file)
@@ -79,7 +79,7 @@ function mailing_gettokens_expectedresult() {
       '{contact.preferred_language}' => 'Preferred Language',
       '{contact.preferred_mail_format}' => 'Preferred Mail Format',
       '{contact.hash}' => 'Contact Hash',
-      '{contact.contact_source}' => 'Source of Contact Data',
+      '{contact.contact_source}' => 'Contact Source',
       '{contact.first_name}' => 'First Name',
       '{contact.middle_name}' => 'Middle Name',
       '{contact.last_name}' => 'Last Name',
index cd1d30db5e0a5711cc1957867a5527987c05f11a..dcf7b18e3fcdc590d0004db8710965007f7f5cbe 100644 (file)
@@ -362,6 +362,13 @@ CRM.strings = CRM.strings || {};
    * @param options object
    */
   $.fn.crmSelect2 = function(options) {
+    if (options === 'destroy') {
+      return $(this).each(function() {
+        $(this)
+          .removeClass('crm-ajax-select')
+          .select2('destroy');
+      });
+    }
     return $(this).each(function () {
       var
         $el = $(this),
@@ -396,6 +403,15 @@ CRM.strings = CRM.strings || {};
    * @param options object
    */
   $.fn.crmEntityRef = function(options) {
+    if (options === 'destroy') {
+      return $(this).each(function() {
+        var entity = $(this).data('api-entity') || '';
+        $(this)
+          .off('.crmEntity')
+          .removeClass('crm-form-entityref crm-' + entity.toLowerCase() + '-ref')
+          .crmSelect2('destroy');
+      });
+    }
     options = options || {};
     options.select = options.select || {};
     return $(this).each(function() {
index 0ebbb59373bd3e90809dc7d4b3136646489331b4..74f0c1ce8a1fe3f0b815de2bcf614d7b14ea7f53 100644 (file)
 
   CKEDITOR.document.getById( 'toolbarModifierWrapper' ).append( toolbarModifier.mainContainer );
 
-  $('.toolbar button:last', '#toolbarModifierWrapper').hide();
-
   $(function() {
     var selectorOpen = false,
       changedWhileOpen = false;
 
     $('#toolbarModifierForm')
-      // The buttons in the configurator are not submit buttons!
-      .on('click', 'button', function(e) {
-        e.preventDefault();
-      })
       .on('submit', function(e) {
         $('.toolbar button:last', '#toolbarModifierWrapper')[0].click();
         $('.configContainer textarea', '#toolbarModifierWrapper').attr('name', 'config');
index f7a4cbe122b0f16898e1045800fec917c5e8ecaf..55519fc8bfda210d4d70541882e6f5edd997ee0c 100644 (file)
      {else}
       <table class="form-layout-compressed">
             <tr class="crm-relationship-type-form-block-label_a_b">
-                <td class="label">{$form.label_a_b.label}</td>
+                <td class="label">{$form.label_a_b.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_relationship_type' field='label_a_b' id=$relationship_type_id}{/if}</td>
                 <td>{$form.label_a_b.html}<br />
                 <span class="description">{ts}Label for the relationship from Contact A to Contact B. EXAMPLE: Contact A is 'Parent of' Contact B.{/ts}</span></td>
             </tr>
             <tr class="crm-relationship-type-form-block-label_b_a">
-                <td class="label">{$form.label_b_a.label}</td>
+                <td class="label">{$form.label_b_a.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_relationship_type' field='label_b_a' id=$relationship_type_id}{/if}</td>
                 <td>{$form.label_b_a.html}<br />
                 <span class="description">{ts}Label for the relationship from Contact B to Contact A. EXAMPLE: Contact B is 'Child of' Contact A. You may leave this blank for relationships where the name is the same in both directions (e.g. Spouse).{/ts}</span></td>
             </tr>
@@ -54,7 +54,7 @@
                 <td>{$form.contact_types_b.html}</td>
             </tr>
             <tr class="crm-relationship-type-form-block-description">
-                <td class="label">{$form.description.label}</td>
+                <td class="label">{$form.description.label} {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_relationship_type' field='description' id=$relationship_type_id}{/if}</td>
                 <td>{$form.description.html}</td>
             </tr>
             <tr class="crm-relationship-type-form-block-is_active">
index 38a15486d8ca972a514c3469c5065e2037015977..1c8499dc466af7cc38a7bf651254ec3e96256c02 100644 (file)
@@ -8,7 +8,7 @@
     fields = [],
     getFieldData = {},
     params = {},
-    smartyStub,
+    smartyPhp,
     entityDoc,
     fieldTpl = _.template($('#api-param-tpl').html()),
     optionsTpl = _.template($('#api-options-tpl').html()),
       operator = $('.api-param-op', $row).val(),
       $valField = $('input.api-param-value', $row),
       multiSelect = isMultiSelect(name, operator),
-      currentVal = $valField.val();
+      currentVal = $valField.val(),
+      wasSelect = $valField.data('select2');
+    if (wasSelect) {
+      $valField.crmEntityRef('destroy');
+    }
+    $valField.attr('placeholder', ts('Value'));
     // Boolean fields only have 1 possible value
     if (_.includes(BOOL, operator)) {
-      if ($valField.data('select2')) {
-        $valField.select2('destroy');
-      }
       $valField.css('visibility', 'hidden').val('1');
       return;
     }
     $valField.css('visibility', '');
     // Option list or entityRef input
     if (isSelect(name, operator)) {
+      $valField.attr('placeholder', ts('- select -'));
       // Reset value before switching to a select from something else
-      if ($(this).is('.api-param-name') || !$valField.data('select2')) {
+      if ($(this).is('.api-param-name') || !wasSelect) {
         $valField.val('');
       }
       // When switching from multi-select to single select
       }
       // EntityRef
       else {
+        var entity = getFieldData[name].FKApiName;
+        $valField.attr('placeholder', entity == 'Contact' ? '[' + ts('Auto-Select Current User') + ']' : ts('- select -'));
         $valField.crmEntityRef({
-          entity: getFieldData[name].FKApiName,
+          entity: entity,
           select: {
             multiple: multiSelect,
-            minimumInputLength: _.includes(OPEN_IMMEDIATELY, getFieldData[name].FKApiName) ? 0 : 1
+            minimumInputLength: _.includes(OPEN_IMMEDIATELY, entity) ? 0 : 1
           }
         });
       }
-      return;
-    }
-    // Plain text input
-    if ($valField.data('select2')) {
-      $valField.select2('destroy');
     }
   }
 
 
   /**
    * Format value to look like php code
+   * TODO: Use short array syntax when we drop support for php 5.3
    * @param val
    */
   function phpFormat(val) {
   }
 
   /**
-   * Smarty doesn't support array literals so we provide a stub
+   * @param value string
    * @param js string
    * @param key string
    */
-  function smartyFormat(js, key) {
+  function smartyFormat(value, js, key) {
+    var varName = 'param_' + key.replace(/[. -]/g, '_').toLowerCase();
+    // Can't pass array literals directly into smarty so we add a php snippet
     if (_.includes(js, '[') || _.includes(js, '{')) {
-      smartyStub = true;
-      return '$' + key.replace(/[. -]/g, '_');
+      smartyPhp.push('$this->assign("'+ varName + '", '+ phpFormat(value) +');');
+      return '$' + varName;
     }
     return js;
   }
           name = 'options';
         }
       }
+      // Default for contact ref fields
+      if ($(this).is('.crm-contact-ref') && input === '') {
+        val = evaluate('user_contact_id', makeArray);
+      }
       if (name && val !== undefined) {
         params[name] = op === '=' ? val : (params[name] || {});
         if (op !== '=') {
    */
   function formatQuery() {
     var i = 0, q = {
-      smarty: "{crmAPI var='result' entity='" + entity + "' action='" + action + "'",
+      smarty: "{crmAPI var='result' entity='" + entity + "' action='" + action + "'" + (params.sequential ? '' : ' sequential=0'),
       php: "$result = civicrm_api3('" + entity + "', '" + action + "'",
       json: "CRM.api3('" + entity + "', '" + action + "'",
       drush: "drush cvapi " + entity + '.' + action + ' ',
       wpcli: "wp cv api " + entity + '.' + action + ' ',
-      rest: CRM.config.resourceBase + "extern/rest.php?entity=" + entity + "&action=" + action + "&json=" + JSON.stringify(params) + "&api_key=yourkey&key=sitekey"
+      rest: CRM.config.resourceBase + "extern/rest.php?entity=" + entity + "&action=" + action + "&api_key=yourkey&key=sitekey&json=" + JSON.stringify(params)
     };
-    smartyStub = false;
+    smartyPhp = [];
     $.each(params, function(key, value) {
       var js = JSON.stringify(value);
       if (!(i++)) {
       }
       q.php += "  '" + key + "' => " + phpFormat(value) + ",\n";
       q.json += "  \"" + key + '": ' + js;
-      q.smarty += ' ' + key + '=' + smartyFormat(js, key);
+      // smarty already defaults to sequential
+      if (key !== 'sequential') {
+        q.smarty += ' ' + key + '=' + smartyFormat(value, js, key);
+      }
       // FIXME: This is not totally correct cli syntax
       q.drush += key + '=' + js + ' ';
       q.wpcli += key + '=' + js + ' ';
     q.smarty += "}\n{foreach from=$result.values item=" + entity.toLowerCase() + "}\n  {$" + entity.toLowerCase() + ".some_field}\n{/foreach}";
     if (!_.includes(action, 'get')) {
       q.smarty = '{* Smarty API only works with get actions *}';
-    } else if (smartyStub) {
-      q.smarty = "{* Smarty does not have a syntax for array literals; assign complex variables from php *}\n" + q.smarty;
+    } else if (smartyPhp.length) {
+      q.smarty = "{php}\n  " + smartyPhp.join("\n  ") + "\n{/php}\n" + q.smarty;
     }
     $.each(q, function(type, val) {
       $('#api-' + type).text(val);
    * Note: We have to manually execute the ajax in order to add the secret extra "prettyprint" param
    */
   function execute() {
+    var footer;
     $('#api-result').html('<div class="crm-loading-element"></div>');
     $.ajax({
       url: CRM.url('civicrm/ajax/rest'),
       type: _.includes(action, 'get') ? 'GET' : 'POST',
       dataType: 'text'
     }).done(function(text) {
+      // There may be debug information appended to the end of the json string
+      var footerPos = text.indexOf("\n}<");
+      if (footerPos) {
+        footer = text.substr(footerPos + 2);
+        text = text.substr(0, footerPos + 2);
+      }
       $('#api-result').text(text);
       prettyPrint('#api-result');
+      if (footer) {
+        $('#api-result').append(footer);
+      }
     });
   }
 
       .on('change', 'input.api-param-name, select.api-param-op', renderValueField)
       .on('change', 'input.api-param-name, .api-option-name', function() {
         if ($(this).val() === '-' && $(this).data('select2')) {
-          $(this).select2('destroy');
-          $(this).val('').focus();
+          $(this)
+            .crmSelect2('destroy')
+            .val('')
+            .focus();
         }
       })
       .on('click', '.api-param-remove', function(e) {
index ed6ac69fc4d5945347d72d3bf094791a479226fc..03229c9ea177aac2418b664158e0c20b77df6b85 100644 (file)
   #api-params-table th:first-child,
   #api-params-table td:first-child {
     width: 35%;
+    min-width: 190px;
+  }
+  #api-params-table td[colspan] {
+    width: 100%;
   }
   #api-params-table td:first-child + td,
-  #api-params-table th:first-child + th,
+  #api-params-table th:first-child + th {
+    width: 140px;
+  }
+  #api-params-table td:first-child + td select {
+    width: 132px;
+  }
+  #api-params-table td:first-child + td + td,
+  #api-params-table th:first-child + th + th {
+    width: 65%
+  }
   #api-generated td:first-child {
-    width: 9em;
+    width: 60px;
   }
   #api-params {
     min-height: 1em;
@@ -65,6 +78,9 @@
   #api-params .red-icon {
     margin-top: .5em;
   }
+  .api-param-remove {
+    float: right;
+  }
   #mainTabContainer label {
     display: inline;
     font-weight: bold;
index 36a9de2b355aa1a7c42ca9bb33f4634f5207993d..7900a804289364f1f47614d30e5423b906397b14 100644 (file)
 {/htxt}
 
 {htxt id="id-internal-id-title"}
-  {ts}CiviCRM ID{/ts}
+  {ts}Contact ID{/ts}
 {/htxt}
 {htxt id="id-internal-id"}
 <p>{ts}Every contact in CiviCRM has a unique ID number. This number will never change and is the most accurate way of identifying a contact.{/ts}</p>
index aa4eebce9090c032dca8564b209c9cb45a5abb04..af546cae236d5f6ae6d933169065b86aa4fffc23 100644 (file)
@@ -63,7 +63,7 @@
               </td>
               {if $contactId}
                 <td>
-                  <label for="internal_identifier_display">{ts}CiviCRM ID{/ts} {help id="id-internal-id"}</label><br />
+                  <label for="internal_identifier_display">{ts}Contact ID{/ts} {help id="id-internal-id"}</label><br />
                   <input id="internal_identifier_display" type="text" class="crm-form-text six" size="6" readonly="readonly" value="{$contactId}">
                 </td>
               {/if}
index d30647c8556f7c889d6c1692083e3773730e74e9..50aad025b7bb88b6c186c4750d1e6b794d4e9c69 100644 (file)
     {if !empty($form.address.$blockId.postal_code)}
        <td>
           {$form.address.$blockId.postal_code.label}<br />
-          {$form.address.$blockId.postal_code.html}&nbsp;&nbsp;
-          {if !empty($form.address.$blockId.postal_code_suffix)}
+          {$form.address.$blockId.postal_code.html}
+       </td>
+      {if !empty($form.address.$blockId.postal_code_suffix)}
           <td>
-            {$form.address.$blockId.postal_code_suffix.label}<br/>
-            {$form.address.$blockId.postal_code_suffix.html} {help id="id-postal-code-suffix" file="CRM/Contact/Form/Contact.hlp"}
+            {$form.address.$blockId.postal_code_suffix.label} {help id="id-postal-code-suffix" file="CRM/Contact/Form/Contact.hlp"}<br/>
+            {$form.address.$blockId.postal_code_suffix.html}
           <td>
-          {/if}
-       </td>
+      {/if}
     {/if}
     <td colspan="2">&nbsp;&nbsp;</td>
 </tr>
index 4886e0bd9f4f48952ef73c394630e985cfc10f2b..6ad8685cccda90daa71af0763e7b0224a563efef 100644 (file)
@@ -35,7 +35,7 @@
         <tr id="id_existing_group">
             <td>
                 <table class="form-layout">
-                <tr><td class="label">{$form.group_id.label}<span class="marker">*</span></td><td>{$form.group_id.html}</td></tr>
+                <tr><td class="label">{$form.group_id.label}<span class="crm-marker">*</span></td><td>{$form.group_id.html}</td></tr>
                 </table>
             </td>
         </tr>
@@ -43,7 +43,7 @@
             <td>
                 <table class="form-layout">
                 <tr class="crm-contact-task-addtogroup-form-block-title">
-                   <td class="label">{$form.title.label}<span class="marker">*</span></td>
+                   <td class="label">{$form.title.label}<span class="crm-marker">*</span></td>
                    <td>{$form.title.html}</td>
                 <tr>
                 <tr class="crm-contact-task-addtogroup-form-block-description">
index 6cd6b78bb5f516742660a2f9e34715ed8d6e3b05..58167d6a07affd38594f94198a968ac180804033 100644 (file)
 *}
 {* template for custom data *}
 {assign var="customDataGroupName" value=$customDataGroup.name}
+{strip}
+  {if $displayStyle neq 'tableOriented' and ($action eq 16 or $action eq 4)} {* Browse or View actions *}
+    <div class="form-item">
+      {include file="CRM/Custom/Page/CustomDataView.tpl"}
+    </div>
+  {/if}
+{/strip}
 {foreach from=$viewCustomData item=customGroupWrapper}
   {foreach from=$customGroupWrapper item=customGroup key=customGroupId}
     {assign var="customRegion" value='contact-custom-data-'|cat:$customGroup.name}
           </script>
         {/literal}
       {else}
-        {strip}
-          {if $action eq 16 or $action eq 4} {* Browse or View actions *}
-            <div class="form-item">
-              {include file="CRM/Custom/Page/CustomDataView.tpl"}
-            </div>
-          {/if}
-        {/strip}
-
         {if $mainEditForm}
           <script type="text/javascript">
             var showBlocks1 = new Array({$showBlocks1});
index 255403d894a2cbee51a8030de3467641be17bfd3..587cef2926e0678a5fa3aea77e7200e93f2eb5ab 100644 (file)
                     </div>
                     <div class="crm-summary-row">
                       <div class="crm-label">
-                        {ts}CiviCRM ID{/ts}{if !empty($userRecordUrl)} / {ts}User ID{/ts}{/if}
+                        {ts}Contact ID{/ts}{if !empty($userRecordUrl)} / {ts}User ID{/ts}{/if}
                       </div>
                       <div class="crm-content">
                         <span class="crm-contact-contact_id">{$contactId}</span>
index 104ff3092d87ccbcb2413af796128b6e9017f046..cbea7c28361111d5c8ad716f1426afe892f491c2 100644 (file)
@@ -29,7 +29,7 @@
      <tr class="columnheader">
        <th>{ts}Amount{/ts}</th>
        <th>{ts}Type{/ts}</th>
-       <th>{ts}Paid By{/ts}</th>
+       <th>{ts}Payment Method{/ts}</th>
        <th>{ts}Received{/ts}</th>
        <th>{ts}Transaction ID{/ts}</th>
        <th>{ts}Status{/ts}</th>
@@ -85,7 +85,7 @@
       <td class="font-size12pt label"><strong>{ts}Participant{/ts}</strong></td><td class="font-size12pt"><strong>{$displayName}</strong></td>
     </tr>
     {if $contributionMode}
-      <tr class="crm-payment-form-block-payment_processor_id"><td class="label nowrap">{$form.payment_processor_id.label}<span class="marker"> * </span></td><td>{$form.payment_processor_id.html}</td></tr>
+      <tr class="crm-payment-form-block-payment_processor_id"><td class="label nowrap">{$form.payment_processor_id.label}<span class="crm-marker"> * </span></td><td>{$form.payment_processor_id.html}</td></tr>
     {/if}
     <tr>
       <td class='label'>{ts}Event{/ts}</td><td>{$eventName}</td>
index c50573f9e4d99185d2d57ea7476906662922741e..603cc2438b039ca50fdd949b7ed0e483e867817b 100644 (file)
@@ -30,7 +30,7 @@
 {elseif $showAdditionalInfo and $formType }
   {include file="CRM/Contribute/Form/AdditionalInfo/$formType.tpl"}
 {else}
-
+  {include file="CRM/Contribute/Form/AdditionalInfo/Payment.tpl"}
   <div class="crm-block crm-form-block crm-contribution-form-block">
 
   {if !$email and $action neq 8 and $context neq 'standalone'}
@@ -78,7 +78,7 @@
       <td>{$form.contact_id.html}</td>
     {/if}
     {if $contributionMode}
-      <tr class="crm-contribution-form-block-payment_processor_id"><td class="label nowrap">{$form.payment_processor_id.label}<span class="marker"> * </span></td><td>{$form.payment_processor_id.html}</td></tr>
+      <tr class="crm-contribution-form-block-payment_processor_id"><td class="label nowrap">{$form.payment_processor_id.label}<span class="crm-marker"> * </span></td><td>{$form.payment_processor_id.html}</td></tr>
     {/if}
     <tr class="crm-contribution-form-block-contribution_type_id crm-contribution-form-block-financial_type_id">
       <td class="label">{$form.financial_type_id.label}</td><td{$valueStyle}>{$form.financial_type_id.html}&nbsp;
index c80e01cd7e9ce08fae3edc4345f0854376044b94..d56b63dd49f973af6bc8e28728f1c64378b484ce 100644 (file)
@@ -94,7 +94,7 @@
   {if $pledgeBlock}
     {if $is_pledge_payment}
     <div class="crm-section {$form.pledge_amount.name}-section">
-      <div class="label">{$form.pledge_amount.label}&nbsp;<span class="marker">*</span></div>
+      <div class="label">{$form.pledge_amount.label}&nbsp;<span class="crm-marker">*</span></div>
       <div class="content">{$form.pledge_amount.html}</div>
       <div class="clear"></div>
     </div>
index 2e017afbdad94fa380714c6caeec8e2bb22e1505..6ff51dd85e59034a1221bafe1b46ee353ab71c30 100644 (file)
         <tr id="payLaterFields" class="crm-contribution-form-block-payLaterFields"><td>&nbsp;</td>
             <td>
             <table class="form-layout">
-                <tr class="crm-contribution-contributionpage-amount-form-block-pay_later_text"><th scope="row" class="label">{$form.pay_later_text.label} <span class="marker" title="This field is required.">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='pay_later_text' id=$contributionPageID}{/if}</th>
+                <tr class="crm-contribution-contributionpage-amount-form-block-pay_later_text"><th scope="row" class="label">{$form.pay_later_text.label} <span class="crm-marker" title="This field is required.">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='pay_later_text' id=$contributionPageID}{/if}</th>
                 <td>{$form.pay_later_text.html|crmAddClass:big}<br />
                     <span class="description">{ts}Text displayed next to the checkbox for the 'pay later' option on the contribution form. You may include HTML formatting tags.{/ts}</span></td></tr>
-                <tr class="crm-contribution-contributionpage-amount-form-block-pay_later_receipt"><th scope="row" class="label">{$form.pay_later_receipt.label} <span class="marker" title="This field is required.">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='pay_later_receipt' id=$contributionPageID}{/if}</th>
+                <tr class="crm-contribution-contributionpage-amount-form-block-pay_later_receipt"><th scope="row" class="label">{$form.pay_later_receipt.label} <span class="crm-marker" title="This field is required.">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_contribution_page' field='pay_later_receipt' id=$contributionPageID}{/if}</th>
                 <td>{$form.pay_later_receipt.html|crmAddClass:big}<br />
                   <span class="description">{ts}Instructions added to Confirmation and Thank-you pages, as well as the confirmation email, when the user selects the 'pay later' option (e.g. 'Mail your check to ... within 3 business days.').{/ts}</span></td></tr>
 
         <tr id="recurFields" class="crm-contribution-form-block-recurFields"><td>&nbsp;</td>
                <td>
                   <table class="form-layout-compressed">
-            <tr class="crm-contribution-form-block-recur_frequency_unit"><th scope="row" class="label">{$form.recur_frequency_unit.label}<span class="marker" title="This field is required.">*</span></th>
+            <tr class="crm-contribution-form-block-recur_frequency_unit"><th scope="row" class="label">{$form.recur_frequency_unit.label}<span class="crm-marker" title="This field is required.">*</span></th>
                         <td>{$form.recur_frequency_unit.html}<br />
                         <span class="description">{ts}Select recurring units supported for recurring payments.{/ts}</span></td>
                     </tr>
             </tr>
             <tr id="pledgeFields" class="crm-contribution-form-block-pledgeFields"><td></td><td>
                 <table class="form-layout-compressed">
-                    <tr class="crm-contribution-form-block-pledge_frequency_unit"><th scope="row" class="label">{$form.pledge_frequency_unit.label}<span class="marker"> *</span></th>
+                    <tr class="crm-contribution-form-block-pledge_frequency_unit"><th scope="row" class="label">{$form.pledge_frequency_unit.label}<span class="crm-marker"> *</span></th>
                         <td>{$form.pledge_frequency_unit.html}<br />
                             <span class="description">{ts}Which frequencies can the user pick from (e.g. every 'week', every 'month', every 'year')?{/ts}</span></td>
                     </tr>
             {/if}
 
       <tr class="crm-contribution-form-block-amount_label">
-              <th scope="row" class="label" width="20%">{$form.amount_label.label}<span class="marker"> *</span></th>
+              <th scope="row" class="label" width="20%">{$form.amount_label.label}<span class="crm-marker"> *</span></th>
         <td>{$form.amount_label.html}</td>
       </tr>
             <tr class="crm-contribution-form-block-is_allow_other_amount"><th scope="row" class="label" width="20%">{$form.is_allow_other_amount.label}</th>
index b07f00f87f215218f9c3d20526b155e692d9f003..2be357ecd70b81949069992df892b859a08ebc36 100644 (file)
           </tr>
           <tr class="crm-contribution-contributionpage-premium-form-block-premiums_nothankyou_label">
             <td class="label">
-              {$form.premiums_nothankyou_label.label}<span class="marker"> *</span>
+              {$form.premiums_nothankyou_label.label}<span class="crm-marker"> *</span>
             </td>
             <td class="html-adjust">{$form.premiums_nothankyou_label.html}<br/>
               <span class="description">{ts}You can change the text for the 'No thank-you' radio button.{/ts}</span>
index 16df77ada03496b78498baccf31ef876d7a74461..a3c770ea90b4a32b26348f4d41651c33ab520dd8 100644 (file)
 
     <div id="widgetFields">
         <table class="form-layout-compressed">
-            <tr class="crm-contribution-contributionpage-widget-form-block-title"><td class="label">{$form.title.label}<span class="marker"> *</span></td><td>{$form.title.html}</td></tr>
+            <tr class="crm-contribution-contributionpage-widget-form-block-title"><td class="label">{$form.title.label}<span class="crm-marker"> *</span></td><td>{$form.title.html}</td></tr>
             <tr class="crm-contribution-form-block-url_logo"><td class="label">{$form.url_logo.label}</span></td><td>{$form.url_logo.html}</td></tr>
             <tr class="crm-contribution-contributionpage-widget-form-block-button_title"><td class="label">{$form.button_title.label}</td><td>{$form.button_title.html}</td></tr>
-            <tr class="crm-contribution-contributionpage-widget-form-block-about"><td class="label">{$form.about.label}<span class="marker"> *</span></td><td>{$form.about.html}
+            <tr class="crm-contribution-contributionpage-widget-form-block-about"><td class="label">{$form.about.label}<span class="crm-marker"> *</span></td><td>{$form.about.html}
 <br /><span class="description">{ts}Enter content for the about message. You may include HTML formatting tags. You can also include images, as long as they are already uploaded to a server - reference them using complete URLs.{/ts}</span>
 </td></tr>
 
@@ -96,7 +96,7 @@
             </div>
             <table class="form-layout-compressed">
             {foreach from=$colorFields item=field key=fieldName}
-              <tr><td class="label">{$form.$fieldName.label}<span class="marker"> *</span></td><td>{$form.$fieldName.html}</td></tr>
+              <tr><td class="label">{$form.$fieldName.label}<span class="crm-marker"> *</span></td><td>{$form.$fieldName.html}</td></tr>
             {/foreach}
             </table>
          </div><!-- /.crm-accordion-body -->
index ba909ddca56ea61b933e94bf887d80707ea45925..ddefa433ea6bb2e5ead4ba2a4b2d0d6d5f0f55b8 100644 (file)
     {/if}
   {/if}
   <tr>
-    <td class="label">{ts}Paid By{/ts}</td>
+    <td class="label">{ts}Payment Method{/ts}</td>
     <td>{$payment_instrument}{if $payment_processor_name} ({$payment_processor_name}){/if}</td>
   </tr>
 
index 2a2f3c71ee47dc666a6bc9ae2596529cc9da923c..885b0811be7ebc4e20714c60e1118bf19b3ee9cc 100644 (file)
@@ -23,9 +23,9 @@
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
-{* this template is used for adding/editing/deleting Payment-Instrument  *}
+{* this template is used for adding/editing/deleting Payment-Method  *}
 <div class="crm-block crm-form-block crm-contribution-payment_instrument-form-block">
-<fieldset><legend>{if $action eq 1}{ts}New Payment Instrument{/ts}{elseif $action eq 2}{ts}Edit Payment Instrument{/ts}{else}{ts}Delete Payment Instrument{/ts}{/if}</legend>
+<fieldset><legend>{if $action eq 1}{ts}New Payment Method{/ts}{elseif $action eq 2}{ts}Edit Payment Method{/ts}{else}{ts}Delete Payment Method{/ts}{/if}</legend>
   <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div>
    {if $action eq 8}
       <div class="messages status no-popup">
index 056b65c142973ea8a33e7b3aae6af5a2919758f4..b06d5ac0b757d1ba5fb762bd6a69657b04947717 100644 (file)
@@ -24,7 +24,7 @@
  +--------------------------------------------------------------------+
 *}
 
-<tr><td><label>{ts}Contribution Dates{/ts}</label></td></tr>
+<tr><td><label>{ts}Date Received{/ts}</label></td></tr>
 <tr>
 {include file="CRM/Core/DateRange.tpl" fieldName="contribution_date" from='_low' to='_high'}
 </tr>
index 1ac91f1639a14d1cc8637db7ac92dafe5d2390a9..a1894a14c83439e62b045149d6e56fbb1dba20e7 100644 (file)
@@ -39,7 +39,7 @@
     <th class="right">{ts}Amount{/ts}&nbsp;&nbsp;</th>
     <th>{ts}Source{/ts}</th>
     <th>{ts}Fee Amount{/ts}</th>
-    <th>{ts}Paid By{/ts}</th>
+    <th>{ts}Payment Method{/ts}</th>
     <th>{ts}Check{/ts} #</th>
     <th>{ts}Transaction ID{/ts}</th>
     <th>{ts}Transaction Date{/ts}</th>
index 687c350af14078e4fe86e40c155ac6bb919c0299..b6f447f72e564881bf5d80402533963b926ee899 100644 (file)
 {/htxt}
 
 {htxt id="payment_instrument_id-title"}
-  {ts}Payment Instrument{/ts}
+  {ts}Payment Method{/ts}
 {/htxt}
 {htxt id="payment_instrument_id"}
   <p>
     {ts}Choose the method by which this transaction was paid.{/ts}
   </p><p>
-    {ts}Note: if the correct payment instrument is not listed here (e.g. for in-kind donations) ask your administrator to add a new option to this list.{/ts}
+    {ts}Note: if the correct payment method is not listed here (e.g. for in-kind donations) ask your administrator to add a new option to this list.{/ts}
   </p>
 
 {/htxt}
index 5e09486d53553b5ea1e576103484b1875d926d8f..b86021d6560fff56d68ac6d1ab3e128e6c17ba66 100644 (file)
@@ -25,7 +25,7 @@
 *}
 {crmRegion name="billing-block"}
 <div id="payment_information">
-  {if $paymentFields|@count && (!$form.$expressButtonName || $paymentProcessor.payment_processor_type EQ 'PayPal')}
+  {if $paymentFields|@count}
     <fieldset class="billing_mode-group {$paymentTypeName}_info-group">
       <legend>
         {$paymentTypeLabel}
index 3a4bf9d472afd437ad6cba79b3bf13da753480fe..e8b7fb9fdf222a5065bef0861b34a3c3a48ba496 100644 (file)
@@ -27,6 +27,6 @@
   {ts}Importing Multi-value Custom Data{/ts}
 {/htxt}
 {htxt id="upload"}
-  {ts}The import file should contain a row for each set of custom data fields. For example, if you are importing employment history for a group of contacts, each row might contain columns for Employer, Start Date, End Date, and Position. You will also need a column containing the CiviCRM Internal Contact ID which is used to match each row to the corresponding (existing) CiviCRM contact record. NOTE: Contact IDs are included by default when exporting contacts from CiviCRM.{/ts}
+  {ts}The import file should contain a row for each set of custom data fields. For example, if you are importing employment history for a group of contacts, each row might contain columns for Employer, Start Date, End Date, and Position. You will also need a column containing the CiviCRM Contact ID which is used to match each row to the corresponding (existing) CiviCRM contact record. NOTE: Contact IDs are included by default when exporting contacts from CiviCRM.{/ts}
 {/htxt}
 
index a430b98567cca5d602fc966e8f4a2b8fdb2519ea..f2b9c42aa1299612c3ca816eebeb8cef4e0da8db 100644 (file)
                     <td class="label">{ts}Selections{/ts}</td>
                     <td>{include file="CRM/Price/Page/LineItem.tpl" context="Event"}</td>
                 </tr>
-                <tr>
-                  <td></td>
-                  <td>
-                    <a class="action-item crm-hover-button" href='{crmURL p="civicrm/event/participant/feeselection" q="reset=1&id=`$participantId`&cid=`$contactId`&action=update"}'><span class="icon ui-icon-pencil"></span> {ts}Change Selections{/ts}</a>
-                  </td>
-                </tr>
             {else}
                 <tr class="crm-event-eventfees-form-block-event_level">
                     <td class="label">{ts}Event Level{/ts}</td>
                     <td>{$fee_level}&nbsp;{if $fee_amount}- {$fee_amount|crmMoney:$fee_currency}{/if}</td>
                 </tr>
             {/if}
+            <tr>
+              <td></td>
+              <td>
+                <a class="action-item crm-hover-button" href='{crmURL p="civicrm/event/participant/feeselection" q="reset=1&id=`$participantId`&cid=`$contactId`&action=update"}'><span class="icon ui-icon-pencil"></span> {ts}Change Selections{/ts}</a>
+              </td>
+            </tr>
         {else} {* New participant *}
   {if $priceSet.fields}
       <fieldset id="priceset" class="crm-group priceset-group">
@@ -79,7 +79,7 @@
            <fieldset><legend>{ts}Payment Information{/ts}</legend>
              <table id="recordContribution" class="form-layout" style="width:auto;">
                 <tr class="crm-event-eventfees-form-block-financial_type_id">
-                    <td class="label">{$form.financial_type_id.label}<span class="marker"> *</span></td>
+                    <td class="label">{$form.financial_type_id.label}<span class="crm-marker"> *</span></td>
                     <td>{$form.financial_type_id.html}<br /><span class="description">{ts}Select the appropriate financial type for this payment.{/ts}</span></td>
                 </tr>
                 <tr class="crm-event-eventfees-form-block-total_amount"><td class="label">{$form.total_amount.label}</td><td>{$form.total_amount.html|crmMoney:$currency}</td></tr>
@@ -87,7 +87,7 @@
                     <td class="label" >{$form.receive_date.label}</td>
                     <td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
                 </tr>
-                <tr class="crm-event-eventfees-form-block-payment_instrument_id"><td class="label">{$form.payment_instrument_id.label}<span class="marker"> *</span></td><td>{$form.payment_instrument_id.html} {help id="payment_instrument_id" file="CRM/Contribute/Page/Tab.hlp"}</td></tr>
+                <tr class="crm-event-eventfees-form-block-payment_instrument_id"><td class="label">{$form.payment_instrument_id.label}<span class="crm-marker"> *</span></td><td>{$form.payment_instrument_id.html} {help id="payment_instrument_id" file="CRM/Contribute/Page/Tab.hlp"}</td></tr>
                 <tr id="checkNumber" class="crm-event-eventfees-form-block-check_number"><td class="label">{$form.check_number.label}</td><td>{$form.check_number.html|crmAddClass:six}</td></tr>
                 {if $showTransactionId }
                     <tr class="crm-event-eventfees-form-block-trxn_id"><td class="label">{$form.trxn_id.label}</td><td>{$form.trxn_id.html}</td></tr>
index a9679fac9e3757cd4d0f888d03321463d3a238a7..272282bd5003919b3090f02382ff67a75071699d 100644 (file)
@@ -83,7 +83,7 @@
 
         <table id="payLaterOptions" class="form-layout">
             <tr class="crm-event-manage-fee-form-block-pay_later_text">
-               <td class="label">{$form.pay_later_text.label}<span class="marker"> *</span> </td>
+               <td class="label">{$form.pay_later_text.label}<span class="crm-marker"> *</span> </td>
                <td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='pay_later_text' id=$id}{/if}{$form.pay_later_text.html|crmAddClass:big}
                </td>
             </tr>
@@ -92,7 +92,7 @@
                <td class="description">{ts}Text displayed next to the checkbox for the 'pay later' option on the contribution form. You may include HTML formatting tags.{/ts}</td>
             </tr>
             <tr class="crm-event-manage-fee-form-block-pay_later_receipt">
-               <td class="label">{$form.pay_later_receipt.label}<span class="marker"> *</span> </td>
+               <td class="label">{$form.pay_later_receipt.label}<span class="crm-marker"> *</span> </td>
                <td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='pay_later_receipt' id=$id}{/if}{$form.pay_later_receipt.html|crmAddClass:big}
                </td>
             </tr>
 
         <table id="contributionType" class="form-layout">
             <tr class="crm-event-manage-fee-form-block-fee_label">
-               <td class="label">{$form.fee_label.label}<span class="marker"> *</span>
+               <td class="label">{$form.fee_label.label}<span class="crm-marker"> *</span>
                </td>
                <td>{if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='fee_label' id=$id}{/if}{$form.fee_label.html}
                </td>
                </td>
             </tr>
             <tr class="crm-event-manage-fee-form-block-financial_type_id">
-               <td class="label">{$form.financial_type_id.label}<span class="marker"> *</span></td>
+               <td class="label">{$form.financial_type_id.label}<span class="crm-marker"> *</span></td>
                <td>{$form.financial_type_id.html}</td>
             </tr>
             <tr>
index 3e94946cff1ebd85054e07614e5f8efe563440ad..e5dcdc58bfcd00ac19cc3415d5d604f8c789036f 100644 (file)
@@ -247,7 +247,7 @@ class="crm-hover-button crm-button-add-profile"><span
     <table class="form-layout-compressed">
       <tr class="crm-event-manage-registration-form-block-confirm_title">
         <td scope="row" class="label" width="20%">{$form.confirm_title.label} <span
-            class="marker">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='confirm_title' id=$eventID}{/if}
+            class="crm-marker">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='confirm_title' id=$eventID}{/if}
         </td>
         <td>{$form.confirm_title.html}<br/>
                 <span
@@ -278,7 +278,7 @@ class="crm-hover-button crm-button-add-profile"><span
   <table class="form-layout-compressed">
     <tr class="crm-event-manage-registration-form-block-confirm_thankyou_title">
       <td scope="row" class="label" width="20%">{$form.thankyou_title.label} <span
-          class="marker">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='thankyou_title' id=$eventID}{/if}
+          class="crm-marker">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='thankyou_title' id=$eventID}{/if}
       </td>
       <td>{$form.thankyou_title.html}
         <div class="description">{ts}Page title for registration Thank-you screen.{/ts}</div>
@@ -328,14 +328,14 @@ class="crm-hover-button crm-button-add-profile"><span
         </tr>
         <tr class="crm-event-manage-registration-form-block-confirm_from_name">
           <td scope="row" class="label" width="20%">{$form.confirm_from_name.label} <span
-              class="marker">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='confirm_from_name' id=$eventID}{/if}
+              class="crm-marker">*</span> {if $action == 2}{include file='CRM/Core/I18n/Dialog.tpl' table='civicrm_event' field='confirm_from_name' id=$eventID}{/if}
           </td>
           <td>{$form.confirm_from_name.html}<br/>
             <span class="description">{ts}FROM name for email.{/ts}</span>
           </td>
         </tr>
         <tr class="crm-event-manage-registration-form-block-confirm_from_email">
-          <td scope="row" class="label" width="20%">{$form.confirm_from_email.label} <span class="marker">*</span></td>
+          <td scope="row" class="label" width="20%">{$form.confirm_from_email.label} <span class="crm-marker">*</span></td>
           <td>{$form.confirm_from_email.html}<br/>
             <span
               class="description">{ts}FROM email address (this must be a valid email account with your SMTP email service provider).{/ts}</span>
index 3444d7f7db331e2d2f265dd55c1f3d40e4145d1e..016a77e8624662d5139aa3f8e1be8f3dceb073bc 100644 (file)
@@ -56,7 +56,7 @@
     {if $paidEvent}
         <table class="form-layout-compressed">
             <tr class="crm-event-additionalparticipant-form-block-amount">
-                <td class="label nowrap">{$event.fee_label} <span class="marker">*</span></td>
+                <td class="label nowrap">{$event.fee_label} <span class="crm-marker">*</span></td>
                 <td>&nbsp;</td>
                 <td>{$form.amount.html}</td>
             </tr>
index 661f9f23139ea93090ff84b780611282b4df2f02..10979ded02479e44e7023e0c42eeeeb661e301fa 100644 (file)
@@ -35,7 +35,7 @@
         <tr id="id_existing_group">
             <td>
                 <table class="form-layout">
-                <tr><td class="label">{$form.group_id.label}<span class="marker">*</span></td><td>{$form.group_id.html}</td></tr>
+                <tr><td class="label">{$form.group_id.label}<span class="crm-marker">*</span></td><td>{$form.group_id.html}</td></tr>
                 </table>
             </td>
         </tr>
@@ -43,7 +43,7 @@
             <td>
                 <table class="form-layout">
                 <tr class="crm-contact-task-addtogroup-form-block-title">
-                   <td class="label">{$form.title.label}<span class="marker">*</span></td>
+                   <td class="label">{$form.title.label}<span class="crm-marker">*</span></td>
                    <td>{$form.title.html}</td>
                 <tr>
                 <tr class="crm-contact-task-addtogroup-form-block-description">
index 26b8165e4312f4b8b46d26d1f978c081dcfa6a5d..754812d357596ea2f484d2dcecb3e6e666514483 100644 (file)
@@ -55,7 +55,7 @@
     <tr>
       <th class="crm-batch-checkbox">{$form.toggleSelect.html}</th>
       <th class="crm-batch-name">{ts}Batch Name{/ts}</th>
-      <th class="crm-batch-payment_instrument">{ts}Payment Instrument{/ts}</th>
+      <th class="crm-batch-payment_instrument">{ts}Payment Method{/ts}</th>
       <th class="crm-batch-item_count">{ts}Item Count{/ts}</th>
       <th class="crm-batch-total">{ts}Total Amount{/ts}</th>
       <th class="crm-batch-status">{ts}Status{/ts}</th>
index 732db89fdd20b71eaef647aabc1d7d3c30870168..f915ce9de071993f4dc421dace8c1970b2296529 100644 (file)
@@ -30,7 +30,7 @@
     {capture assign="typeLink"}{crmURL p="civicrm/admin/financial/financialType" q="reset=1"}{/capture}
     {capture assign="paymentLink"}{crmURL p="civicrm/admin/options/payment_instrument" q="reset=1"}{/capture}
     {capture assign="premiumLink"}{crmURL p="civicrm/admin/contribute/managePremiums" q="reset=1"}{/capture}
-    <p>{ts 1=$typeLink 2=$paymentLink 3=$premiumLink}Financial accounts correspond to those in your accounting system.  <a href="%1">Financial types</a>, <a href="%2">payment instruments</a>, and <a href="%3">premiums</a> are associated with financial accounts so that they can result in the proper double-entry transactions to export to your accounting system.{/ts}</p>
+    <p>{ts 1=$typeLink 2=$paymentLink 3=$premiumLink}Financial accounts correspond to those in your accounting system.  <a href="%1">Financial types</a>, <a href="%2">payment methods</a>, and <a href="%3">premiums</a> are associated with financial accounts so that they can result in the proper double-entry transactions to export to your accounting system.{/ts}</p>
   </div>
   {if $action ne 1 and $action ne 2}
     <div class="action-link">
index 3c98610de4ee4b89ebaf817126fe2151582057cc..6e773d9076f951dd885b5fe0bbc767c614d65bd7 100644 (file)
  +--------------------------------------------------------------------+
 *}
 {htxt id="payment_instrument-title"}
-  {ts}Payment Instrument{/ts}
+  {ts}Payment Method{/ts}
 {/htxt}
 {htxt id="payment_instrument"}
 <p>
-  {ts}If you specify a payment instrument then this batch will be limited to exporting only transactions paid with that method.{/ts}
+  {ts}If you specify a payment method then this batch will be limited to exporting only transactions paid with that method.{/ts}
 </p>
 <p>
-  {ts}Note that not all transactions are necessarily associated with a payment instrument.{/ts}
+  {ts}Note that not all transactions are necessarily associated with a payment method.{/ts}
 </p>
 {/htxt}
 
index 32e6a7fa87c4b5a18e1296d0e1265e73151d73bc..8222f118a576f287c3a3baad2034d639c2f0fc11 100644 (file)
           </tr>
           <tr class="crm-membership-form-block-record_contribution"><td colspan="2">
             <fieldset id="recordContribution"><legend>{ts}Membership Payment and Receipt{/ts}</legend>
-         {/if}
-        {include file="CRM/Member/Form/MembershipCommon.tpl"}
+
+          {include file="CRM/Member/Form/MembershipCommon.tpl"}
+        {/if}
 
         {if $emailExists and $outBound_option != 2}
           <tr id="send-receipt" class="crm-membership-form-block-send_receipt">
index 33dc642b983842455d6b0754a68ea7101247ba85..2dfd7f2b4eee8a21a28da1c66466b23013697822 100644 (file)
   {if $form.target_entity_type}
   <table class="form-layout">
     <tr  class="crm-contribution-contributionpage-pcp-form-block-target_entity_type">
-        <td class="label">{$form.target_entity_type.label} <span class="marker"> *</span></td>
+        <td class="label">{$form.target_entity_type.label} <span class="crm-marker"> *</span></td>
         <td>{$form.target_entity_type.html} {help id="id-target_entity_type"}</td>
     </tr>
   </table>
   <div id="pcpDetailFields" {if $form.target_entity_type.value[0] == 'event'} style="display:none;"{/if}>
     <table class="form-layout">
       <tr class="crm-contribution-contributionpage-pcp-form-block-target_entity_id" id="pcpDetailFields">
-          <td class="label">{$form.target_entity_id.label} <span class="marker"> *</span></td>
+          <td class="label">{$form.target_entity_id.label} <span class="crm-marker"> *</span></td>
           <td>{$form.target_entity_id.html} {help id="id-target_entity_id"}</td>
       </tr>
     </table>
index 402f128dc591362f08401bee14557def18c2e1c5..2873c8718a5e3cca44e4fce42ed4591639051253 100644 (file)
@@ -28,7 +28,7 @@
 <div class="crm-footer" id="crm-record-log">
   <span class="col1">
     {if !empty($external_identifier)}{ts}External ID{/ts}:&nbsp;{$external_identifier}{/if}
-    {if $action NEQ 2}&nbsp; &nbsp;{ts}CiviCRM ID{/ts}:&nbsp;{$contactId}{/if}
+    {if $action NEQ 2}&nbsp; &nbsp;{ts}Contact ID{/ts}:&nbsp;{$contactId}{/if}
   </span>
   {if !empty($lastModified)}
     {ts}Last Change by{/ts}: <a href="{crmURL p='civicrm/contact/view' q="action=view&reset=1&cid=`$lastModified.id`"}">{$lastModified.name}</a> ({$lastModified.date|crmDate}) &nbsp;
index b8f1eb559240790d4ad4573c713a449c2274bf76..11c6a97df12c6dd402b58183255daffb45102809 100644 (file)
@@ -38,7 +38,7 @@
         </form>
         <ul>
           <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" checked="checked" value="" name="quickSearchField">{ts}Name/Email{/ts}</label></li>
-          <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="contact_id" name="quickSearchField">{ts}CiviCRM ID{/ts}</label></li>
+          <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="contact_id" name="quickSearchField">{ts}Contact ID{/ts}</label></li>
           <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="external_identifier" name="quickSearchField">{ts}External ID{/ts}</label></li>
           <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="first_name" name="quickSearchField">{ts}First Name{/ts}</label></li>
           <li><label class="crm-quickSearchField"><input type="radio" data-tablename="cc" value="last_name" name="quickSearchField">{ts}Last Name{/ts}</label></li>
index edfdbfe83ea3e55799c1c83d567ef6268645805d..35d76e0492c8f92e309e2677eda14000c09f1014 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 require_once 'CiviTest/CiviUnitTestCase.php';
@@ -42,7 +40,6 @@ require_once 'CiviTest/Custom.php';
 class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase {
   public function testTypeCheckWithValidInput() {
 
-    $values = array();
     $values = array(
       'Memo' => 'Test1',
       'String' => 'Test',
@@ -66,7 +63,6 @@ class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase {
   }
 
   public function testTypeCheckWithInvalidInput() {
-    $values = array();
     $values = array('check1' => 'chk');
     foreach ($values as $type => $value) {
       $valid = CRM_Core_BAO_CustomValue::typecheck($type, $value);
@@ -75,7 +71,6 @@ class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase {
   }
 
   public function testTypeCheckWithWrongInput() {
-    $values = array();
     $values = array(
       'String' => 1,
       'Boolean' => 'US',
@@ -87,7 +82,6 @@ class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase {
   }
 
   public function testTypeToFieldWithValidInput() {
-    $values = array();
     $values = array(
       'String' => 'char_data',
       'File' => 'char_data',
@@ -109,7 +103,6 @@ class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase {
   }
 
   public function testTypeToFieldWithWrongInput() {
-    $values = array();
     $values = array(
       'String' => 'memo_data',
       'File' => 'date_data',
@@ -121,7 +114,7 @@ class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase {
     }
   }
 
-  public function testFixFieldValueOfTypeMemo() {
+  public function fixCustomFieldValue() {
     $customGroup = Custom::createGroup(array(), 'Individual');
 
     $fields = array(
@@ -133,22 +126,21 @@ class CRM_Core_BAO_CustomValueTest extends CiviUnitTestCase {
     $customField = Custom::createField(array(), $fields);
 
     $custom = 'custom_' . $customField->id;
-    $params = array();
     $params = array(
       'email' => 'abc@webaccess.co.in',
       $custom => 'note',
     );
 
-    CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($params);
+    CRM_Core_BAO_CustomValue::fixCustomFieldValue($params);
     $this->assertEquals($params[$custom], '%note%', 'Checking the returned value of type Memo.');
 
     Custom::deleteField($customField);
     Custom::deleteGroup($customGroup);
   }
 
-  public function testFixFieldValueOfTypeMemoWithEmptyParams() {
+  public function testFixCustomFieldValueWithEmptyParams() {
     $params = array();
-    $result = CRM_Core_BAO_CustomValue::fixFieldValueOfTypeMemo($params);
+    $result = CRM_Core_BAO_CustomValue::fixCustomFieldValue($params);
     $this->assertEquals($result, NULL, 'Checking the returned value of type Memo.');
   }
 
index 48c8d03328d78dd5f62cf6c224273d56b436d2e0..bfc6a0e673a76285cf237ce493fc1bff4bf6bbb4 100644 (file)
@@ -112,7 +112,7 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase {
     $contribution = new CRM_Contribute_BAO_Contribution();
     $contribution->id = $this->_contributionId;
     $contribution->find(TRUE);
-    $contribution->loadRelatedObjects($this->input, $this->ids, FALSE, TRUE);
+    $contribution->loadRelatedObjects($this->input, $this->ids, TRUE);
     $this->assertFalse(empty($contribution->_relatedObjects['membership']));
     $this->assertArrayHasKey($this->_membershipTypeID, $contribution->_relatedObjects['membership']);
     $this->assertTrue(is_a($contribution->_relatedObjects['membership'][$this->_membershipTypeID], 'CRM_Member_BAO_Membership'));
@@ -290,7 +290,6 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase {
    */
   public function testRequiredWithoutProcessorID() {
     $this->_setUpPledgeObjects();
-    $values = array();
     $result = $this->IPN->loadObjects($this->input, $this->ids, $this->objects, TRUE, NULL, array('return_error' => 1));
     $this->assertArrayHasKey('error_message', $result);
     $this->assertEquals('Could not find payment processor for contribution record: 1', $result['error_message']);
@@ -303,13 +302,24 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase {
   }
 
   /**
-   *
    * Test that an error is not if required set & no processor ID
    */
   public function testRequiredWithContributionPage() {
     $this->_setUpContributionObjects(TRUE);
     $result = $this->IPN->loadObjects($this->input, $this->ids, $this->objects, TRUE, NULL, array('return_error' => 1));
-    $this->assertFalse(is_array($result), $result['error_message']);
+    $this->assertEquals(1, $result['is_error']);
+    ;
+  }
+
+  /**
+   * Test that if part of $input the payment processor loads OK.
+   *
+   * It's preferable to pass it in as it cannot be correctly calculated.
+   */
+  public function testPaymentProcessorLoadsAsParam() {
+    $this->_setUpContributionObjects();
+    $this->input = array_merge($this->input, array('payment_processor_id' => $this->_processorId));
+    $this->assertTrue($this->IPN->loadObjects($this->input, $this->ids, $this->objects, TRUE, NULL, array('return_error' => 1)));
   }
 
   /**
@@ -319,7 +329,7 @@ class CRM_Core_Payment_BaseIPNTest extends CiviUnitTestCase {
     $this->_setUpContributionObjects();
     $result = $this->IPN->loadObjects($this->input, $this->ids, $this->objects, TRUE, NULL, array('return_error' => 1));
     $this->assertArrayHasKey('error_message', $result);
-    $this->assertEquals('Could not find contribution page for contribution record: 1', $result['error_message']);
+    $this->assertEquals('Could not find payment processor for contribution record: 1', $result['error_message']);
     // error is only returned if $required set to True
     $result = $this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, NULL, array('return_error' => 1));
     $this->assertFalse(is_array($result));
index e83e4b17164e5d7078072b5a626a04a9cd033a5b..45d0b5ef2f3a0df4dcc512930b3a22470e6f5316 100644 (file)
@@ -87,6 +87,29 @@ class CRM_Utils_API_ReloadOptionTest extends CiviUnitTestCase {
     $this->assertAPISuccess($result['values'][$result['id']]['api.Email.create']);
   }
 
+  /**
+   * When the reload option is combined with chaining, the reload should munge
+   * the chain results, even if sequential=1.
+   */
+  public function testReloadNoChainInterferenceSequential() {
+    $result = $this->callAPISuccess('contact', 'create', array(
+      'sequential' => 1,
+      'contact_type' => 'Individual',
+      'first_name' => 'First',
+      'last_name' => 'Last',
+      'nick_name' => 'Firstie',
+      'api.Email.create' => array(
+        'email' => 'test@example.com',
+      ),
+      'options' => array(
+        'reload' => 1,
+      ),
+    ));
+    $this->assertEquals('First', $result['values'][0]['first_name']);
+    $this->assertEquals('munged', $result['values'][0]['nick_name']);
+    $this->assertAPISuccess($result['values'][0]['api.Email.create']);
+  }
+
   /**
    * An implementation of hook_civicrm_post used with all our test cases.
    *
index 2886aa5e3fd76949d49be3537549ec527ab70d37..b021a90b84313ac7c93b8884303682dc7b4b7396 100644 (file)
@@ -704,7 +704,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
       $this->click("_qf_Contact_upload_view-bottom");
       $this->waitForPageToLoad($this->getTimeoutMsec());
       $this->waitForText('crm-notification-container', "Contact Saved");
-      $mainId = explode("CiviCRM ID:", trim($this->getText("xpath=//div[@id='crm-record-log']/span[@class='col1']")));
+      $mainId = explode("Contact ID:", trim($this->getText("xpath=//div[@id='crm-record-log']/span[@class='col1']")));
       $mainId = trim($mainId[1]);
 
       //Duplicate of above contact.
@@ -724,7 +724,7 @@ class WebTest_Contact_MergeContactsTest extends CiviSeleniumTestCase {
       $this->click("_qf_Contact_upload_duplicate");
       $this->waitForPageToLoad($this->getTimeoutMsec());
       $this->waitForText('crm-notification-container', "Contact Saved");
-      $duplicateId = explode("CiviCRM ID:", trim($this->getText("xpath=//div[@id='crm-record-log']/span[@class='col1']")));
+      $duplicateId = explode("Contact ID:", trim($this->getText("xpath=//div[@id='crm-record-log']/span[@class='col1']")));
       $duplicateId = trim($duplicateId[1]);
 
       return array(
index 463d9bb66286fba03b7688c71c6eaa2a40d2130f..f158861a507a242a293ef043da4f34cf8c84a900 100644 (file)
@@ -68,7 +68,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     $sortName = "adv$firstName, $firstName";
     $displayName = "$firstName adv$firstName";
 
-    $this->_searchBuilder("Zip / Postal Code", "100[0-9]", $sortName, "RLIKE");
+    $this->_searchBuilder("Postal Code", "100[0-9]", $sortName, "RLIKE");
   }
 
   /**
@@ -198,7 +198,7 @@ class WebTest_Contact_SearchBuilderTest extends CiviSeleniumTestCase {
     $this->_createContact('Household', $firstName7, "$firstName7@advsearch.co.in", NULL, $postalCode);
 
     // check if the resultset of search builder and advanced search match for the postal code
-    $this->_searchBuilder('Zip / Postal Code', $postalCode, NULL, 'LIKE', '4');
+    $this->_searchBuilder('Postal Code', $postalCode, NULL, 'LIKE', '4');
     $this->_advancedSearch($postalCode, NULL, NULL, '4', 'postal_code');
 
     $firstName8 = "abcc" . substr(sha1(rand()), 0, 7);
index fd378de339d978ea82f456a588864ed70a77fda9..97732afbcb31105e7d68148bec68aa2a9bbf8e5f 100644 (file)
@@ -289,7 +289,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase {
           'bodyLocator' => 'select#financial_type_id',
           'title' => 'Contributions',
           'fields' => array(
-            'Contribution Dates' => array(
+            'Date Received' => array(
               'type' => 'select',
               'locator' => 'contribution_date_relative',
               'values' => array('Today'),
@@ -301,7 +301,7 @@ class WebTest_Contact_SearchbyDateFilterTest extends CiviSeleniumTestCase {
           'bodyLocator' => 'select#pledge_payment_date_relative',
           'title' => 'Pledges',
           'fields' => array(
-            'Contribution Dates' => array(
+            'Date Received' => array(
               'type' => 'select',
               'locator' => 'pledge_payment_date_relative',
               'values' => array('Prior to Previous Month'),
index 9be28008e233746919c4efb20be95071f853ac1b..886ea9664ebd83c23a55256318fff8d103d1c591 100644 (file)
@@ -639,7 +639,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
       'From' => $contact['display_name'],
       'Financial Type' => $financialType,
       'Contribution Amount' => 'Contribution Total: $ 590.00',
-      'Paid By' => 'Check',
+      'Payment Method' => 'Check',
       'Check Number' => '1041',
       'Contribution Status' => 'Completed',
     );
@@ -704,7 +704,7 @@ class WebTest_Contribute_AddPricesetTest extends CiviSeleniumTestCase {
       'Financial Type' => $fields['values'][$fields['id']]['financial_type'],
       'Contribution Amount' => $fields['values'][$fields['id']]['total_amount'],
       'Contribution Status' => $fields['values'][$fields['id']]['contribution_status'],
-      'Paid By' => $fields['values'][$fields['id']]['payment_instrument'],
+      'Payment Method' => $fields['values'][$fields['id']]['payment_instrument'],
       'Check Number' => $fields['values'][$fields['id']]['contribution_check_number'],
     );
 
index 57eca8fdf30d0aa111278ca82fd1b68c6ce8f1cb..10672020fc2f87275a686f602d410aac19a5ce56 100644 (file)
@@ -154,7 +154,7 @@ class WebTest_Contribute_ContactContextAddTest extends CiviSeleniumTestCase {
       'From' => $firstName . " Anderson",
       'Financial Type' => 'Donation',
       'Contribution Status' => 'Completed',
-      'Paid By' => 'Check',
+      'Payment Method' => 'Check',
       'Total Amount' => '$ 100.00',
       'Non-deductible Amount' => '$ 12.50',
       'Check Number' => 'check #1041',
index bb7008825bbbdae667752cff6b58161d3f0910cb..5db8c37ddeb762cb5b9f03ee50b2e4f40e2c2cd5 100644 (file)
@@ -160,7 +160,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
       'Financial Type' => 'Donation',
       'Total Amount' => '100.00',
       'Contribution Status' => 'Completed',
-      'Paid By' => 'Check',
+      'Payment Method' => 'Check',
       'Check Number' => 'check #1041',
       'Non-deductible Amount' => '10.00',
       'Received Into' => $financialAccount,
@@ -427,7 +427,7 @@ class WebTest_Contribute_OfflineContributionTest extends CiviSeleniumTestCase {
       'Financial Type' => 'Donation',
       'Total Amount' => '0.00',
       'Contribution Status' => 'Completed',
-      'Paid By' => 'Credit Card',
+      'Payment Method' => 'Credit Card',
     );
     $this->webtestVerifyTabularData($expected);
   }
index 1eebfe40ddb9dfa1cedacd603bdd387846c49951..1c8a04a4afe935afdbae0d97bb67e0d7e61773f0 100644 (file)
@@ -100,7 +100,7 @@ class WebTest_Contribute_OfflineRecurContributionTest extends CiviSeleniumTestCa
       'Financial Type' => 'Donation (test)',
       'Total Amount' => 'Installments: 12, Interval: 1 month(s)',
       'Contribution Status' => 'Pending : Incomplete Transaction',
-      'Paid By' => 'Credit Card',
+      'Payment Method' => 'Credit Card',
     );
 
     foreach ($verifyData as $label => $value) {
index 3fa7e2064502a3492e6a91705917655ca69dbcc4..93067ca0752cba3faa544883637b7c9691e58731 100644 (file)
@@ -143,7 +143,7 @@ class WebTest_Contribute_OnlineRecurContributionTest extends CiviSeleniumTestCas
       'Financial Type' => 'Donation (test)',
       'Total Amount' => 'Installments: 12, Interval: 1 month(s)',
       'Contribution Status' => 'Pending : Incomplete Transaction',
-      'Paid By' => 'Credit Card',
+      'Payment Method' => 'Credit Card',
       'Online Contribution Page' => $pageTitle,
     );
     foreach ($verifyData as $label => $value) {
index df15c94a9dc8706dd890c99d14d355f2b62e401a..fc5554082500c25aa09a3087d9b35b81abb79298 100644 (file)
@@ -143,7 +143,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
       'Financial Type' => 'Donation',
       'Total Amount' => '$ 100.00',
       'Contribution Status' => 'Completed',
-      'Paid By' => 'Check',
+      'Payment Method' => 'Check',
       'Check Number' => 'check #1041',
     );
 
@@ -267,7 +267,7 @@ class WebTest_Contribute_StandaloneAddTest extends CiviSeleniumTestCase {
       'Financial Type' => $financialType['name'],
       'Total Amount' => '$ 100.00',
       'Contribution Status' => 'Completed',
-      'Paid By' => 'Check',
+      'Payment Method' => 'Check',
       'Check Number' => 'check #1041',
     );
 
index e62fbfd7e8fdb21e10a0a79ea05524e25a12fdae..5f0f6429042dd1dc978128ae36428ce8b456f02a 100644 (file)
@@ -153,7 +153,7 @@ class WebTest_Contribute_UpdatePendingContributionTest extends CiviSeleniumTestC
       'Financial Type' => 'Donation',
       'Total Amount' => '100.00',
       'Contribution Status' => 'Pending',
-      'Paid By' => 'Check',
+      'Payment Method' => 'Check',
       'Check Number' => 'check #1041',
     );
     $this->webtestVerifyTabularData($expected);
index 291e646a5118a9f88257db6c7686fdd89dbbca9b..93adbbe5d9f553173349f9ecc889fe2422a73bc6 100644 (file)
@@ -116,7 +116,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
         'Financial Type' => 'Event Fee',
         'Total Amount' => '$ 800.00',
         'Contribution Status' => 'Completed',
-        'Paid By' => 'Check',
+        'Payment Method' => 'Check',
         'Check Number' => '1044',
       )
     );
@@ -309,7 +309,7 @@ class WebTest_Event_AddParticipationTest extends CiviSeleniumTestCase {
         'From' => $displayName,
         'Financial Type' => 'Event Fee',
         'Contribution Status' => 'Completed',
-        'Paid By' => 'Check',
+        'Payment Method' => 'Check',
         'Check Number' => '1044',
       )
     );
index f2701a793935f42e42fa8a5d1e5a6a40891e6c70..1eb9dec0708f4cfe006450d1cf8576b06683400e 100644 (file)
@@ -671,7 +671,7 @@ class WebTest_Event_AddPricesetTest extends CiviSeleniumTestCase {
         'From' => $displayName,
         'Financial Type' => 'Event Fee',
         'Contribution Status' => 'Completed',
-        'Paid By' => 'Check',
+        'Payment Method' => 'Check',
         'Check Number' => '1044',
         'Received Into' => 'Deposit Bank Account',
       )
index 71f92580182a3503ee3fa25133baac8db274fe91..634c693d0b6bdec717c1fb35e3ed7a2902db0a9a 100644 (file)
@@ -138,7 +138,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
         'Financial Type' => 'Event Fee',
         'Total Amount' => '$ 800.00',
         'Contribution Status' => 'Partially paid',
-        'Paid By' => 'Check',
+        'Payment Method' => 'Check',
         'Check Number' => '1044',
       )
     );
@@ -190,7 +190,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
         'Financial Type' => 'Event Fee',
         'Total Amount' => '$ 800.00',
         'Contribution Status' => 'Completed',
-        'Paid By' => 'Check',
+        'Payment Method' => 'Check',
         'Check Number' => '1044',
       )
     );
@@ -200,7 +200,7 @@ class WebTest_Event_AdditionalPaymentTest extends CiviSeleniumTestCase {
     $this->waitForElementPresent("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]/a");
     $this->clickAjaxLink("xpath=//td[@id='payment-info']/table[@id='info']/tbody/tr[2]/td[2]/a");
     $this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[contains(text(), 'Amount')]/../../tr[2]/td[contains(text(), '$ 400.00')]/../../tr[3]/td[contains(text(), '$ 400.00')]");
-    $this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[3][contains(text(), 'Paid By')]/../../tr[2]/td[3][contains(text(), 'Check')]/../../tr[3]/td[3][contains(text(), 'Cash')]");
+    $this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[3][contains(text(), 'Payment Method')]/../../tr[2]/td[3][contains(text(), 'Check')]/../../tr[3]/td[3][contains(text(), 'Cash')]");
     $this->waitForElementPresent("xpath=//table[@id='info']/tbody/tr/th[6][contains(text(), 'Status')]/../../tr[2]/td[6][contains(text(), 'Completed')]/../../tr[3]/td[6][contains(text(), 'Completed')]");
   }
 
diff --git a/tests/phpunit/WebTest/Utils/RedirectTest.php b/tests/phpunit/WebTest/Utils/RedirectTest.php
new file mode 100644 (file)
index 0000000..39d3829
--- /dev/null
@@ -0,0 +1,135 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.6                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License along with this program; if not, contact CiviCRM LLC       |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+ */
+
+require_once 'CiviTest/CiviUnitTestCase.php';
+require_once 'CiviTest/CiviSeleniumSettings.php';
+
+/**
+ *  Include configuration
+ */
+define('CIVICRM_SETTINGS_PATH', __DIR__ . '/civicrm.settings.dist.php');
+define('CIVICRM_SETTINGS_LOCAL_PATH', __DIR__ . '/civicrm.settings.local.php');
+define('CIVICRM_WEBTEST', 1);
+
+if (file_exists(CIVICRM_SETTINGS_LOCAL_PATH)) {
+  require_once CIVICRM_SETTINGS_LOCAL_PATH;
+}
+require_once CIVICRM_SETTINGS_PATH;
+
+
+/**
+ * Check that we handle redirects appropriately.
+ */
+class WebTest_Utils_RedirectTest extends CiviUnitTestCase {
+  protected $url;
+  protected $ch;
+
+  /**
+   * @param string|null $name
+   */
+  public function __construct($name = NULL) {
+    parent::__construct($name);
+
+    $this->settings = new CiviSeleniumSettings();
+    if (property_exists($this->settings, 'serverStartupTimeOut') && $this->settings->serverStartupTimeOut) {
+      global $CiviSeleniumTestCase_polled;
+      if (!$CiviSeleniumTestCase_polled) {
+        $CiviSeleniumTestCase_polled = TRUE;
+        CRM_Utils_Network::waitForServiceStartup(
+          $this->drivers[0]->getHost(),
+          $this->drivers[0]->getPort(),
+          $this->settings->serverStartupTimeOut
+        );
+      }
+    }
+  }
+
+  protected function setUp() {
+    parent::setUp();
+    //URL should eventually be adapted for multisite
+    $this->url = $this->settings->sandboxURL;
+
+    $this->ch = curl_init();
+    curl_setopt($this->ch, CURLOPT_HEADER, FALSE);
+    curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, FALSE);
+    // curl_setopt($this->ch, CURLOPT_ENCODING, 'gzip');
+    // curl_setopt($this->ch, CURLOPT_VERBOSE, 0);
+  }
+
+  /**
+   *
+   */
+  private function tryRedirect($input_url, $expected_url) {
+    // file_put_contents('php://stderr', $input_url . "\n", FILE_APPEND);
+    $url = $this->url . '/' . $input_url;
+    $expected_url = $this->url . '/' . $expected_url;
+    curl_setopt($this->ch, CURLOPT_URL, $url);
+    $req = curl_exec($this->ch);
+    $this->assertEquals(0, curl_errno($this->ch), 'cURL error: ' . curl_error($this->ch));
+    if (!curl_errno($this->ch)) {
+      $info = curl_getinfo($this->ch);
+      // file_put_contents('php://stderr', print_r($info,1), FILE_APPEND);
+      $this->assertEquals($expected_url, $info['redirect_url']);
+      $this->assertEquals('302', $info['http_code']);
+    }
+  }
+
+  /**
+   * Handle onsite redirects with absolute URL.
+   */
+  public function testAbsoluteOnsiteRedirect() {
+    $this->tryRedirect("civicrm/contribute/transact?qfKey=xxx&entryURL={$this->url}/civicrm/contribute/transact%3Fid%3D1", 'civicrm/contribute/transact?id=1');
+  }
+
+  /**
+   * Handle onsite redirects with slash prefix and query params.
+   */
+  public function testOnsiteRedirectWithSlashPrefixAndQueryParams() {
+    $this->tryRedirect('civicrm/contribute/transact?qfKey=xxx&entryURL=/civicrm/contribute/transact%3Fid%3D1', 'civicrm/contribute/transact?id=1');
+  }
+
+  /**
+   * Handle onsite redirects with non-CiviCRM paths.
+   */
+  public function testOtherpathRedirect() {
+    $this->tryRedirect('civicrm/contribute/transact?qfKey=xxx&entryURL=asdf', 'asdf');
+  }
+
+  /**
+   * Handle offsite redirects without path as onsite redirects.
+   */
+  public function testOffsiteRedirectNoPath() {
+    $this->tryRedirect('civicrm/contribute/transact?qfKey=xxx&entryURL=http://evil.example.com/', '');
+  }
+
+  /**
+   * Handle offsite redirects with paths as onsite redirects.
+   */
+  public function testOffsiteRedirectWithPath() {
+    $this->tryRedirect('civicrm/contribute/transact?qfKey=xxx&entryURL=http://evil.example.com/civicrm', 'civicrm');
+  }
+
+}
index b6e426437f722aff9fb230e8b47a85e30e942441..2e4183f8360b2f6bcea4a6bb342fad2493d2cb28 100644 (file)
@@ -1 +1 @@
-Contact ID,External ID,Contribution Type,Amount,Date,Paid By,Source,Transaction ID,Fee Amount,Non-deductible,Check #\r2,22,Campaign Contribution,125,20081011,Check,Oct 2005 Mailer 1,,,125,109\r4,44,Donation,50,20080921,Credit Card,Online: Save the Penguins,P20901X9,1.75,,\r6,66,Campaign Contribution,25,20081029,Check,Oct 2005 Mailer 1,,,25,2309\r55,55abc,Campaign Contribution,2175,20081011,Check,Oct 2005 Mailer 1,,,175,1902\r32,3232abc,Donation,50,20080927,Credit Card,Online: Save the Penguins,P20193L235,1.75,,\r92,9292,Donation,10,20080908,Credit Card,Online: Save the Penguins,P40232Y256,0.27,,\r34,3434,Donation,250,20081022,Credit Card,Online: Save the Penguins,P20193SSS092,3.55,,\r199,199199,Donation,250,20081022,Credit Card,Online: Save the Penguins,XJA090322,3.55,,
\ No newline at end of file
+Contact ID,External ID,Contribution Type,Amount,Date,Payment Method,Source,Transaction ID,Fee Amount,Non-deductible,Check #\r2,22,Campaign Contribution,125,20081011,Check,Oct 2005 Mailer 1,,,125,109\r4,44,Donation,50,20080921,Credit Card,Online: Save the Penguins,P20901X9,1.75,,\r6,66,Campaign Contribution,25,20081029,Check,Oct 2005 Mailer 1,,,25,2309\r55,55abc,Campaign Contribution,2175,20081011,Check,Oct 2005 Mailer 1,,,175,1902\r32,3232abc,Donation,50,20080927,Credit Card,Online: Save the Penguins,P20193L235,1.75,,\r92,9292,Donation,10,20080908,Credit Card,Online: Save the Penguins,P40232Y256,0.27,,\r34,3434,Donation,250,20081022,Credit Card,Online: Save the Penguins,P20193SSS092,3.55,,\r199,199199,Donation,250,20081022,Credit Card,Online: Save the Penguins,XJA090322,3.55,,
\ No newline at end of file
index 9a79cff4b22850cb0371925bc232266506f20b6a..73c07be2191fdeb61ad76cb5c562bd887e791e56 100644 (file)
@@ -1 +1 @@
-Email,Contribution Type,Amount,Receive Date,Paid By,Source,Transaction ID,Invoice ID,Status,Comments\rjake@foo.org,Donation,125,,,Oct 2005 Mailer 1,,,Completed,Coming in by mail.\rdggreenberg@gmail.com,Donation,50,20060111,Check,Dec 2005 Mailer,,,Pending,\radamspeter@hotmail.com,Member Dues,25,20051029,Check,Oct 2005 Mailer 1,check #2095,10924,Completed,\r,Member Dues,50,20051011,Check,Oct 2005 Mailer 1,check #10552,10925,Completed,
\ No newline at end of file
+Email,Contribution Type,Amount,Receive Date,Payment Method,Source,Transaction ID,Invoice ID,Status,Comments\rjake@foo.org,Donation,125,,,Oct 2005 Mailer 1,,,Completed,Coming in by mail.\rdggreenberg@gmail.com,Donation,50,20060111,Check,Dec 2005 Mailer,,,Pending,\radamspeter@hotmail.com,Member Dues,25,20051029,Check,Oct 2005 Mailer 1,check #2095,10924,Completed,\r,Member Dues,50,20051011,Check,Oct 2005 Mailer 1,check #10552,10925,Completed,
\ No newline at end of file
index 5d3f355a0ce91d1da61fcc5f144bf36be9f477b2..54111c1d7ffab7d426889d181e2bfc864ee3bed1 100644 (file)
@@ -1 +1 @@
-External ID,Contribution Type,Amount,Date,Paid By,Source,Transaction ID,Fee Amount,Non-deductible\rN101,Campaign Contribution,125,20051011,Check,Oct 2005 Mailer 1,check #1066,,125\rN102,Donation,50,20050921,Credit Card,Online: Save the Penguins,P20901X9,1.75,\rN103,Campaign Contribution,25,20051029,Check,Oct 2005 Mailer 1,Acct 2099002 check #2098,,25\rN105,Campaign Contribution,50,20051011,Cash,Oct 2005 Mailer 1,,,50\rN110,Campaign Contribution,500,20051015,Check,Oct 2005 Mailer 1,10909131 #09022,,500
\ No newline at end of file
+External ID,Contribution Type,Amount,Date,Payment Method,Source,Transaction ID,Fee Amount,Non-deductible\rN101,Campaign Contribution,125,20051011,Check,Oct 2005 Mailer 1,check #1066,,125\rN102,Donation,50,20050921,Credit Card,Online: Save the Penguins,P20901X9,1.75,\rN103,Campaign Contribution,25,20051029,Check,Oct 2005 Mailer 1,Acct 2099002 check #2098,,25\rN105,Campaign Contribution,50,20051011,Cash,Oct 2005 Mailer 1,,,50\rN110,Campaign Contribution,500,20051015,Check,Oct 2005 Mailer 1,10909131 #09022,,500
\ No newline at end of file
index 783b18b42e5dd9978e0857cae969862f93e63754..d13b5f3215d1cb00a7694ff3c001cea8c75849f8 100644 (file)
@@ -1 +1 @@
-Contact ID,Contribution Type,Amount,Date,Paid By,Source,Transaction ID,Fee Amount,Non-deductible,Region-Alpha,Region-Int,External ID\r103,Campaign Contribution,33,20070111,Check,Mar 2007 Mailer 1,check #1066,,125,East,1,N101\r104,Donation,33,20070521,Credit Card,Online: Save the Penguins,P20901X9,1.75,,East Region,East Region,N110\r105,Campaign Contribution,33,20070129,Check,Mar 2007 Mailer 1,Acct 2099002 check #2098,,25,West,2,N102\r105,Campaign Contribution,33,20070411,Cash,Mar 2007 Mailer 1,,,50,West Region,West Region,N105\r107,Donation,33,20070315,Check,Mar 2007 Mailer 1,10909131 #09022,,500,Foo,3,N105
\ No newline at end of file
+Contact ID,Contribution Type,Amount,Date,Payment Method,Source,Transaction ID,Fee Amount,Non-deductible,Region-Alpha,Region-Int,External ID\r103,Campaign Contribution,33,20070111,Check,Mar 2007 Mailer 1,check #1066,,125,East,1,N101\r104,Donation,33,20070521,Credit Card,Online: Save the Penguins,P20901X9,1.75,,East Region,East Region,N110\r105,Campaign Contribution,33,20070129,Check,Mar 2007 Mailer 1,Acct 2099002 check #2098,,25,West,2,N102\r105,Campaign Contribution,33,20070411,Cash,Mar 2007 Mailer 1,,,50,West Region,West Region,N105\r107,Donation,33,20070315,Check,Mar 2007 Mailer 1,10909131 #09022,,500,Foo,3,N105
\ No newline at end of file
index 5975b27a17c94fa4bf66a74773c6723a537b024a..985c94153b305ef94169673cca7fad0e4fc997da 100644 (file)
@@ -228,6 +228,22 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->assertEquals(1, $contact['id']);
   }
 
+  /**
+   * Test creating individual by display_name.
+   *
+   * Display name & sort name should be set.
+   */
+  public function testCreateDisplayNameIndividual() {
+    $params = array(
+      'display_name' => 'abc1',
+      'contact_type' => 'Individual',
+    );
+
+    $contact = $this->callAPISuccess('contact', 'create', $params);
+    $params['sort_name'] = 'abc1';
+    $this->getAndCheck($params, $contact['id'], 'contact');
+  }
+
   /**
    * Test old keys still work.
    *
@@ -1618,7 +1634,44 @@ class api_v3_ContactTest extends CiviUnitTestCase {
   }
 
   /**
-   * Verify attempt to create individual with chained arrays.
+   *  Verify attempt to create individual with chained arrays and sequential
+   */
+  public function testGetIndividualWithChainedArraysAndSequential() {
+    $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
+    $params['custom_' . $ids['custom_field_id']] = "custom string";
+
+    $moreids = $this->CustomGroupMultipleCreateWithFields();
+    $description = "/*this demonstrates the usage of chained api functions. In this case no notes or custom fields have been created ";
+    $subfile = "APIChainedArray";
+    $params = array(
+      'sequential' => 1,
+      'first_name' => 'abc3',
+      'last_name' => 'xyz3',
+      'contact_type' => 'Individual',
+      'email' => 'man3@yahoo.com',
+      'api.website.create' => array(
+        array(
+          'url' => "http://civicrm.org",
+        ),
+        array(
+          'url' => "https://civicrm.org",
+        ),
+      ),
+    );
+
+    $result = $this->callAPISuccess('Contact', 'create', $params);
+
+    // delete the contact and custom groups
+    $this->callAPISuccess('contact', 'delete', array('id' => $result['id']));
+    $this->customGroupDelete($ids['custom_group_id']);
+    $this->customGroupDelete($moreids['custom_group_id']);
+
+    $this->assertEquals($result['id'], $result['values'][0]['id']);
+    $this->assertArrayKeyExists('api.website.create', $result['values'][0]);
+  }
+
+  /**
+   *  Verify attempt to create individual with chained arrays
    */
   public function testGetIndividualWithChainedArrays() {
     $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, __FILE__);
@@ -1685,6 +1738,47 @@ class api_v3_ContactTest extends CiviUnitTestCase {
     $this->assertEquals("http://civicrm.org", $result['values'][$result['id']]['api.website.get']['values'][0]['url']);
   }
 
+  /**
+   *  Verify attempt to create individual with chained arrays and sequential.
+   *
+   *  See https://issues.civicrm.org/jira/browse/CRM-15815
+   */
+  public function testCreateIndividualWithChainedArrayAndSequential() {
+    $params = array(
+      'sequential' => 1,
+      'first_name' => 'abc5',
+      'last_name' => 'xyz5',
+      'contact_type' => 'Individual',
+      'email' => 'woman5@yahoo.com',
+      'api.phone.create' => array(
+        array('phone' => '03-231 07 95'),
+        array('phone' => '03-232 51 62'),
+      ),
+      'api.website.create' => array(
+        'url' => 'http://civicrm.org',
+      ),
+    );
+    $result = $this->callAPISuccess('Contact', 'create', $params);
+
+    // I could try to parse the result to see whether the two phone numbers
+    // and the website are there, but I am not sure about the correct format.
+    // So I will just fetch it again before checking.
+    // See also http://forum.civicrm.org/index.php/topic,35393.0.html
+    $params = array(
+      'sequential' => 1,
+      'id' => $result['id'],
+      'api.website.get' => array(),
+      'api.phone.get' => array(),
+    );
+    $result = $this->callAPISuccess('Contact', 'get', $params);
+
+    // delete the contact
+    $this->callAPISuccess('contact', 'delete', $result);
+
+    $this->assertEquals(2, $result['values'][0]['api.phone.get']['count']);
+    $this->assertEquals(1, $result['values'][0]['api.website.get']['count']);
+  }
+
   public function testGetIndividualWithChainedArraysFormats() {
     $description = "This demonstrates the usage of chained api functions.\nIn this case no notes or custom fields have been created.";
     $subfile = "APIChainedArrayFormats";
index ee77343408d91faf6e9885629683cbaa21dd63b4..748171755591f2b691bb2c2e80cc23f609622a96 100644 (file)
@@ -369,6 +369,8 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase {
       'contribution_page_id' => $this->_ids['contribution_page'],
       'contribution_status_id' => 1,
     ));
+
+    $this->assertEquals('create_first_success', $contribution['trxn_id']);
     $membershipPayment = $this->callAPISuccess('membership_payment', 'getsingle', array());
     $this->assertEquals($membershipPayment['contribution_id'], $contribution['id']);
     $membership = $this->callAPISuccessGetSingle('membership', array('id' => $membershipPayment['membership_id']));
index 12661a81e7b68bc24140d2c5b4a9178939b25aec..5d16b62dc4574e26a5ab36bbb14e41be27307b5c 100644 (file)
@@ -1563,10 +1563,29 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
    */
   public function testCompleteTransactionMembershipPriceSet() {
     $this->createPriceSetWithPage('membership');
+    $stateOfGrace = $this->callAPISuccess('MembershipStatus', 'getvalue', array(
+      'name' => 'Grace',
+      'return' => 'id')
+    );
     $this->setUpPendingContribution($this->_ids['price_field_value'][0]);
+    $membership = $this->callAPISuccess('membership', 'getsingle', array('id' => $this->_ids['membership']));
+    $logs = $this->callAPISuccess('MembershipLog', 'get', array(
+      'membership_id' => $this->_ids['membership'],
+    ));
+    $this->assertEquals(1, $logs['count']);
+    $this->assertEquals($stateOfGrace, $membership['status_id']);
     $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution']));
     $membership = $this->callAPISuccess('membership', 'getsingle', array('id' => $this->_ids['membership']));
     $this->assertEquals(date('Y-m-d', strtotime('yesterday + 1 year')), $membership['end_date']);
+    $this->callAPISuccessGetSingle('LineItem', array(
+      'entity_id' => $this->_ids['membership'],
+      'entity_table' => 'civicrm_membership',
+    ));
+    $logs = $this->callAPISuccess('MembershipLog', 'get', array(
+      'membership_id' => $this->_ids['membership'],
+    ));
+    $this->assertEquals(2, $logs['count']);
+    $this->assertNotEquals($stateOfGrace, $logs['values'][2]['status_id']);
     $this->cleanUpAfterPriceSets();
   }
 
@@ -1661,6 +1680,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
       'membership_type_id' => $this->_ids['membership_type'],
       'start_date' => 'yesterday - 1 year',
       'end_date' => 'yesterday',
+      'join_date' => 'yesterday - 1 year',
     ));
     $contribution = $this->callAPISuccess('contribution', 'create', array(
       'domain_id' => 1,
@@ -1916,8 +1936,8 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
   }
 
   /**
-   * @param $contribution
-   * @param $context
+   * @param array $contribution
+   * @param string $context
    * @param int $instrumentId
    */
   public function _checkFinancialTrxn($contribution, $context, $instrumentId = NULL) {
index b672d56c3479f8eead4568e063402b0e1dc51fc6..6c3e76f2a06f156cfab6dd83782104eace7e89a1 100644 (file)
@@ -280,6 +280,65 @@ class api_v3_EventTest extends CiviUnitTestCase {
     $this->callAPISuccess('event', 'delete', array('id' => $result['id']));
   }
 
+  /**
+   * Chaining get event and loc block.
+   */
+  public function testChainingGetLocBlock() {
+    // create a loc block and an event for that loc block.
+    $eventParams = $this->_params[0];
+    $eventParams['loc_bloc_id'] = '$value.id';
+    $locBlockParams = array(
+      'address' => array(
+        'street_address' => 'Kipdorp 24',
+        'postal_code' => '2000',
+        'city' => 'Antwerpen',
+        'country_id' => '1020',
+        'location_type_id' => '1',
+      ),
+      'api.Event.create' => $eventParams,
+      'sequential' => 1,
+    );
+    $createResult = $this->callAPIAndDocument('LocBlock', 'create', $locBlockParams, __FUNCTION__, __FILE__);
+    $locBlockId = $createResult['id'];
+    $addressId = $createResult['values'][0]['address_id'];
+    $eventId = $createResult['values'][0]['api.Event.create']['id'];
+
+    // request the event with its loc block:
+    $check = $this->callAPISuccess($this->_entity, 'getsingle', array(
+      'id' => $eventId,
+      'api.LocBlock.get' => array('id' => '$value.loc_block_id'),
+      'sequential' => 1,
+    ));
+
+    // assert
+    $this->assertEquals($eventId, $check['id'], ' in line ' . __LINE__);
+    $this->assertEquals(1, $check['api.LocBlock.get']['count'], ' in line ' . __LINE__);
+    $this->assertEquals($locBlockId, $check['api.LocBlock.get']['id'], ' in line ' . __LINE__);
+
+    // cleanup
+    $this->callAPISuccess($this->_entity, 'delete', array('id' => $eventId));
+  }
+
+  /**
+   * Chaining get event and non existing loc block.
+   *
+   * Even if there is no loc block, at least the event should be returned.
+   * http://forum.civicrm.org/index.php/topic,36113.0.html
+   */
+  public function testChainingGetNonExistingLocBlock() {
+    $params = $this->_params[0];
+    $result = $this->callAPISuccess($this->_entity, 'create', $params);
+
+    $check = $this->callAPISuccess($this->_entity, 'get', array(
+      'id' => $result['id'],
+      // this chaining request should not break things:
+      'api.LocBlock.get' => array('id' => '$value.loc_block_id'),
+      ));
+    $this->assertEquals($result['id'], $check['id']);
+
+    $this->callAPISuccess($this->_entity, 'Delete', array('id' => $result['id']));
+  }
+
   /**
    * Check with complete array + custom field.
    *
index cf24a1959c53972abc8273a34cbaf2e1475d2e31..3af3b7e8a4a0067eb1cf2ceed6a308fee3223767 100644 (file)
@@ -36,8 +36,17 @@ class api_v3_GroupContactTest extends CiviUnitTestCase {
   protected $_contactId;
   protected $_contactId1;
   protected $_apiversion = 3;
+
+  /**
+   * @var int
+   */
   protected $_groupId1;
 
+  /**
+   * @var int
+   */
+  protected $_groupId2;
+
   /**
    * Set up for group contact tests.
    *
@@ -50,23 +59,20 @@ class api_v3_GroupContactTest extends CiviUnitTestCase {
     $this->_contactId = $this->individualCreate();
 
     $this->_groupId1 = $this->groupCreate();
-    $params = array(
+
+    $this->callAPISuccess('group_contact', 'create', array(
       'contact_id' => $this->_contactId,
       'group_id' => $this->_groupId1,
-    );
+    ));
 
-    $result = $this->callAPISuccess('group_contact', 'create', $params);
-
-    $group = array(
+    $this->_groupId2 = $this->groupCreate(array(
       'name' => 'Test Group 2',
       'domain_id' => 1,
       'title' => 'New Test Group2 Created',
       'description' => 'New Test Group2 Created',
       'is_active' => 1,
       'visibility' => 'User and User Admin Only',
-    );
-
-    $this->_groupId2 = $this->groupCreate($group);
+    ));
 
     $this->_group = array(
       $this->_groupId1 => array(
@@ -159,9 +165,9 @@ class api_v3_GroupContactTest extends CiviUnitTestCase {
     );
 
     $result = $this->callAPIAndDocument('group_contact', 'create', $params, __FUNCTION__, __FILE__);
-    $this->assertEquals($result['not_added'], 1, "in line " . __LINE__);
-    $this->assertEquals($result['added'], 1, "in line " . __LINE__);
-    $this->assertEquals($result['total_count'], 2, "in line " . __LINE__);
+    $this->assertEquals($result['not_added'], 1);
+    $this->assertEquals($result['added'], 1);
+    $this->assertEquals($result['total_count'], 2);
   }
 
   ///////////////// civicrm_group_contact_remove methods
@@ -176,8 +182,8 @@ class api_v3_GroupContactTest extends CiviUnitTestCase {
     );
 
     $result = $this->callAPIAndDocument('group_contact', 'delete', $params, __FUNCTION__, __FILE__);
-    $this->assertEquals($result['removed'], 1, "in line " . __LINE__);
-    $this->assertEquals($result['total_count'], 1, "in line " . __LINE__);
+    $this->assertEquals($result['removed'], 1);
+    $this->assertEquals($result['total_count'], 1);
   }
 
   public function testDeletePermanent() {
@@ -188,8 +194,51 @@ class api_v3_GroupContactTest extends CiviUnitTestCase {
     );
     $this->callAPIAndDocument('group_contact', 'delete', $params, __FUNCTION__, __FILE__);
     $result = $this->callAPISuccess('group_contact', 'get', $params);
-    $this->assertEquals(0, $result['count'], "in line " . __LINE__);
-    $this->assertArrayNotHasKey('id', $result, "in line " . __LINE__);
+    $this->assertEquals(0, $result['count']);
+    $this->assertArrayNotHasKey('id', $result);
+  }
+
+  /**
+   * CRM-16945 duplicate groups are showing up when contacts are hard-added to child groups or smart groups.
+   *
+   * Fix documented in
+   *
+   * Test illustrates this (& ensures once fixed it will stay fixed).
+   */
+  public function testAccurateCountWithSmartGroups() {
+    $childGroupID = $this->groupCreate(array(
+      'name' => 'Child group',
+      'domain_id' => 1,
+      'title' => 'Child group',
+      'description' => 'Child group',
+      'is_active' => 1,
+      'parents' => $this->_groupId1,
+      'visibility' => 'User and User Admin Only',
+    ));
+
+    $params = array(
+      'name' => 'Individuals',
+      'title' => 'Individuals',
+      'is_active' => 1,
+      'parents' => $this->_groupId1,
+      'formValues' => array('contact_type' => 'Goat'),
+    );
+    $smartGroup2 = CRM_Contact_BAO_Group::createSmartGroup($params);
+
+    $this->callAPISuccess('GroupContact', 'create', array('contact_id' => $this->_contactId, 'status' => 'Added', 'group_id' => $this->_groupId2));
+    $this->callAPISuccess('GroupContact', 'create', array('contact_id' => $this->_contactId, 'status' => 'Added', 'group_id' => $smartGroup2->id));
+    $this->callAPISuccess('GroupContact', 'create', array('contact_id' => $this->_contactId, 'status' => 'Added', 'group_id' => $childGroupID));
+    $groups = $this->callAPISuccess('GroupContact', 'get', array('contact_id' => $this->_contactId));
+
+    // Although the contact is actually hard-added to 4 groups the smart groups are conventionally not returned by the api or displayed
+    // on the main part of the groups tab on the contact (which calls the same function. So, 3 groups is an OK number to return.
+    // However, as of writing this test 4 groups are returned (indexed by group_contact_id, but more seriously 3/4 of those have the group id 1
+    // so 2 on them have group ids that do not match the group contact id they have been keyed by.
+    foreach ($groups['values'] as $groupContactID => $groupContactRecord) {
+      $this->assertEquals($groupContactRecord['group_id'], CRM_Core_DAO::singleValueQuery("SELECT group_id FROM civicrm_group_contact WHERE id = $groupContactID"), 'Group contact record mis-returned for id ' . $groupContactID);
+    }
+    $this->assertEquals(3, $groups['count']);
+
   }
 
 }
index 2987a957f60d2664eb21e4d53af7ea57afc1b92e..8769a482c7e9da74e215629d21e36b7c39d75f5c 100644 (file)
@@ -1222,7 +1222,8 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase {
                 'sequential' => 1,
               ));
             $optionValue = $optionValue['values'];
-            $options[$optionValue[0]['value']] = 'new option value';
+            $keyColumn = CRM_Utils_Array::value('keyColumn', $specs['pseudoconstant'], 'value');
+            $options[$optionValue[0][$keyColumn]] = 'new option value';
           }
         }
         $entity[$field] = array_rand($options);
index b6696bca3cec909ff420b143912c474c3f8920f6..ec1c8a685c8bec569931c9235e69a5cde060bd51 100644 (file)
@@ -77,7 +77,7 @@
 
 </div>
      <table class="form-layout-compressed">
-        <tr><td class="label nowrap">{$event.fee_label} <span class="marker">*</span></td>
+        <tr><td class="label nowrap">{$event.fee_label} <span class="crm-marker">*</span></td>
             <td>&nbsp;</td>
             <td>{$form.amount.html}</td>
         </tr>
index b6696bca3cec909ff420b143912c474c3f8920f6..ec1c8a685c8bec569931c9235e69a5cde060bd51 100644 (file)
@@ -77,7 +77,7 @@
 
 </div>
      <table class="form-layout-compressed">
-        <tr><td class="label nowrap">{$event.fee_label} <span class="marker">*</span></td>
+        <tr><td class="label nowrap">{$event.fee_label} <span class="crm-marker">*</span></td>
             <td>&nbsp;</td>
             <td>{$form.amount.html}</td>
         </tr>
index 2841971a0133932f3587cc8cc8cad1def5fb232f..9477065c9ff41d54f44e708f1b0d247ba816a77c 100644 (file)
   </field>
   <field>
     <name>payment_instrument_id</name>
-    <title>Batch Payment Instrument</title>
+    <title>Batch Payment Method</title>
     <type>int unsigned</type>
     <comment>fk to Payment Instrument options in civicrm_option_values</comment>
     <pseudoconstant>
index 9383bfb9f84d872e15a6e8c91eebfddbdaee9eb2..52739de3c3ac3f03982da333a78a8551ed9703e0 100644 (file)
@@ -10,7 +10,7 @@
   <field>
     <name>id</name>
     <type>int unsigned</type>
-    <title>Internal Contact ID</title>
+    <title>Contact ID</title>
     <import>true</import>
     <headerPattern>/internal|contact?|id$/i</headerPattern>
     <required>true</required>
   </index>
   <field>
     <name>source</name>
-    <title>Source of Contact Data</title>
+    <title>Contact Source</title>
     <uniqueName>contact_source</uniqueName>
     <type>varchar</type>
     <length>255</length>
     </html>
 
     <import>true</import>
-    <headerPattern>/(S(ource\s)?o(f\s)?C(ontact\s)?Data)$/i</headerPattern>
+    <headerPattern>/(C(ontact\s)?Source)$/i</headerPattern>
     <comment>where contact come from, e.g. import, donate module insert...</comment>
     <add>1.1</add>
   </field>
   </field>
   <field>
     <name>is_deceased</name>
-    <title>Is Deceased</title>
+    <title>Deceased</title>
     <import>true</import>
     <export>true</export>
     <headerPattern>/i(s\s)?d(eceased)$/i</headerPattern>
index 552d46f11a6800ec4a869d70b844eada74139745..007d5b52754b05e84bea4620a1ab31a02dec4d0d 100644 (file)
   </field>
   <field>
     <name>is_deceased</name>
-    <title>Is Deceased</title>
+    <title>Deceased</title>
     <import>true</import>
     <export>true</export>
     <headerPattern>/i(s\s)?d(eceased)$/i</headerPattern>
index 705a265a3c3c8f39733f4e2bd4fc2eabd543879e..f530b032118a1a73983bcf3c934543239f227652 100644 (file)
@@ -34,6 +34,7 @@
     <length>64</length>
     <comment>label for relationship of contact_a to contact_b.</comment>
     <add>3.0</add>
+    <localizable>true</localizable>
   </field>
   <field>
     <name>name_b_a</name>
@@ -50,6 +51,7 @@
     <length>64</length>
     <comment>Optional label for relationship of contact_b to contact_a.</comment>
     <add>3.0</add>
+    <localizable>true</localizable>
   </field>
   <field>
     <name>description</name>
@@ -58,6 +60,7 @@
     <length>255</length>
     <comment>Optional verbose description of the relationship type.</comment>
     <add>1.1</add>
+    <localizable>true</localizable>
   </field>
   <field>
     <name>contact_type_a</name>
index e7b166204e8cccef54f929170c42dab95d2b99df..84c80292a8d070c6f19b79c6763e8ee0f03ffe6d 100644 (file)
   <field>
     <name>payment_instrument_id</name>
     <uniqueName>payment_instrument_id</uniqueName>
-    <title>Payment Instrument ID</title>
+    <title>Payment Method</title>
     <type>int unsigned</type>
     <comment>FK to Payment Instrument</comment>
     <pseudoconstant>
   </index>
   <field>
     <name>receive_date</name>
+    <title>Date Received</title>
     <type>datetime</type>
     <import>true</import>
     <headerPattern>/receive(.?date)?/i</headerPattern>
     <dataPattern>/^\d{4}-?\d{2}-?\d{2} ?(\d{2}:?\d{2}:?(\d{2})?)?$/</dataPattern>
-    <comment>when was gift received</comment>
+    <comment>Date contribution was received - not necessarily the creation date of the record</comment>
     <add>1.3</add>
     <html>
      <type>Select Date</type>
index 122696f32dcc18333c865b7d4815480485d056db..9e5cfaf6bea222249bc40f90b707f795ed32352c 100644 (file)
   </foreignKey>
   <field>
     <name>payment_instrument_id</name>
-    <title>Payment Instrument</title>
+    <title>Payment Method</title>
     <type>int unsigned</type>
     <comment>FK to Payment Instrument</comment>
     <pseudoconstant>
index d23de1c1553cac94ce534b22156276c53295f51c..6585bc4e91d2fb84ca1f9cdb4f5e865659f43ccc 100644 (file)
   </foreignKey>
   <field>
     <name>postal_code_suffix</name>
-    <title>Zip / Postal Code Suffix</title>
+    <title>Postal Code Suffix</title>
     <type>varchar</type>
     <length>12</length>
     <import>true</import>
     <add>1.1</add>
     <html>
       <type>Text</type>
+      <size>3</size>
     </html>
   </field>
   <field>
     <name>postal_code</name>
-    <title>Zip / Postal Code</title>
+    <title>Postal Code</title>
     <type>varchar</type>
     <length>12</length>
     <import>true</import>
     <headerPattern>/postal|zip/i</headerPattern>
     <dataPattern>/\d?\d{4}(-\d{4})?/</dataPattern>
-    <comment>Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate
-      validation.
-    </comment>
+    <comment>Store both US (zip5) AND international postal codes. App is responsible for country/region appropriate validation.</comment>
     <add>1.1</add>
     <html>
       <type>Text</type>
+      <size>6</size>
     </html>
   </field>
   <field>
index ea69244281027d6da5dc93b3b61cf317ca519eb1..b400d66eea4c0f5a4e8be6f0ca98667637502dad 100644 (file)
     <comment>a pseudo-FK to civicrm_option_value containing PDF Page Format.</comment>
     <pseudoconstant>
       <optionGroupName>pdf_format</optionGroupName>
+      <keyColumn>id</keyColumn>
     </pseudoconstant>
     <add>3.4</add>
   </field>
index b3926b7c6c82bea97cf2835dc52b8015f6218f93..03fbf024d7430e3af4fe8272676fb6f6ba2d35eb 100755 (executable)
   <field>
     <name>payment_instrument_id</name>
     <uniqueName>financial_trxn_payment_instrument_id</uniqueName>
-    <title>Payment Instrument</title>
+    <title>Payment Method</title>
     <type>int unsigned</type>
     <comment>FK to payment_instrument option group values</comment>
     <pseudoconstant>
index e93e0a77551184b4a4922df7fce91f59015f44a8..f880640595af6ee821a4e6a737deb14deb8a2ef9 100644 (file)
   </field>
   <field>
     <name>payment_instrument_id</name>
-    <title>Payment Instrument</title>
+    <title>Payment Method</title>
     <type>int unsigned</type>
     <default>1</default>
     <comment>Payment Instrument ID</comment>
index e5cd323f10c1f9364e9f592d319db97301622735..3e5de52682177e672cd760d741ec17e2c42a1c2c 100644 (file)
   </field>
   <field>
     <name>payment_instrument_id</name>
-    <title>Payment Instrument</title>
+    <title>Payment Method</title>
     <type>int unsigned</type>
     <default>1</default>
     <comment>Payment Instrument ID</comment>
index 8310ec41d132c26668466c693e4417f8494d11c6..51dd870a1f440143ab5a980a2b3d546349f24230 100644 (file)
@@ -9,6 +9,7 @@
   <add>1.5</add>
   <field>
     <name>id</name>
+    <title>Membership Log ID</title>
     <type>int unsigned</type>
     <required>true</required>
     <add>1.5</add>
@@ -19,6 +20,7 @@
   </primaryKey>
   <field>
     <name>membership_id</name>
+    <title>Membership ID</title>
     <type>int unsigned</type>
     <required>true</required>
     <comment>FK to Membership table</comment>
@@ -48,6 +50,7 @@
   </foreignKey>
   <field>
     <name>start_date</name>
+    <title>Membership Log Start Date</title>
     <type>date</type>
     <dataPattern>/\d{4}-?\d{2}-?\d{2}/</dataPattern>
     <comment>New membership period start date</comment>
@@ -55,6 +58,7 @@
   </field>
   <field>
     <name>end_date</name>
+    <title>Membership Log End Date</title>
     <type>date</type>
     <dataPattern>/\d{4}-?\d{2}-?\d{2}/</dataPattern>
     <comment>New membership period expiration date.</comment>
@@ -62,6 +66,7 @@
   </field>
   <field>
     <name>modified_id</name>
+    <title>Membership Log modified By</title>
     <type>int unsigned</type>
     <comment>FK to Contact ID of person under whose credentials this data modification was made.</comment>
     <add>1.5</add>
@@ -83,6 +88,7 @@
   </field>
   <field>
     <name>membership_type_id</name>
+    <title>Membership Type ID</title>
     <type>int unsigned</type>
     <comment>FK to Membership Type.</comment>
     <add>3.4</add>
   </foreignKey>
   <field>
     <name>max_related</name>
+    <title>Maximum Related Memberships</title>
     <type>int</type>
     <comment>Maximum number of related memberships.</comment>
     <add>4.3</add>
index c4267b2d8a4dc5fddab299e16a1a549fc3d4e4f9..1606e2068955f483b5ba73486300d7918df95bf5 100644 (file)
@@ -141,7 +141,7 @@ VALUES
    ('individual_suffix'             , '{ts escape="sql"}Individual contact suffixes{/ts}'        , 1, 1, 0),
    ('acl_role'                      , '{ts escape="sql"}ACL Role{/ts}'                           , 1, 1, 0),
    ('accept_creditcard'             , '{ts escape="sql"}Accepted Credit Cards{/ts}'              , 1, 1, 0),
-   ('payment_instrument'            , '{ts escape="sql"}Payment Instruments{/ts}'                , 1, 1, 0),
+   ('payment_instrument'            , '{ts escape="sql"}Payment Methods{/ts}'                    , 1, 1, 0),
    ('contribution_status'           , '{ts escape="sql"}Contribution Status{/ts}'                , 1, 1, 1),
    ('pcp_status'                    , '{ts escape="sql"}PCP Status{/ts}'                         , 1, 1, 1),
    ('pcp_owner_notify'              , '{ts escape="sql"}PCP owner notifications{/ts}'            , 1, 1, 1),
@@ -546,7 +546,7 @@ VALUES
   (@option_group_id_adOpt, '{ts escape="sql"}Supplemental Address 1{/ts}'  ,  2, 'supplemental_address_1', NULL, 0, NULL,  2, NULL, 0, 0, 1, NULL, NULL),
   (@option_group_id_adOpt, '{ts escape="sql"}Supplemental Address 2{/ts}'  ,  3, 'supplemental_address_2', NULL, 0, NULL,  3, NULL, 0, 0, 1, NULL, NULL),
   (@option_group_id_adOpt, '{ts escape="sql"}City{/ts}'              ,  4, 'city'          , NULL, 0, NULL,  4, NULL, 0, 0, 1, NULL, NULL),
-  (@option_group_id_adOpt, '{ts escape="sql"}Zip / Postal Code{/ts}' ,  5, 'postal_code'   , NULL, 0, NULL,  5, NULL, 0, 0, 1, NULL, NULL),
+  (@option_group_id_adOpt, '{ts escape="sql"}Postal Code{/ts}' ,  5, 'postal_code'   , NULL, 0, NULL,  5, NULL, 0, 0, 1, NULL, NULL),
   (@option_group_id_adOpt, '{ts escape="sql"}Postal Code Suffix{/ts}',  6, 'postal_code_suffix', NULL, 0, NULL,  6, NULL, 0, 0, 1, NULL, NULL),
   (@option_group_id_adOpt, '{ts escape="sql"}County{/ts}'            ,  7, 'county'        , NULL, 0, NULL,  7, NULL, 0, 0, 1, NULL, NULL),
   (@option_group_id_adOpt, '{ts escape="sql"}State/Province{/ts}'  ,  8, 'state_province', NULL, 0, NULL,  8, NULL, 0, 0, 1, NULL, NULL),
@@ -1479,7 +1479,7 @@ INSERT INTO civicrm_uf_field
        ( 10,     'contribution_status_id',      1, 1, 3, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Status{/ts}', 'Contribution', NULL, NULL ),
        ( 10,     'receive_date',                1, 1, 4, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Received{/ts}', 'Contribution', NULL, NULL ),
        ( 10,     'contribution_source',         0, 0, 5, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Source{/ts}', 'Contribution', NULL, NULL ),
-       ( 10,     'payment_instrument',          0, 0, 6, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Paid By{/ts}', 'Contribution', NULL, NULL ),
+       ( 10,     'payment_instrument',          0, 0, 6, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Payment Method{/ts}', 'Contribution', NULL, NULL ),
        ( 10,     'check_number',                0, 0, 7, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Check Number{/ts}', 'Contribution', NULL, NULL ),
        ( 10,     'send_receipt',                0, 0, 8, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Send Receipt{/ts}', 'Contribution', NULL, NULL ),
        ( 10,     'invoice_id',                  0, 0, 9, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Invoice ID{/ts}', 'Contribution', NULL, NULL ),
@@ -1494,7 +1494,7 @@ INSERT INTO civicrm_uf_field
        ( 11,     'financial_type',              0, 1, 7, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Financial Type{/ts}', 'Membership', NULL, NULL ),
        ( 11,     'total_amount',                0, 1, 8, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Amount{/ts}', 'Membership', NULL, NULL ),
        ( 11,     'receive_date',                1, 1, 9, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Received{/ts}', 'Membership', NULL, NULL ),
-       ( 11,     'payment_instrument',          0, 0, 10, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Paid By{/ts}', 'Membership', NULL, NULL ),
+       ( 11,     'payment_instrument',          0, 0, 10, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Payment Method{/ts}', 'Membership', NULL, NULL ),
        ( 11,     'check_number',                0, 0, 11, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Check Number{/ts}', 'Membership', NULL, NULL ),
        ( 11,     'contribution_status_id',      1, 1, 12, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Payment Status{/ts}', 'Membership', NULL, NULL ),
        ( 11,     'soft_credit',                 0, 0, 13, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Soft Credit{/ts}', 'Membership', NULL, NULL ),
index 60fed5aca1524177f6a50c901cedc8a8f03aae09..682895f348e8c594eeb21761827bf623d5d4bf10 100644 (file)
@@ -514,7 +514,7 @@ VALUES
     ( @domainID, 'civicrm/admin/contribute/managePremiums?reset=1',        '{ts escape="sql" skip="true"}Premiums (Thank-you Gifts){/ts}', 'Premiums',                  'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', 1,    9 ),
     ( @domainID, 'civicrm/admin/financial/financialType?reset=1',      '{ts escape="sql" skip="true"}Financial Types{/ts}',         'Financial Types',        'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', NULL, 10),
     ( @domainID, 'civicrm/admin/financial/financialAccount?reset=1',      '{ts escape="sql" skip="true"}Financial Accounts{/ts}',         'Financial Accounts',        'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', NULL, 11),
-    ( @domainID, 'civicrm/admin/options/payment_instrument?reset=1',  '{ts escape="sql" skip="true"}Payment Instruments{/ts}',    'Payment Instruments',   'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', NULL, 12 ),
+    ( @domainID, 'civicrm/admin/options/payment_instrument?reset=1',  '{ts escape="sql" skip="true"}Payment Methods{/ts}',    'Payment Instruments',   'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', NULL, 12 ),
     ( @domainID, 'civicrm/admin/options/accept_creditcard?reset=1',    '{ts escape="sql" skip="true"}Accepted Credit Cards{/ts}',  'Accepted Credit Cards', 'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', NULL, 13 ),
     ( @domainID, 'civicrm/admin/options/soft_credit_type?reset=1', '{ts escape="sql" skip="true"}Soft Credit Types{/ts}', 'Soft Credit Types', 'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', 1, 14  ),
     ( @domainID, 'civicrm/admin/price?reset=1&action=add',                  '{ts escape="sql" skip="true"}New Price Set{/ts}',              'New Price Set',             'access CiviContribute,administer CiviCRM', 'AND', @adminContributelastID, '1', NULL, 15 ),
@@ -605,28 +605,31 @@ VALUES
 INSERT INTO civicrm_navigation
     ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
 VALUES
-    ( @domainID, NULL, '{ts escape="sql" skip="true"}Help{/ts}', 'Help', NULL, '',  NULL, '1', NULL, 110);
+    ( @domainID, NULL, '{ts escape="sql" skip="true"}Support{/ts}', 'Support', NULL, '',  NULL, '1', NULL, 110);
 
 SET @adminHelplastID:=LAST_INSERT_ID();
 INSERT INTO civicrm_navigation
     ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
 VALUES
-    ( @domainID, 'http://documentation.civicrm.org',   '{ts escape="sql" skip="true"}Documentation{/ts}',      'Documentation',    NULL, 'AND', @adminHelplastID, '1', NULL, 1 ),
-    ( @domainID, 'http://forum.civicrm.org',           '{ts escape="sql" skip="true"}Community Forums{/ts}',   'Community Forums', NULL, 'AND', @adminHelplastID, '1', NULL, 2 ),
-    ( @domainID, 'http://civicrm.org/participate',     '{ts escape="sql" skip="true"}Participate{/ts}',        'Participate',      NULL, 'AND', @adminHelplastID, '1', NULL, 3 ),
-    ( @domainID, 'http://civicrm.org/what/whatiscivicrm', '{ts escape="sql" skip="true"}About{/ts}',              'About',            NULL, 'AND', @adminHelplastID, '1', NULL, 4 );
+    ( @domainID, 'http://civicrm.org/get-started?src=iam',        '{ts escape="sql" skip="true"}Get started{/ts}',        'Get started',        NULL, 'AND', @adminHelplastID, '1', NULL, 1 ),
+    ( @domainID, 'http://civicrm.org/documentation?src=iam',      '{ts escape="sql" skip="true"}Documentation{/ts}',      'Documentation',      NULL, 'AND', @adminHelplastID, '1', NULL, 2 ),
+    ( @domainID, 'http://civicrm.org/ask-a-question?src=iam',     '{ts escape="sql" skip="true"}Ask a question{/ts}',     'Ask a question',     NULL, 'AND', @adminHelplastID, '1', NULL, 3 ),
+    ( @domainID, 'http://civicrm.org/experts?src=iam',                   '{ts escape="sql" skip="true"}Get expert help{/ts}',    'Get expert help',    NULL, 'AND', @adminHelplastID, '1', NULL, 4 ),
+    ( @domainID, 'http://civicrm.org/about?src=iam',             '{ts escape="sql" skip="true"}About CiviCRM{/ts}',      'About CiviCRM',      NULL, 'AND', @adminHelplastID, '1', 1, 5 ),
+    ( @domainID, 'http://civicrm.org/register-your-site?src=iam', '{ts escape="sql" skip="true"}Register your site{/ts}', 'Register your site', NULL, 'AND', @adminHelplastID, '1', NULL, 6 ),    
+    ( @domainID, 'http://civicrm.org/become-member?src=iam',      '{ts escape="sql" skip="true"}Join CiviCRM{/ts}',       'Join CiviCRM',       NULL, 'AND', @adminHelplastID, '1', NULL, 7 );
 
 INSERT INTO civicrm_navigation
 ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
 VALUES
-    ( @domainID, NULL, '{ts escape="sql" skip="true"}Developer{/ts}', 'Developer', 'administer CiviCRM', '', @adminHelplastID, '1', NULL, 5 );
+    ( @domainID, NULL, '{ts escape="sql" skip="true"}Developer{/ts}', 'Developer', 'administer CiviCRM', '', @adminHelplastID, '1', 1, 8 );
 
 SET @devellastID:=LAST_INSERT_ID();
 INSERT INTO civicrm_navigation
 ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
 VALUES
 ( @domainID, 'civicrm/api', '{ts escape="sql" skip="true"}API Explorer{/ts}','API Explorer', 'administer CiviCRM', '', @devellastID, '1', NULL, 1 ),
-( @domainID, 'http://wiki.civicrm.org/confluence/display/CRMDOC/Develop', '{ts escape="sql" skip="true"}Developer Docs{/ts}', 'Developer Docs', 'administer CiviCRM', '', @devellastID, '1', NULL, 3 );
+( @domainID, 'http://civicrm.org/developer-documentation?src=iam', '{ts escape="sql" skip="true"}Developer Docs{/ts}', 'Developer Docs', 'administer CiviCRM', '', @devellastID, '1', NULL, 3 );
 
 INSERT INTO civicrm_navigation
     ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
index af1145a26ed7781e09493f3de58693b9e47c9cb7..8a840cef62c24540b60a62cbc006c9273a99c285 100644 (file)
      {if $receive_date}
       <tr>
        <td {$labelStyle}>
-        {ts}Received Date{/ts}
+        {ts}Date Received{/ts}
        </td>
        <td {$valueStyle}>
         {$receive_date|truncate:10:''|crmDate}
index cb3547a089a8866fac4f5f2d7ae38b08933c8265..6b46e34259eb30e24c93751578b388379b7497c7 100644 (file)
@@ -47,7 +47,7 @@
 {/if}
 {ts}Total Amount{/ts} : {$formValues.total_amount|crmMoney:$currency}
 {if $receive_date}
-{ts}Received Date{/ts}: {$receive_date|truncate:10:''|crmDate}
+{ts}Date Received{/ts}: {$receive_date|truncate:10:''|crmDate}
 {/if}
 {if $receipt_date}
 {ts}Receipt Date{/ts}: {$receipt_date|truncate:10:''|crmDate}
index 2abdab7c543d4d586c11591669316a9be62294b3..8d5347a721c63b6f5db75bfff01f02f484030c1f 100644 (file)
        {if $receive_date}
         <tr>
          <td {$labelStyle}>
-          {ts}Received Date{/ts}
+          {ts}Date Received{/ts}
          </td>
          <td {$valueStyle}>
           {$receive_date|truncate:10:''|crmDate}
index 0254609ceb4dcadce2499edaaa183eef70bdb67c..7df285af46b28f39eb8259867d826bd9259f658b 100644 (file)
@@ -69,7 +69,7 @@
 
 {ts}Amount{/ts}: {$formValues.total_amount|crmMoney}
 {if $receive_date}
-{ts}Received Date{/ts}: {$receive_date|truncate:10:''|crmDate}
+{ts}Date Received{/ts}: {$receive_date|truncate:10:''|crmDate}
 {/if}
 {if $formValues.paidBy}
 {ts}Paid By{/ts}: {$formValues.paidBy}
index 78de6adb7c5519d69d7e8130c5fd9c1cce4be7f1..9e4b6d29d66cb514b6ed368241ecb4c30d5dc609 100644 (file)
@@ -18,7 +18,7 @@
     {/if}
   </p>
   <table width="620" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">
-    <tr><td>{ts}Receive Date{/ts}:</td><td> {$receive_date|crmDate}</td></tr>
+    <tr><td>{ts}Received{/ts}:</td><td> {$receive_date|crmDate}</td></tr>
     <tr><td>{ts}Amount{/ts}:</td><td> {$total_amount|crmMoney:$currency}</td></tr>
     <tr><td>{ts}Name{/ts}:</td><td> {$donors_display_name}</td></tr>
     <tr><td>{ts}Email{/ts}:</td><td> {$donors_email}</td></tr>
index ea9ae9b2c231e0c29b297a544e444690a6978aa5..4c7f7841afc62385dbccb70149426758e4511e87 100644 (file)
@@ -11,7 +11,7 @@
     {ts}The donor's name has been added to your honor roll unless they asked not to be included.{/ts}
 {/if}
 
-{ts}Receive Date{/ts}: {$receive_date|crmDate}
+{ts}Received{/ts}: {$receive_date|crmDate}
 
 {ts}Amount{/ts}: {$total_amount|crmMoney:$currency}