Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2013-12-04-15-16-31
authorkurund <kurund@civicrm.org>
Wed, 4 Dec 2013 23:22:27 +0000 (15:22 -0800)
committerkurund <kurund@civicrm.org>
Wed, 4 Dec 2013 23:22:27 +0000 (15:22 -0800)
Conflicts:
CRM/Admin/Form/Options.php
api/v3/Contact.php
sql/civicrm_generated.mysql

64 files changed:
CRM/Activity/BAO/Activity.php
CRM/Activity/Page/AJAX.php
CRM/Admin/Form/Options.php
CRM/Admin/Page/Options.php
CRM/Contact/BAO/Query.php
CRM/Contact/BAO/Relationship.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/BAO/ContributionPage.php
CRM/Contribute/BAO/Query.php
CRM/Contribute/Form/Contribution.php
CRM/Core/BAO/Setting.php
CRM/Core/Invoke.php
CRM/Core/Permission/Drupal.php
CRM/Core/Resources.php
CRM/Dashlet/Page/Blog.php
CRM/Event/BAO/Event.php
CRM/Event/Form/EventFees.php
CRM/Event/Form/Participant.php
CRM/Export/BAO/Export.php
CRM/Mailing/BAO/MailingJob.php
CRM/Mailing/BAO/Query.php
CRM/Mailing/Event/BAO/Forward.php
CRM/Mailing/Event/BAO/Reply.php
CRM/Mailing/Event/BAO/Resubscribe.php
CRM/Mailing/Event/BAO/Subscribe.php
CRM/Mailing/Event/BAO/Unsubscribe.php
CRM/Mailing/Page/Event.php
CRM/Member/Form/Membership.php
CRM/Member/Form/MembershipRenewal.php
CRM/Member/Page/DashBoard.php
CRM/Pledge/BAO/Pledge.php
CRM/Report/Form.php
CRM/Report/Form/Contribute/PCP.php
CRM/Report/Form/Contribute/Repeat.php
CRM/Upgrade/4.4.3.msg_template/civicrm_msg_template.tpl [new file with mode: 0644]
CRM/Upgrade/4.4.3.msg_template/message_templates/event_online_receipt_html.tpl [new file with mode: 0644]
CRM/Upgrade/4.4.3.msg_template/message_templates/event_online_receipt_text.tpl [new file with mode: 0644]
CRM/Upgrade/Incremental/php/FourFour.php
CRM/Upgrade/Incremental/php/FourThree.php
CRM/Upgrade/Incremental/sql/4.3.4.mysql.tpl
CRM/Upgrade/Incremental/sql/4.3.alpha1.mysql.tpl
CRM/Upgrade/Incremental/sql/4.4.3.mysql.tpl
CRM/Utils/System/Base.php
CRM/Utils/System/WordPress.php
api/v3/ActionSchedule.php
api/v3/Contact.php
api/v3/examples/ContributionCreate.php
api/v3/utils.php
install/index.php
settings/Core.setting.php
templates/CRM/Admin/Form/ScheduleReminders.tpl
templates/CRM/Contribute/Form/Contribution.tpl
templates/CRM/Contribute/Page/Tab.hlp
templates/CRM/Event/Form/EventFees.tpl
templates/CRM/Member/Form/Membership.tpl
templates/CRM/Member/Form/MembershipRenewal.tpl
templates/CRM/Member/Page/DashBoard.tpl
tests/phpunit/api/v3/ActionScheduleTest.php
tests/phpunit/api/v3/ContributionTest.php
xml/schema/Contribute/ContributionPage.xml
xml/schema/Contribute/ContributionRecur.xml
xml/templates/civicrm_data.tpl
xml/templates/message_templates/event_online_receipt_html.tpl
xml/templates/message_templates/event_online_receipt_text.tpl

index c3913949a82c502d53c2f9c49a0aa225d299dd17..ba3a1044c85cd1916eeb5916b9d1d935f1be06b1 100644 (file)
@@ -676,6 +676,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
     $tableFields = array(
       'activity_id' => 'int unsigned',
       'activity_date_time' => 'datetime',
+      'source_record_id' => 'int unsigned',
       'status_id' => 'int unsigned',
       'subject' => 'varchar(255)',
       'source_contact_name' => 'varchar(255)',
@@ -710,6 +711,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
     $insertSQL = "INSERT INTO {$activityTempTable} (" . implode(',', $insertValueSQL) . " ) ";
 
     $order = $limit = $groupBy = '';
+    $groupBy = " GROUP BY tbl.activity_id ";
 
     if (!empty($input['sort'])) {
       if (is_a($input['sort'], 'CRM_Utils_Sort')) {
@@ -758,23 +760,22 @@ LEFT JOIN  civicrm_case_activity ON ( civicrm_case_activity.activity_id = tbl.ac
     // create temp table for target contacts
     $activityContactTempTable = "civicrm_temp_activity_contact_{$randomNum}";
     $query = "CREATE TEMPORARY TABLE {$activityContactTempTable} (
-                activity_id int unsigned, contact_id int unsigned, record_type_id varchar(16), contact_name varchar(255) )
+                activity_id int unsigned, contact_id int unsigned, record_type_id varchar(16), contact_name varchar(255), is_deleted int unsigned )
                 ENGINE=MYISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci";
 
     CRM_Core_DAO::executeQuery($query);
 
     // note that we ignore bulk email for targets, since we don't show it in selector
     $query = "
-INSERT INTO {$activityContactTempTable} ( activity_id, contact_id, record_type_id, contact_name )
+INSERT INTO {$activityContactTempTable} ( activity_id, contact_id, record_type_id, contact_name, is_deleted )
 SELECT     ac.activity_id,
            ac.contact_id,
            ac.record_type_id,
-           c.sort_name
+           c.sort_name,
+           c.is_deleted
 FROM       civicrm_activity_contact ac
 INNER JOIN {$activityTempTable} ON ( ac.activity_id = {$activityTempTable}.activity_id )
 INNER JOIN civicrm_contact c ON c.id = ac.contact_id
-WHERE      c.is_deleted = 0
-
 ";
     CRM_Core_DAO::executeQuery($query);
 
@@ -784,7 +785,8 @@ WHERE      c.is_deleted = 0
 SELECT     {$activityTempTable}.*,
            {$activityContactTempTable}.contact_id,
            {$activityContactTempTable}.record_type_id,
-           {$activityContactTempTable}.contact_name
+           {$activityContactTempTable}.contact_name,
+           {$activityContactTempTable}.is_deleted
 FROM       {$activityTempTable}
 INNER JOIN {$activityContactTempTable} on {$activityTempTable}.activity_id = {$activityContactTempTable}.activity_id
 ORDER BY    fixed_sort_order
@@ -834,6 +836,11 @@ ORDER BY    fixed_sort_order
         $values[$activityID]['target_contact_name'] = array();
       }
 
+      // if deleted, wrap in <del>
+      if ( $dao->is_deleted ) {
+        $dao->contact_name = "<del>{$dao->contact_name}</dao>";
+      }
+
       if ($dao->record_type_id == $sourceID  && $dao->contact_id) {
         $values[$activityID]['source_contact_id'] = $dao->contact_id;
         $values[$activityID]['source_contact_name'] = $dao->contact_name;
@@ -864,33 +871,6 @@ ORDER BY    fixed_sort_order
       }
     }
 
-    // add info on whether the related contacts are deleted (CRM-5673)
-    // FIXME: ideally this should be tied to ACLs
-
-    // grab all the related contact ids
-    $cids = array();
-    foreach ($values as $value) {
-      $cids[] = $value['source_contact_id'];
-    }
-    $cids = array_filter(array_unique($cids));
-
-    // see which of the cids are of deleted contacts
-    if ($cids) {
-      $sql  = 'SELECT id FROM civicrm_contact WHERE id IN (' . implode(', ', $cids) . ') AND is_deleted = 1';
-      $dao  = CRM_Core_DAO::executeQuery($sql);
-      $dels = array();
-      while ($dao->fetch()) {
-        $dels[] = $dao->id;
-      }
-
-      // hide the deleted contacts
-      foreach ($values as & $value) {
-        if (in_array($value['source_contact_id'], $dels)) {
-          unset($value['source_contact_id'], $value['source_contact_name']);
-        }
-      }
-    }
-
     return $values;
   }
 
@@ -1055,13 +1035,14 @@ LEFT JOIN   civicrm_case_activity ON ( civicrm_case_activity.activity_id = tbl.a
     $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
     $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
     $sourceJoin = "
-INNER JOIN civicrm_activity_contact ac ON ac.activity_id = civicrm_activity.id AND record_type_id = {$sourceID}
+INNER JOIN civicrm_activity_contact ac ON ac.activity_id = civicrm_activity.id
 INNER JOIN civicrm_contact contact ON ac.contact_id = contact.id
 ";
 
     if (!$input['count']) {
       $sourceSelect = ',
                 civicrm_activity.activity_date_time,
+                civicrm_activity.source_record_id,
                 civicrm_activity.status_id,
                 civicrm_activity.subject,
                 contact.sort_name as source_contact_name,
@@ -1071,6 +1052,9 @@ INNER JOIN civicrm_contact contact ON ac.contact_id = contact.id
                 civicrm_activity.campaign_id as campaign_id
             ';
 
+      $sourceJoin .= "
+LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND src.record_type_id = {$sourceID} AND src.contact_id = contact.id)
+";
     }
 
     $sourceClause = "
@@ -1096,9 +1080,9 @@ INNER JOIN civicrm_contact contact ON ac.contact_id = contact.id
       if (!$input['count']) {
         $caseSelect = ',
                 civicrm_activity.activity_date_time,
+                civicrm_activity.source_record_id,
                 civicrm_activity.status_id,
                 civicrm_activity.subject,
-                ac.contact_id,
                 contact.sort_name as source_contact_name,
                 civicrm_option_value.value as activity_type_id,
                 civicrm_option_value.label as activity_type,
@@ -2198,7 +2182,7 @@ AND cl.modified_id  = c.id
   }
 
   /**
-   * This function delete activity record related to contact record,
+   * This function deletes the activity record related to contact record,
    * when there are no target and assignee record w/ other contact.
    *
    * @param  int $contactId contactId
@@ -2216,18 +2200,27 @@ AND cl.modified_id  = c.id
 
     $transaction = new CRM_Core_Transaction();
 
-    // delete activity if there is no record in
-    // civicrm_activity_contact
-    // pointing to any other contact record.
+    // delete activity if there is no record in civicrm_activity_contact
+    // pointing to any other contact record
     $activityContact = new CRM_Activity_DAO_ActivityContact();
     $activityContact->contact_id = $contactId;
     $activityContact->record_type_id = $sourceID;
     $activityContact->find();
 
     while ($activityContact->fetch()) {
-      // finally delete activity.
-      $activityParams = array('id' => $activityContact->activity_id);
-      $result = self::deleteActivity($activityParams);
+      // delete activity_contact record for the deleted contact
+      $activityContact->delete();
+
+      $activityContactOther = new CRM_Activity_DAO_ActivityContact();
+      $activityContactOther->activity_id = $activityContact->activity_id;
+
+      // delete activity only if no other contacts connected
+      if ( ! $activityContactOther->find(TRUE) ) {
+        $activityParams = array('id' => $activityContact->activity_id);
+        $result = self::deleteActivity($activityParams);
+      }
+
+      $activityContactOther->free();
     }
 
     $activityContact->free();
@@ -2342,7 +2335,10 @@ INNER JOIN  civicrm_option_group grp ON ( grp.id = val.option_group_id AND grp.n
     //check for source contact.
     if (!$componentId || $allow) {
       $sourceContactId = self::getActivityContact($activity->id, $sourceID);
-      $allow = CRM_Contact_BAO_Contact_Permission::allow($sourceContactId, $permission);
+      //account for possibility of activity not having a source contact (as it may have been deleted)
+      if ( $sourceContactId ) {
+        $allow = CRM_Contact_BAO_Contact_Permission::allow($sourceContactId, $permission);
+      }
     }
 
     //check for target and assignee contacts.
index 659259e516adaf1c350f25c0817d61315acdbfb9..d762756be54b962d4d4fc12691aa2db5148e17e2 100644 (file)
@@ -463,12 +463,10 @@ class CRM_Activity_Page_AJAX {
       }
 
       $activityFilter = array(
-        'activity_type_filter_id' =>
-          ( CRM_Utils_Array::value('activity_type_id', $params) ) ?
-            CRM_Utils_Type::escape(CRM_Utils_Array::value('activity_type_id', $params), 'Integer') : '',
-        'activity_type_exclude_filter_id' =>
-          ( CRM_Utils_Array::value('activity_type_exclude_id', $params) ) ?
-            CRM_Utils_Type::escape(CRM_Utils_Array::value('activity_type_exclude_id', $params), 'Integer') : '',
+        'activity_type_filter_id' => empty($params['activity_type_id']) ? '' :
+          CRM_Utils_Type::escape($params['activity_type_id'], 'Integer'),
+        'activity_type_exclude_filter_id' => empty($params['activity_type_exclude_id']) ? '' :
+          CRM_Utils_Type::escape($params['activity_type_exclude_id'], 'Integer'),
       );
 
       CRM_Core_BAO_Setting::setItem(
index ec2f9327fd20385972c9ad430905389a1c0f4f2c..f44c59d198766571e39e01b8a11cb9318ab2e620 100644 (file)
@@ -270,8 +270,19 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form {
     }
 
     //fix for CRM-3552, CRM-4575
-    if (in_array($this->_gName, array(
-      'communication_style', 'email_greeting', 'postal_greeting', 'addressee', 'from_email_address', 'case_status', 'encounter_medium', 'case_type'))) {
+    $showIsDefaultGroups = array(
+      'email_greeting',
+      'postal_greeting',
+      'addressee',
+      'from_email_address',
+      'case_status',
+      'encounter_medium',
+      'case_type',
+      'payment_instrument',
+      'communication_style',
+    );
+
+    if (in_array($this->_gName, $showIsDefaultGroups)) {
       $this->assign('showDefault', TRUE);
       $this->add('checkbox', 'is_default', ts('Default Option?'));
     }
index 74395c8d5082dac08d6b81732383196b325edb91..4c4667feca305a25e1e2d98eae469f775cd45fea 100644 (file)
@@ -118,7 +118,7 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic {
           'postal_greeting', 'addressee',
           'communication_style',
           'case_status', 'encounter_medium',
-          'case_type',
+          'case_type', 'payment_instrument'
         )
       )) {
       $this->assign('showIsDefault', TRUE);
index 43bba7ed6d3ad188b4afa80d64a7be8c71d48c33..def75b7b68fc49c17298d8ef7350070d42eb6b14 100644 (file)
@@ -3197,11 +3197,15 @@ WHERE  id IN ( $groupIDs )
    */
   function phone_numeric(&$values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
-    // Strip non-numeric characters
-    $number = preg_replace('/[^\d]/', '', $value);
+    // Strip non-numeric characters; allow wildcards
+    $number = preg_replace('/[^\d%]/', '', $value);
     if ($number) {
+      if ( strpos($number, '%') === FALSE ) {
+        $number = "%$number%";
+      }
+
       $this->_qill[$grouping][] = ts('Phone number contains') . " $number";
-      $this->_where[$grouping][] = self::buildClause('civicrm_phone.phone_numeric', 'LIKE', "%$number%", 'String');
+      $this->_where[$grouping][] = self::buildClause('civicrm_phone.phone_numeric', 'LIKE', "$number", 'String');
       $this->_tables['civicrm_phone'] = $this->_whereTables['civicrm_phone'] = 1;
     }
   }
index dfa79a400639d8a6ad977849de3d393352fb9892..e369b1285be897d65c9c32b3c7425a0926b25b99 100644 (file)
@@ -1518,7 +1518,8 @@ AND cc.sort_name LIKE '%$name%'";
     } else {
       $contactTypes = array();
       foreach ($contactProfiles as $key => $value) {
-        if (strpos($value, $leftType) !== FALSE) {
+        $groupTypes = CRM_Core_BAO_UFGroup::profileGroups($key);
+        if (in_array($leftType, $groupTypes)) {
           $contactTypes = array($key => $value);
         }
       }
index f98bf898bec555bdc8d54223c991d81730063311..d276d481b4745296d7d62cb064a184a80279c2aa 100644 (file)
@@ -125,6 +125,12 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution {
       }
     }
 
+    // CRM-13420, set payment instrument to default if payment_instrument_id is empty
+    if (!$contributionID && !CRM_Utils_Array::value('payment_instrument_id', $params)) {
+      $params['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument',
+        FALSE, FALSE, FALSE, 'AND is_default = 1'));
+    }
+
     if (CRM_Utils_Array::value('payment_instrument_id', $params)) {
       $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument('name');
       if ($params['payment_instrument_id'] != array_search('Check', $paymentInstruments)) {
@@ -2566,15 +2572,43 @@ WHERE  contribution_id = %1 ";
       $params['trxnParams'] = $trxnParams;
 
       if (CRM_Utils_Array::value('prevContribution', $params)) {
+        $params['trxnParams']['total_amount'] = $trxnParams['total_amount'] = $params['total_amount'] = $params['prevContribution']->total_amount;
+        $params['trxnParams']['fee_amount'] = $params['prevContribution']->fee_amount;
+        $params['trxnParams']['net_amount'] = $params['prevContribution']->net_amount;
+        $params['trxnParams']['trxn_id'] = $params['prevContribution']->trxn_id;
+        $params['trxnParams']['status_id'] = $params['prevContribution']->contribution_status_id;
+        $params['trxnParams']['payment_instrument_id'] = $params['prevContribution']->payment_instrument_id;
+        $params['trxnParams']['check_number'] = $params['prevContribution']->check_number;
 
-        //if Change contribution amount
-        if (array_key_exists('total_amount', $params) && isset($params['total_amount']) &&
-          $params['total_amount'] != $params['prevContribution']->total_amount) {
-          //Update Financial Records
-          self::updateFinancialAccounts($params, 'changedAmount');
+        //if financial type is changed
+        if (CRM_Utils_Array::value('financial_type_id', $params) &&
+          $params['contribution']->financial_type_id != $params['prevContribution']->financial_type_id) {
+          $incomeTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
+          $oldFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $incomeTypeId);
+          $newFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $incomeTypeId);
+          if ($oldFinancialAccount != $newFinancialAccount) {
+            $params['total_amount'] = 0;
+            if ($params['contribution']->contribution_status_id == array_search('Pending', $contributionStatuses)) {
+              $params['trxnParams']['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
+                $params['prevContribution']->financial_type_id, $relationTypeId);
+            }
+            else {
+              $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC');
+              if (CRM_Utils_Array::value('financialTrxnId', $lastFinancialTrxnId)) {
+                $params['trxnParams']['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $lastFinancialTrxnId['financialTrxnId'], 'to_financial_account_id');
+              }
+            }
+            self::updateFinancialAccounts($params, 'changeFinancialType');
+            /* $params['trxnParams']['to_financial_account_id'] = $trxnParams['to_financial_account_id']; */
+            $params['financial_account_id'] = $newFinancialAccount;
+            $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
+            self::updateFinancialAccounts($params);
+            $params['trxnParams']['to_financial_account_id'] = $trxnParams['to_financial_account_id'];
+          }
         }
 
         //Update contribution status
+        $params['trxnParams']['status_id'] = $params['contribution']->contribution_status_id;
         if (CRM_Utils_Array::value('contribution_status_id', $params) &&
           $params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id) {
           //Update Financial Records
@@ -2584,7 +2618,10 @@ WHERE  contribution_id = %1 ";
         // change Payment Instrument for a Completed contribution
         // first handle special case when contribution is changed from Pending to Completed status when initial payment
         // instrument is null and now new payment instrument is added along with the payment
+        $params['trxnParams']['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
+        $params['trxnParams']['check_number'] = CRM_Utils_Array::value('check_number', $params);
         if (array_key_exists('payment_instrument_id', $params)) {
+          $params['trxnParams']['total_amount'] = - $trxnParams['total_amount'];
           if (CRM_Utils_System::isNull($params['prevContribution']->payment_instrument_id) &&
             !CRM_Utils_System::isNull($params['contribution']->payment_instrument_id)) {
             //check if status is changed from Pending to Completed
@@ -2593,6 +2630,8 @@ WHERE  contribution_id = %1 ";
               $params['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatuses))) {
               // for all other statuses create new financial records
               self::updateFinancialAccounts($params, 'changePaymentInstrument');
+              $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
+              self::updateFinancialAccounts($params, 'changePaymentInstrument');
             }
           }
           else if ((!CRM_Utils_System::isNull($params['contribution']->payment_instrument_id) ||
@@ -2600,12 +2639,13 @@ WHERE  contribution_id = %1 ";
             $params['contribution']->payment_instrument_id != $params['prevContribution']->payment_instrument_id) {
             // for any other payment instrument changes create new financial records
             self::updateFinancialAccounts($params, 'changePaymentInstrument');
+            $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
+            self::updateFinancialAccounts($params, 'changePaymentInstrument');
           }
           else if (!CRM_Utils_System::isNull($params['contribution']->check_number) &&
             $params['contribution']->check_number != $params['prevContribution']->check_number) {
             // another special case when check number is changed, create new financial records
             // create financial trxn with negative amount
-            $params['trxnParams']['total_amount'] = - $trxnParams['total_amount'];
             $params['trxnParams']['check_number'] = $params['prevContribution']->check_number;
             self::updateFinancialAccounts($params, 'changePaymentInstrument');
             // create financial trxn with positive amount
@@ -2615,24 +2655,16 @@ WHERE  contribution_id = %1 ";
           }
         }
 
-        //if financial type is changed
-        if (CRM_Utils_Array::value('financial_type_id', $params) &&
-          $params['contribution']->financial_type_id != $params['prevContribution']->financial_type_id) {
-          $incomeTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
-          $oldFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $incomeTypeId);
-          $newFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $incomeTypeId);
-          if ($oldFinancialAccount != $newFinancialAccount) {
-            $params['total_amount'] = 0;
-            if ($params['contribution']->contribution_status_id == array_search('Pending', $contributionStatuses)) {
-              $params['trxnParams']['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
-                $params['prevContribution']->financial_type_id, $relationTypeId);
-            }
-            self::updateFinancialAccounts($params, 'changeFinancialType');
-            $params['trxnParams']['to_financial_account_id'] = $trxnParams['to_financial_account_id'];
-            $params['financial_account_id'] = $newFinancialAccount;
-            $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
-            self::updateFinancialAccounts($params);
-          }
+        //if Change contribution amount
+        $params['trxnParams']['fee_amount'] = CRM_Utils_Array::value('fee_amount', $params);
+        $params['trxnParams']['net_amount'] = CRM_Utils_Array::value('net_amount', $params);
+        $params['trxnParams']['total_amount'] = $trxnParams['total_amount'] = $params['total_amount'] = $totalAmount;
+        $params['trxnParams']['trxn_id'] = $params['contribution']->trxn_id;
+        if (isset($totalAmount) &&
+          $totalAmount != $params['prevContribution']->total_amount) {
+          //Update Financial Records
+          $params['trxnParams']['from_financial_account_id'] = NULL;
+          self::updateFinancialAccounts($params, 'changedAmount');
         }
       }
 
@@ -2718,23 +2750,18 @@ WHERE  contribution_id = %1 ";
       $itemAmount = $params['trxnParams']['total_amount'];
     }
     elseif ($context == 'changePaymentInstrument') {
-      if ($params['prevContribution']->payment_instrument_id != null
-        && $params['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatus)
-        && $params['contribution']->contribution_status_id == array_search('Pending', $contributionStatus)) {
-        $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
-        $params['trxnParams']['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
-      }
-      elseif ($params['prevContribution']->payment_instrument_id != null) {
-        $params['trxnParams']['from_financial_account_id'] =
-          CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount(
-            $params['prevContribution']->payment_instrument_id);
+      if ($params['trxnParams']['total_amount'] < 0) {
+        $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC');
+        if (CRM_Utils_Array::value('financialTrxnId', $lastFinancialTrxnId)) {
+          $params['trxnParams']['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $lastFinancialTrxnId['financialTrxnId'], 'to_financial_account_id');
+          $params['trxnParams']['payment_instrument_id'] = $params['prevContribution']->payment_instrument_id;
+        }
       }
       else {
-        $params['trxnParams']['from_financial_account_id'] = CRM_Core_DAO::singleValueQuery(
-          "SELECT id FROM civicrm_financial_account WHERE is_default = 1");
+        $params['trxnParams']['to_financial_account_id'] = $params['to_financial_account_id'];
+        $params['trxnParams']['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
       }
     }
-
     $trxn = CRM_Core_BAO_FinancialTrxn::create($params['trxnParams']);
     $params['entity_id'] = $trxn->id;
 
index 8a37c39308de41ebb1ee5082159f8f73fa32bef0..83031675a9f348f3a24cbf93d17414b1b8d27e97 100644 (file)
@@ -55,7 +55,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
     $dao = new CRM_Contribute_DAO_ContributionPage();
     $dao->copyValues($params);
     $dao->save();
-    if ($financialTypeId && CRM_Utils_Array::value('financial_type_id', $params) 
+    if ($financialTypeId && CRM_Utils_Array::value('financial_type_id', $params)
       && $financialTypeId != $params['financial_type_id']) {
       CRM_Price_BAO_PriceFieldValue::updateFinancialType($params['id'], 'civicrm_contribution_page', $params['financial_type_id']);
     }
@@ -491,7 +491,11 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio
         'toName' => $displayName,
         'toEmail' => $email,
       );
-
+      //CRM-13811 
+      if ($pageID) {
+        $templatesParams['cc'] = CRM_Utils_Array::value('cc_receipt', $value[$pageID]);
+        $templatesParams['bcc'] = CRM_Utils_Array::value('bcc_receipt', $value[$pageID]);
+      }
       if ($recur->id) {
         // in some cases its just recurringNotify() thats called for the first time and these urls don't get set.
         // like in PaypalPro, & therefore we set it here additionally.
index 2fd333a73c5206dc8f0710629f919c7b53c43745..6f1fe39a4f2751c5976496aa027809d706fc7a8d 100644 (file)
@@ -301,14 +301,47 @@ class CRM_Contribute_BAO_Query {
         $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
         return;
 
-        case 'financial_type_id':
-        case 'financial_type':
-        $cType = $value;
+      case 'financial_type_id':
+      case 'financial_type':
+        // The financial_type_id might be an array (from aggregate contributions custom search)
+        // In this case, we need to change the query.
+        if (is_array($value)) {
+          $val = array();
+          // Rebuild the array to get the data we're interested in as array
+          // values not array keys.
+          foreach ($value as $k => $v) {
+            if ($v) {
+              $val[] = $k;
+            }
+          }
+          if (count($val) > 1) {
+            // Overwrite $value so it works with an IN where statement.
+            $op = 'IN';
+            $value = '(' . implode(',', $val) . ')';
+          }
+          else {
+            // If we somehow have an empty array, just return
+            return;
+          }
+        }
+
         $types = CRM_Contribute_PseudoConstant::financialType();
+
+        // Ensure we have a sensible string to display to the user.
+        $names = array();
+        if (isset($val) && is_array($val)) {
+          foreach($val as $id) {
+            $names[] = $types[$id];
+          }
+        }
+        else {
+          $names[] = $types[$value];
+        }
+
         $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.financial_type_id",
           $op, $value, "Integer"
         );
-        $query->_qill[$grouping ][] = ts('Financial Type - %1', array(1 => $types[$cType]));
+        $query->_qill[$grouping][] = ts('Financial Type %1', array(1 => $op)) . ' ' . implode(' ' . ts('or') . ' ', $names);
         $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
         return;
 
index fc31ea359b959ef7e1982375ff408fe42792f81e..9f7e9f6d63f6273d7d3f7588155aa580452b4207 100644 (file)
@@ -349,6 +349,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     if ($this->_contributionType) {
       $defaults['financial_type_id'] = $this->_contributionType;
     }
+    
+    if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+      $defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
+    }
 
     if (CRM_Utils_Array::value('is_test', $defaults)) {
       $this->assign('is_test', TRUE);
@@ -650,7 +654,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
       $paymentInstrument = $this->add('select', 'payment_instrument_id',
         ts('Paid By'),
         array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
-        FALSE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
+        TRUE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
       );
     }
 
index 376970d1212b3885c1db6d525df0fa1d403e12e8..5638032038cbd8b541d8a952e285c2275cbb2eec 100644 (file)
@@ -690,7 +690,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting {
       return;
     }
     else if (array_keys($filters) == array('name')) {
-      $settingSpec = array($filters['name'] => CRM_Utils_Array::value($filters['name'], $settingSpec));
+      $settingSpec = array($filters['name'] => CRM_Utils_Array::value($filters['name'], $settingSpec, ''));
       return;
     }
     else {
index 221504f2101f2219bed378200553cc19ca0ae627..516845ff4c8878b5ad1a44240e8125050d455c19 100644 (file)
@@ -494,6 +494,9 @@ class CRM_Core_Invoke {
     // also cleanup module permissions
     $config->cleanupPermissions();
 
+    // also rebuild word replacement cache
+    CRM_Core_BAO_WordReplacement::rebuild();
+
     CRM_Core_BAO_Setting::updateSettingsFromMetaData();
     CRM_Core_Resources::singleton()->resetCacheCode();
 
index 1881cfd2c0f84845ee709fc05daba1b300027ca7..b08de996d4498375a35da76332ab079704043102 100644 (file)
@@ -127,5 +127,40 @@ class CRM_Core_Permission_Drupal extends CRM_Core_Permission_DrupalBase{
       ->condition('permission', array_keys($permissions), 'NOT IN');
     $query->execute();
   }
+
+  /**
+   * Get all the contact emails for users that have a specific permission
+   *
+   * @param string $permissionName name of the permission we are interested in
+   *
+   * @return string a comma separated list of email addresses
+   */
+  public function permissionEmails($permissionName) {
+    static $_cache = array();
+
+    if (isset($_cache[$permissionName])) {
+      return $_cache[$permissionName];
+    }
+
+    $uids = array();
+    $sql = "
+      SELECT {users}.uid, {role_permission}.permission
+      FROM {users}
+      JOIN {users_roles}
+        ON {users}.uid = {users_roles}.uid
+      JOIN {role_permission}
+        ON {role_permission}.rid = {users_roles}.rid
+      WHERE {role_permission}.permission = '{$permissionName}'
+        AND {users}.status = 1
+    ";
+
+    $result = db_query($sql);
+    foreach ( $result as $record ) {
+      $uids[] = $record->uid;
+    }
+
+    $_cache[$permissionName] = self::getContactEmails($uids);
+    return $_cache[$permissionName];
+  }
 }
 
index 558455422a13ad57b289852be6208d384e8f8587..8ef8f8778a6bf36d42db2338a46f745f34f54bbe 100644 (file)
@@ -491,7 +491,7 @@ class CRM_Core_Resources {
       // Load custom or core css
       $config = CRM_Core_Config::singleton();
       if (!empty($config->customCSSURL)) {
-        $this->addStyleUrl($config->customCSSURL, -99, $region);
+        $this->addStyleUrl($config->customCSSURL, 99, $region);
       }
       if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'disable_core_css')) {
         $this->addStyleFile('civicrm', 'css/civicrm.css', -99, $region);
index 40e355f9dfdb9b42ac22f395b5c37f3dde787f31..1c3d78c7be3088bd0c923e9e57d5c209576fc427 100644 (file)
@@ -42,6 +42,21 @@ class CRM_Dashlet_Page_Blog extends CRM_Core_Page {
   const CACHE_DAYS = 1;
   const BLOG_URL = 'https://civicrm.org/blog/feed';
 
+  /**
+   * Get the final, usable URL string (after interpolating any variables)
+   *
+   * @return FALSE|string
+   */
+  public function getBlogUrl() {
+    // Note: We use "*default*" as the default (rather than self::BLOG_URL) so that future
+    // developers can change BLOG_URL without needing to update {civicrm_setting}.
+    $url = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'blogUrl', NULL, '*default*');
+    if ($url === '*default*') {
+      $url = self::BLOG_URL;
+    }
+    return CRM_Utils_System::evalUrl($url);
+  }
+
   /**
    * List blog articles as dashlet
    *
@@ -72,7 +87,7 @@ class CRM_Dashlet_Page_Blog extends CRM_Core_Page {
       $expire = time() - (60 * 60 * 24 * self::CACHE_DAYS);
       // Refresh data after CACHE_DAYS
       if (strtotime($cache->created_date) < $expire) {
-        $new_data = $this->_getFeed();
+        $new_data = $this->_getFeed($this->getBlogUrl());
         // If fetching the new rss feed was successful, return it
         // Otherwise use the old cached data - it's better than nothing
         if ($new_data) {
@@ -81,7 +96,7 @@ class CRM_Dashlet_Page_Blog extends CRM_Core_Page {
       }
       return unserialize($cache->data);
     }
-    return $this->_getFeed();
+    return $this->_getFeed($this->getBlogUrl());
   }
 
   /**
@@ -91,7 +106,7 @@ class CRM_Dashlet_Page_Blog extends CRM_Core_Page {
    *
    * @access public
    */
-  public function _getFeed( $url = self::BLOG_URL) {
+  public function _getFeed($url) {
     $httpClient = new CRM_Utils_HttpClient(self::CHECK_TIMEOUT);
     list ($status, $rawFeed) = $httpClient->get($url);
     if ($status !== CRM_Utils_HttpClient::STATUS_OK) {
index 54da21dd37726c0b50b98ca93e7bc6fc204172f6..9882fae51dc2c13891361fbb9546ad20ae78d9aa 100644 (file)
@@ -1104,6 +1104,13 @@ WHERE civicrm_event.is_active = 1
             'conference_sessions' => $sessions,
           ));
 
+        // 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']) && !CRM_Utils_Array::value('isOnWaitlist', $values['params'])) {
+          $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $participantId, 'status_id', 'id');
+          $tplParams['participant_status'] = CRM_Event_PseudoConstant::participantStatus($statusId, NULL, 'label');
+        }
+
         $sendTemplateParams = array(
           'groupName' => 'msg_tpl_workflow_event',
           'valueName' => 'event_online_receipt',
index f71d404802bdb7eef87b509d4bae4804fb0065ed..05e6fabe73112f7ca99e36b8cf783d85155099ad 100644 (file)
@@ -121,10 +121,14 @@ class CRM_Event_Form_EventFees {
 
     //CRM-11601 we should keep the record contribution
     //true by default while adding participant
-     if ($form->_action == CRM_Core_Action::ADD && !$form->_mode && $form->_isPaidEvent) {
+    if ($form->_action == CRM_Core_Action::ADD && !$form->_mode && $form->_isPaidEvent) {
       $defaults[$form->_pId]['record_contribution'] = 1;
     }
-
+    
+    //CRM-13420
+    if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+      $defaults[$form->_pId]['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
+    }
     if ($form->_mode) {
       $config = CRM_Core_Config::singleton();
       // set default country from config if no country set
index 19faf3c9a2ab03407bf14be9c5eebfeded0b0c74..daf8e42913e46bbec70de4dc0e5ed0cf82325fe7 100644 (file)
@@ -574,9 +574,10 @@ SELECT civicrm_custom_group.name as name,
       if (CRM_Utils_Array::value('event_id', $defaults[$this->_id])) {
         $contributionTypeId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event',
           $defaults[$this->_id]['event_id'],
-                                                                    'financial_type_id' );
+          'financial_type_id' 
+        );
         if ($contributionTypeId) {
-                    $defaults[$this->_id]['financial_type_id'] = $contributionTypeId;
+          $defaults[$this->_id]['financial_type_id'] = $contributionTypeId;
         }
       }
 
@@ -990,8 +991,13 @@ loadCampaign( {$this->_eID}, {$eventCampaigns} );
       CRM_Core_Payment_Form::validateCreditCard($values, $errorMsg);
     }
 
-    if (CRM_Utils_Array::value('record_contribution', $values) && !CRM_Utils_Array::value('financial_type_id', $values)) {
-      $errorMsg['financial_type_id'] = ts('Please enter the associated Financial Type');
+    if (CRM_Utils_Array::value('record_contribution', $values)) {
+      if (!CRM_Utils_Array::value('financial_type_id', $values)) {
+        $errorMsg['financial_type_id'] = ts('Please enter the associated Financial Type');
+      }
+      if (!CRM_Utils_Array::value('payment_instrument_id', $values)) {
+        $errorMsg['payment_instrument_id'] = ts('Paid By is a required field.');
+      }
     }
 
     // validate contribution status for 'Failed'.
index 9781c9e4240563a199108fc3c0191e2315a91dbc..94a0a4975c5e41722f2dda45c99601aec8c21b97 100644 (file)
@@ -1137,7 +1137,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
    * Function to handle import error file creation.
    *
    */
-  function invoke() {
+  static function invoke() {
     $type = CRM_Utils_Request::retrieve('type', 'Positive', CRM_Core_DAO::$_nullObject);
     $parserName = CRM_Utils_Request::retrieve('parser', 'String', CRM_Core_DAO::$_nullObject);
     if (empty($parserName) || empty($type)) {
@@ -1174,7 +1174,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
     CRM_Utils_System::civiExit();
   }
 
-  function exportCustom($customSearchClass, $formValues, $order) {
+  static function exportCustom($customSearchClass, $formValues, $order) {
     $ext = CRM_Extension_System::singleton()->getMapper();
     if (!$ext->isExtensionClass($customSearchClass)) {
       require_once (str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php');
@@ -1814,7 +1814,7 @@ LIMIT $offset, $limit
    * or have no street address
    *
    */
-  function postalMailingFormat($exportTempTable, &$headerRows, &$sqlColumns, $exportParams) {
+  static function postalMailingFormat($exportTempTable, &$headerRows, &$sqlColumns, $exportParams) {
     $whereClause = array();
 
     if (array_key_exists('is_deceased', $sqlColumns)) {
index 51417a320374d93e62417802c5b0444ecc6891ed..fab73ea23a236859f5204fc9b32e0eb604dcfe48 100644 (file)
@@ -518,11 +518,7 @@ VALUES (%1, %2, %3, %4, %5, %6, %7)
     $fields = array();
 
     if (!empty($testParams)) {
-      $mailing->from_name = ts(
-        'CiviCRM Test Mailer (%1)',
-        array(1 => $mailing->from_name)
-      );
-      $mailing->subject = ts('Test Mailing:') . ' ' . $mailing->subject;
+      $mailing->subject = ts('[CiviMail Draft]') . ' ' . $mailing->subject;
     }
 
     CRM_Mailing_BAO_Mailing::tokenReplace($mailing);
index c9e623b1de5153979fcf4750c3de98a282bb57de..dc639f2f12706f3d187003d7c8d1e104f7c6967c 100644 (file)
@@ -397,42 +397,6 @@ class CRM_Mailing_BAO_Query {
     $form->add('checkbox', 'mailing_forward', ts('Forwards'));
 
     $form->assign('validCiviMailing', TRUE);
-    $form->addFormRule(array('CRM_Mailing_BAO_Query', 'formRule'), $form);
-  }
-
-  /**
-   * global form rule
-   *
-   * @param array $fields  the input form values
-   * @param array $files   the uploaded files if any
-   * @param array $options additional user data
-   *
-   * @return true if no errors, else array of errors
-   * @access public
-   * @static
-   */
-  static function formRule($fields, $files, $self) {
-    $errors = array();
-    // if an event filter is specified, then a mailing selector must also be specified
-    if ((CRM_Utils_Array::value('mailing_delivery_status', $fields) ||
-        CRM_Utils_Array::value('mailing_open_status', $fields) ||
-        CRM_Utils_Array::value('mailing_click_status', $fields) ||
-        CRM_Utils_Array::value('mailing_reply_status', $fields) ||
-        CRM_Utils_Array::value('mailing_bounce_types', $fields)
-      ) &&
-      (!CRM_Utils_Array::value('mailing_id', $fields) &&
-        !CRM_Utils_Array::value('mailing_date_low', $fields) &&
-        !CRM_Utils_Array::value('mailing_date_high', $fields)
-      )
-    ) {
-      $errors['mailing_id'] = ts('Must specify mailing name or date');
-      // Keep search form opened in case of form rule.
-      if (is_a($self, 'CRM_Contact_Form_Search_Advanced') && !isset(CRM_Contact_BAO_Query::$_openedPanes['Mailings'])) {
-        CRM_Contact_BAO_Query::$_openedPanes['Mailings'] = TRUE;
-        $self->assign('openedPanes', CRM_Contact_BAO_Query::$_openedPanes);
-      }
-    }
-    return $errors;
   }
 
   static function addShowHide(&$showHide) {
@@ -440,9 +404,11 @@ class CRM_Mailing_BAO_Query {
     $showHide->addShow('MailingForm_show');
   }
 
-  static function searchAction(&$row, $id) {}
+  static function searchAction(&$row, $id) {
+  }
 
-  static function tableNames(&$tables) {}
+  static function tableNames(&$tables) {
+  }
 
   /**
    * Filter query results based on which contacts do (not) have a particular mailing event in their history.
@@ -478,6 +444,7 @@ class CRM_Mailing_BAO_Query {
       $query->_qill[$grouping][] = $fieldTitle . ' - ' . $valueTitles[$value];
     }
 
+    $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
     $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] = 1;
     $query->_tables['civicrm_mailing_event_queue'] = $query->_whereTables['civicrm_mailing_event_queue'] = 1;
     $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;
index 5cd3c4b3d388cfd2a657d5b8073b01e5729459bd..e2de313e50b29cfaf233db0a20c2fa91d567480c 100644 (file)
@@ -181,11 +181,9 @@ class CRM_Mailing_Event_BAO_Forward extends CRM_Mailing_Event_DAO_Forward {
     $body = $message->get();
     $headers = $message->headers();
 
-    PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
-      array('CRM_Core_Error', 'nullHandler')
-    );
     $result = NULL;
     if (is_object($mailer)) {
+      CRM_Core_Error::ignoreException();
       $result = $mailer->send($recipient, $headers, $body);
       CRM_Core_Error::setCallback();
     }
index 1766fe21e5e9bf8cd28e9bc296cb605cd05408f1..ed7dd634dfd7d2d01e7dd5926f18b663f530f110 100644 (file)
@@ -187,10 +187,8 @@ class CRM_Mailing_Event_BAO_Reply extends CRM_Mailing_Event_DAO_Reply {
     $config = CRM_Core_Config::singleton();
     $mailer = $config->getMailer();
 
-    PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
-      array('CRM_Core_Error', 'nullHandler')
-    );
     if (is_object($mailer)) {
+      CRM_Core_Error::ignoreException();
       $mailer->send($mailing->replyto_email, $h, $b);
       CRM_Core_Error::setCallback();
     }
@@ -279,10 +277,8 @@ class CRM_Mailing_Event_BAO_Reply extends CRM_Mailing_Event_DAO_Reply {
     CRM_Mailing_BAO_Mailing::addMessageIdHeader($h, 'a', $eq->job_id, queue_id, $eq->hash);
 
     $mailer = $config->getMailer();
-    PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
-      array('CRM_Core_Error', 'nullHandler')
-    );
     if (is_object($mailer)) {
+      CRM_Core_Error::ignoreException();
       $mailer->send($to, $h, $b);
       CRM_Core_Error::setCallback();
     }
index 7c9cfc8b7cd595bf3738fe61c619f97263748c52..7f542173bc40228c0606f76f86048f373b7a7321 100644 (file)
@@ -282,10 +282,8 @@ class CRM_Mailing_Event_BAO_Resubscribe {
 
     $mailer = $config->getMailer();
 
-    PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
-      array('CRM_Core_Error', 'nullHandler')
-    );
     if (is_object($mailer)) {
+      CRM_Core_Error::ignoreException();
       $mailer->send($eq->email, $h, $b);
       CRM_Core_Error::setCallback();
     }
index 7fcd2bd51d76874f0f4b26e20345ea0c2346c63c..d6c91265e434f166eae3572acc84c15784793301 100644 (file)
@@ -284,10 +284,8 @@ SELECT     civicrm_email.id as email_id
     );
     $mailer = $config->getMailer();
 
-    PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
-      array('CRM_Core_Error', 'nullHandler')
-    );
     if (is_object($mailer)) {
+      CRM_Core_Error::ignoreException();
       $mailer->send($email, $h, $b);
       CRM_Core_Error::setCallback();
     }
index e930c160e43bc48da23a6bcc7fdf2d3e85e7b6ee..04cdbff1867e6f9ec5ef46ee24aa672d6bb7e002 100644 (file)
@@ -393,10 +393,8 @@ WHERE  email = %2
 
     $mailer = $config->getMailer();
 
-    PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
-      array('CRM_Core_Error', 'nullHandler')
-    );
     if (is_object($mailer)) {
+      CRM_Core_Error::ignoreException();
       $mailer->send($eq->email, $h, $b);
       CRM_Core_Error::setCallback();
     }
index 30f89fc08ed3e3e5e07057155f2b77f3a8a97fec..1d380b43deea28c917ee5a505a9690835911c388 100644 (file)
@@ -79,7 +79,7 @@ class CRM_Mailing_Page_Event extends CRM_Core_Page {
       $backUrlTitle = ts('Back to Mailing');
     }
     else {
-      $backUrl = CRM_Utils_System::url('civicrm/mailing', 'reset=1');
+      $backUrl = CRM_Utils_System::url('civicrm/mailing/report', "reset=1&mid={$mailing_id}");
       $backUrlTitle = ts('Back to Report');
     }
 
index 295570200a134d5a36719da35f4994c7266e5076..8a5d17e135d0ce6e5fc5fe1728b7bd3229837fff 100644 (file)
@@ -359,7 +359,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
         }
       }
     }
-
+    
     if (CRM_Utils_Array::value('record_contribution', $defaults) && !$this->_mode) {
       $contributionParams = array('id' => $defaults['record_contribution']);
       $contributionIds = array();
@@ -381,6 +381,10 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
         $defaults['source'] = $defaults['membership_source'];
       }
     }
+    //CRM-13420
+    if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+      $defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
+    }
 
     // User must explicitly choose to send a receipt in both add and update mode.
     $defaults['send_receipt'] = 0;
@@ -926,6 +930,10 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
     if (!$priceSetId && $self->_mode && !CRM_Utils_Array::value('financial_type_id', $params)) {
       $errors['financial_type_id'] = ts('Please enter the financial Type.');
     }
+    
+    if (CRM_Utils_Array::value('record_contribution', $params) && !CRM_Utils_Array::value('payment_instrument_id', $params)) {
+      $errors['payment_instrument_id'] = ts('Paid By is a required field.');
+    }
 
     if (CRM_Utils_Array::value('payment_processor_id', $params)) {
       // make sure that credit card number and cvv are valid
index 31888ba40b73154d0904ea9b58ef66ead2dc5807..57b965d6b250c0705542d860346796a0cb9fe41e 100644 (file)
@@ -244,6 +244,11 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form {
     }
 
     $defaults['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'financial_type_id');
+    
+    //CRM-13420
+    if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+      $defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
+    }
 
     $defaults['total_amount'] = CRM_Utils_Money::format(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
         $this->_memType,
@@ -544,6 +549,9 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
       if (!$params['total_amount']) {
         $errors['total_amount'] = ts('Please enter a Contribution Amount.');
       }
+      if (!CRM_Utils_Array::value('payment_instrument_id', $params)) {
+        $errors['payment_instrument_id'] = ts('Paid By is a required field.');
+      }
     }
     return empty($errors) ? TRUE : $errors;
   }
index 45dfa5abb03b2d71bce5b4824582369227436473..1b09f4982ea8717d4d57489e24fc6505d9aa7e61 100644 (file)
@@ -47,6 +47,16 @@ class CRM_Member_Page_DashBoard extends CRM_Core_Page {
    *
    */
   function preProcess() {
+
+    //CRM-13901 don't show dashboard to contacts with limited view writes & it does not relect
+    //what they have access to
+    //@todo implement acls on dashboard querys (preferably via api to enhance that at the same time)
+    if(!CRM_Core_Permission::check(array('view all contacts', 'edit all contacts'))) {
+      $this->showMembershipSummary = FALSE;
+      $this->assign('membershipSummary', FALSE);
+      return;
+    }
+    $this->assign('membershipSummary', TRUE);
     CRM_Utils_System::setTitle(ts('CiviMember'));
     $membershipSummary = array();
     $preMonth = date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y")));
index 32f97e3b50cf9f8dbc302d951e04c6af22303e3f..191af3aaf6a78a838d5b1bb84e9a99003c4a4d6a 100644 (file)
@@ -813,7 +813,7 @@ GROUP BY  currency
     return CRM_Core_DAO::singleValueQuery($query);
   }
 
-  public function updatePledgeStatus($params) {
+  public static function updatePledgeStatus($params) {
 
     $returnMessages = array();
 
index 5fddee12f0e3d42f7b6779fb9cdc5947f587829a..506b13d39bf6bdc3eab0ec75101b663eb8edda13 100644 (file)
@@ -135,6 +135,7 @@ class CRM_Report_Form extends CRM_Core_Form {
    * @var null
    */
   protected $_customGroupExtends = NULL;
+  protected $_customGroupExtendsJoin = array();
   protected $_customGroupFilters = TRUE;
   protected $_customGroupGroupBy = FALSE;
   protected $_customGroupJoin    = 'LEFT JOIN';
@@ -2879,10 +2880,11 @@ ORDER BY cg.weight, cf.weight";
         if (!$this->isFieldSelected($prop)) {
           continue;
         }
+        $baseJoin = CRM_Utils_Array::value($prop['extends'], $this->_customGroupExtendsJoin, "{$this->_aliases[$extendsTable]}.id");
 
         $customJoin   = is_array($this->_customGroupJoin) ? $this->_customGroupJoin[$table] : $this->_customGroupJoin;
         $this->_from .= "
-{$customJoin} {$table} {$this->_aliases[$table]} ON {$this->_aliases[$table]}.entity_id = {$this->_aliases[$extendsTable]}.id";
+{$customJoin} {$table} {$this->_aliases[$table]} ON {$this->_aliases[$table]}.entity_id = {$baseJoin}";
         // handle for ContactReference
         if (array_key_exists('fields', $prop)) {
           foreach ($prop['fields'] as $fieldName => $field) {
index be1b0016bf2021d7a77de42dab2c2da2b4abc6ff..a051910bd7b9c7e8902d45066f522965cb23f1a3 100644 (file)
@@ -271,6 +271,38 @@ LEFT JOIN civicrm_contribution_page {$this->_aliases['civicrm_contribution_page'
     }
   }
 
+  function statistics(&$rows) {
+    $statistics = parent::statistics($rows);
+
+    $select = "SELECT SUM({$this->_aliases['civicrm_pcp']}.goal_amount) as goal_total, ".
+      "SUM({$this->_aliases['civicrm_contribution_soft']}.amount) as committed_total, ".
+      "COUNT({$this->_aliases['civicrm_contribution_soft']}.id) as donors_total, ".
+      "SUM(IF( contribution_civireport.contribution_status_id > 1, 0, contribution_soft_civireport.amount)) AS received_total ";
+    $sql = "{$select} {$this->_from} {$this->_where}";
+    $dao = CRM_Core_DAO::executeQuery($sql);
+    $dao->fetch();
+    $statistics['counts']['goal_total'] = array(
+      'title' => ts('Goal Total'),
+      'value' => $dao->goal_total,
+      'type' => CRM_Utils_Type::T_MONEY
+    );
+    $statistics['counts']['committed_total'] = array(
+      'title' => ts('Total Committed'),
+      'value' => $dao->committed_total,
+      'type' => CRM_Utils_Type::T_MONEY
+    );
+    $statistics['counts']['received_total'] = array(
+      'title' => ts('Total Received'),
+      'value' => $dao->received_total,
+      'type' => CRM_Utils_Type::T_MONEY
+    );
+    $statistics['counts']['donors_total'] = array(
+      'title' => ts('Total Donors'),
+      'value' => $dao->donors_total,
+      'type' => CRM_Utils_Type::T_INT
+    );
+    return $statistics;
+  }
   function alterDisplay(&$rows) {
     // custom code to alter rows
     $entryFound = FALSE;
index 5d44ec245bd122d5f508780e654612b299a7be0b..8dca9bb29b660077603a00561d0779fc06f1b5f3 100644 (file)
@@ -703,7 +703,7 @@ GROUP BY    currency
 ";
     $dao = CRM_Core_DAO::executeQuery($sql);
 
-    $amount = $average = $amount = $average = array();
+    $amount = $average = $amount2 = $average2 = array();
     $count = $count2 = 0;
     while ($dao->fetch()) {
       if ($dao->amount) {
diff --git a/CRM/Upgrade/4.4.3.msg_template/civicrm_msg_template.tpl b/CRM/Upgrade/4.4.3.msg_template/civicrm_msg_template.tpl
new file mode 100644 (file)
index 0000000..521836c
--- /dev/null
@@ -0,0 +1,16 @@
+{php}
+  $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.4.3.msg_template/message_templates';
+  $templates = array();
+  foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) {
+    $parts = explode('_', basename($filename, '.tpl'));
+    $templates[] = array('type' => array_pop($parts), 'name' => implode('_', $parts), 'filename' => "$dir/$filename");
+  }
+  $this->assign('templates', $templates);
+{/php}
+
+{foreach from=$templates item=tpl}
+  {fetch assign=content file=$tpl.filename}
+  SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = '{$tpl.name}';
+  SELECT @content := msg_{$tpl.type} FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
+  UPDATE civicrm_msg_template SET msg_{$tpl.type} = '{$content|escape:"quotes"}' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_{$tpl.type} = @content));
+{/foreach}
diff --git a/CRM/Upgrade/4.4.3.msg_template/message_templates/event_online_receipt_html.tpl b/CRM/Upgrade/4.4.3.msg_template/message_templates/event_online_receipt_html.tpl
new file mode 100644 (file)
index 0000000..22098fc
--- /dev/null
@@ -0,0 +1,453 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title></title>
+</head>
+<body>
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+<center>
+ <table width="500" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">
+
+  <!-- BEGIN HEADER -->
+  <!-- You can add table row(s) here with logo or other header elements -->
+  <!-- END HEADER -->
+
+  <!-- BEGIN CONTENT -->
+
+  <tr>
+   <td>
+  <p>Dear {contact.display_name},</p>
+
+    {if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
+     <p>{$event.confirm_email_text|htmlize}</p>
+
+    {else}
+  <p>Thank you for your participation.  This letter is a confirmation that your registration has been received and your status has been updated to <strong>{if $participant_status}{$participant_status}{else}{if $isOnWaitlist}waitlisted{else}registered{/if}{/if}</strong> for the following:</p>
+
+    {/if}
+
+    <p>
+    {if $isOnWaitlist}
+     <p>{ts}You have been added to the WAIT LIST for this event.{/ts}</p>
+     {if $isPrimary}
+       <p>{ts}If space becomes available you will receive an email with
+a link to a web page where you can complete your registration.{/ts}</p>
+     {/if}
+    {elseif $isRequireApproval}
+     <p>{ts}Your registration has been submitted.{/ts}</p>
+     {if $isPrimary}
+      <p>{ts}Once your registration has been reviewed, you will receive
+an email with a link to a web page where you can complete the
+registration process.{/ts}</p>
+     {/if}
+    {elseif $is_pay_later && !$isAmountzero && !$isAdditionalParticipant}
+     <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
+    {else}
+     <p>{ts}Please print this confirmation for your records.{/ts}</p>
+    {/if}
+
+   </td>
+  </tr>
+  <tr>
+   <td>
+    <table width="500" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">
+     <tr>
+      <th {$headerStyle}>
+       {ts}Event Information and Location{/ts}
+      </th>
+     </tr>
+     <tr>
+      <td colspan="2" {$valueStyle}>
+       {$event.event_title}<br />
+       {$event.event_start_date|date_format:"%A"} {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|date_format:"%A"} {$event.event_end_date|crmDate}{/if}{/if}
+      </td>
+     </tr>
+
+
+     {if $conference_sessions}
+      <tr>
+       <td colspan="2" {$labelStyle}>
+  {ts}Your schedule:{/ts}
+       </td>
+      </tr>
+      <tr>
+       <td colspan="2" {$valueStyle}>
+  {assign var='group_by_day' value='NA'}
+  {foreach from=$conference_sessions item=session}
+   {if $session.start_date|date_format:"%Y/%m/%d" != $group_by_day|date_format:"%Y/%m/%d"}
+    {assign var='group_by_day' value=$session.start_date}
+          <em>{$group_by_day|date_format:"%m/%d/%Y"}</em><br />
+   {/if}
+   {$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}<br />
+   {if $session.location}&nbsp;&nbsp;&nbsp;&nbsp;{$session.location}<br />{/if}
+  {/foreach}
+       </td>
+      </tr>
+     {/if}
+
+     {if $event.participant_role neq 'Attendee' and $defaultRole}
+      <tr>
+       <td {$labelStyle}>
+        {ts}Participant Role{/ts}
+       </td>
+       <td {$valueStyle}>
+        {$event.participant_role}
+       </td>
+      </tr>
+     {/if}
+
+     {if $isShowLocation}
+      <tr>
+       <td colspan="2" {$valueStyle}>
+        {if $location.address.1.name}
+         {$location.address.1.name}<br />
+        {/if}
+        {if $location.address.1.street_address}
+         {$location.address.1.street_address}<br />
+        {/if}
+        {if $location.address.1.supplemental_address_1}
+         {$location.address.1.supplemental_address_1}<br />
+        {/if}
+        {if $location.address.1.supplemental_address_2}
+         {$location.address.1.supplemental_address_2}<br />
+        {/if}
+        {if $location.address.1.city}
+         {$location.address.1.city}, {$location.address.1.state_province} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}<br />
+        {/if}
+       </td>
+      </tr>
+     {/if}
+
+     {if $location.phone.1.phone || $location.email.1.email}
+      <tr>
+       <td colspan="2" {$labelStyle}>
+        {ts}Event Contacts:{/ts}
+       </td>
+      </tr>
+      {foreach from=$location.phone item=phone}
+       {if $phone.phone}
+        <tr>
+         <td {$labelStyle}>
+          {if $phone.phone_type}
+           {$phone.phone_type_display}
+          {else}
+           {ts}Phone{/ts}
+          {/if}
+         </td>
+         <td {$valueStyle}>
+          {$phone.phone} {if $phone.phone_ext}&nbsp;{ts}ext.{/ts} {$phone.phone_ext}{/if}
+         </td>
+        </tr>
+       {/if}
+      {/foreach}
+      {foreach from=$location.email item=eventEmail}
+       {if $eventEmail.email}
+        <tr>
+         <td {$labelStyle}>
+          {ts}Email{/ts}
+         </td>
+         <td {$valueStyle}>
+          {$eventEmail.email}
+         </td>
+        </tr>
+       {/if}
+      {/foreach}
+     {/if}
+     <tr>
+      <td colspan="2" {$valueStyle}>
+       {capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture}
+       <a href="{$icalFeed}">{ts}Download iCalendar File{/ts}</a>
+      </td>
+     </tr>
+    {if $event.is_share}
+        <tr>
+            <td colspan="2" {$valueStyle}>
+                {capture assign=eventUrl}{crmURL p='civicrm/event/info' q="id=`$event.id`&reset=1" a=true fe=1 h=1}{/capture}
+                {include file="CRM/common/SocialNetwork.tpl" emailMode=true url=$eventUrl title=$event.title pageURL=$eventUrl}
+            </td>
+        </tr>
+    {/if}
+    {if $payer.name}
+     <tr>
+       <th {$headerStyle}>
+         {ts}You were registered by:{/ts}
+       </th>
+     </tr>
+     <tr>
+       <td colspan="2" {$valueStyle}>
+        {$payer.name}
+       </td>
+     </tr>
+    {/if}
+    {if $event.is_monetary}
+
+      <tr>
+       <th {$headerStyle}>
+        {$event.fee_label}
+       </th>
+      </tr>
+
+      {if $lineItem}
+       {foreach from=$lineItem item=value key=priceset}
+        {if $value neq 'skip'}
+         {if $isPrimary}
+          {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
+           <tr>
+            <td colspan="2" {$labelStyle}>
+             {ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info}
+            </td>
+           </tr>
+          {/if}
+         {/if}
+         <tr>
+          <td colspan="2" {$valueStyle}>
+           <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+            <tr>
+             <th>{ts}Item{/ts}</th>
+             <th>{ts}Qty{/ts}</th>
+             <th>{ts}Each{/ts}</th>
+             <th>{ts}Total{/ts}</th>
+       {if  $pricesetFieldsCount }<th>{ts}Total Participants{/ts}</th>{/if}
+            </tr>
+            {foreach from=$value item=line}
+             <tr>
+              <td>
+              {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
+              </td>
+              <td>
+               {$line.qty}
+              </td>
+              <td>
+               {$line.unit_price|crmMoney:$currency}
+              </td>
+              <td>
+               {$line.line_total|crmMoney:$currency}
+              </td>
+        {if $pricesetFieldsCount }<td>{$line.participant_count}</td> {/if}
+             </tr>
+            {/foreach}
+           </table>
+          </td>
+         </tr>
+        {/if}
+       {/foreach}
+      {/if}
+
+      {if $amounts && !$lineItem}
+       {foreach from=$amounts item=amnt key=level}
+        <tr>
+         <td colspan="2" {$valueStyle}>
+          {$amnt.amount|crmMoney:$currency} {$amnt.label}
+         </td>
+        </tr>
+       {/foreach}
+      {/if}
+
+      {if $isPrimary}
+       <tr>
+        <td {$labelStyle}>
+         {ts}Total Amount{/ts}
+        </td>
+        <td {$valueStyle}>
+         {$totalAmount|crmMoney:$currency} {if $hookDiscount.message}({$hookDiscount.message}){/if}
+        </td>
+       </tr>
+       {if $pricesetFieldsCount }
+     <tr>
+       <td {$labelStyle}>
+      {ts}Total Participants{/ts}</td>
+      <td {$valueStyle}>
+      {assign var="count" value= 0}
+      {foreach from=$lineItem item=pcount}
+      {assign var="lineItemCount" value=0}
+      {if $pcount neq 'skip'}
+        {foreach from=$pcount item=p_count}
+        {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
+        {/foreach}
+      {if $lineItemCount < 1 }
+        {assign var="lineItemCount" value=1}
+      {/if}
+      {assign var="count" value=$count+$lineItemCount}
+      {/if}
+      {/foreach}
+     {$count}
+     </td> </tr>
+      {/if}
+
+       {if $register_date}
+        <tr>
+         <td {$labelStyle}>
+          {ts}Registration Date{/ts}
+         </td>
+         <td {$valueStyle}>
+          {$register_date|crmDate}
+         </td>
+        </tr>
+       {/if}
+
+       {if $receive_date}
+        <tr>
+         <td {$labelStyle}>
+          {ts}Transaction Date{/ts}
+         </td>
+         <td {$valueStyle}>
+          {$receive_date|crmDate}
+         </td>
+        </tr>
+       {/if}
+
+       {if $contributionTypeName}
+        <tr>
+         <td {$labelStyle}>
+          {ts}Financial Type{/ts}
+         </td>
+         <td {$valueStyle}>
+          {$contributionTypeName}
+         </td>
+        </tr>
+       {/if}
+
+       {if $trxn_id}
+        <tr>
+         <td {$labelStyle}>
+          {ts}Transaction #{/ts}
+         </td>
+         <td {$valueStyle}>
+          {$trxn_id}
+         </td>
+        </tr>
+       {/if}
+
+       {if $paidBy}
+        <tr>
+         <td {$labelStyle}>
+          {ts}Paid By{/ts}
+         </td>
+         <td {$valueStyle}>
+         {$paidBy}
+         </td>
+        </tr>
+       {/if}
+
+       {if $checkNumber}
+        <tr>
+         <td {$labelStyle}>
+          {ts}Check Number{/ts}
+         </td>
+         <td {$valueStyle}>
+          {$checkNumber}
+         </td>
+        </tr>
+       {/if}
+
+       {if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+        <tr>
+         <th {$headerStyle}>
+          {ts}Billing Name and Address{/ts}
+         </th>
+        </tr>
+        <tr>
+         <td colspan="2" {$valueStyle}>
+          {$billingName}<br />
+          {$address|nl2br}
+         </td>
+        </tr>
+       {/if}
+
+       {if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+        <tr>
+         <th {$headerStyle}>
+          {ts}Credit Card Information{/ts}
+         </th>
+        </tr>
+        <tr>
+         <td colspan="2" {$valueStyle}>
+          {$credit_card_type}<br />
+          {$credit_card_number}<br />
+          {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+         </td>
+        </tr>
+       {/if}
+
+      {/if}
+
+     {/if} {* End of conditional section for Paid events *}
+
+
+{if $customPre}
+{foreach from=$customPre item=customPr key=i}
+   <tr> <th {$headerStyle}>{$customPre_grouptitle.$i}</th></tr>
+   {foreach from=$customPr item=customValue key=customName}
+   {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+     <tr>
+         <td {$labelStyle}>{$customName}</td>
+         <td {$valueStyle}>{$customValue}</td>
+     </tr>
+   {/if}
+   {/foreach}
+{/foreach}
+{/if}
+
+{if $customPost}
+{foreach from=$customPost item=customPos key=j}
+   <tr> <th {$headerStyle}>{$customPost_grouptitle.$j}</th></tr>
+   {foreach from=$customPos item=customValue key=customName}
+   {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+     <tr>
+         <td {$labelStyle}>{$customName}</td>
+         <td {$valueStyle}>{$customValue}</td>
+     </tr>
+{/if}
+{/foreach}
+{/foreach}
+{/if}
+
+{if $customProfile}
+{foreach from=$customProfile.profile item=eachParticipant key=participantID}
+     <tr><th {$headerStyle}>{ts 1=$participantID+2}Participant %1{/ts} </th></tr>
+     {foreach from=$eachParticipant item=eachProfile key=pid}
+     <tr><th {$headerStyle}>{$customProfile.title.$pid}</th></tr>
+     {foreach from=$eachProfile item=val key=field}
+     <tr>{foreach from=$val item=v key=f}
+         <td {$labelStyle}>{$field}</td>
+         <td {$valueStyle}>{$v}</td>
+         {/foreach}
+     </tr>
+     {/foreach}
+{/foreach}
+{/foreach}
+{/if}
+
+    {if $customGroup}
+      {foreach from=$customGroup item=value key=customName}
+       <tr>
+        <th {$headerStyle}>
+         {$customName}
+        </th>
+       </tr>
+       {foreach from=$value item=v key=n}
+        <tr>
+         <td {$labelStyle}>
+          {$n}
+         </td>
+         <td {$valueStyle}>
+          {$v}
+         </td>
+        </tr>
+       {/foreach}
+      {/foreach}
+     {/if}
+
+    </table>
+   </td>
+  </tr>
+ </table>
+</center>
+
+</body>
+</html>
diff --git a/CRM/Upgrade/4.4.3.msg_template/message_templates/event_online_receipt_text.tpl b/CRM/Upgrade/4.4.3.msg_template/message_templates/event_online_receipt_text.tpl
new file mode 100644 (file)
index 0000000..e373d2b
--- /dev/null
@@ -0,0 +1,280 @@
+Dear {contact.display_name},
+
+{if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
+{$event.confirm_email_text}
+
+{else}
+Thank you for your participation.  This letter is a confirmation that your registration has been received and your status has been updated to {if $participant_status}{$participant_status}{else}{if $isOnWaitlist}waitlisted{else}registered{/if}{/if} for the following:
+
+{/if}
+
+{if $isOnWaitlist}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}You have been added to the WAIT LIST for this event.{/ts}
+
+{if $isPrimary}
+{ts}If space becomes available you will receive an email with
+a link to a web page where you can complete your registration.{/ts}
+{/if}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{elseif $isRequireApproval}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Your registration has been submitted.{/ts}
+
+{if $isPrimary}
+{ts}Once your registration has been reviewed, you will receive
+an email with a link to a web page where you can complete the
+registration process.{/ts}
+
+{/if}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{elseif $is_pay_later && !$isAmountzero && !$isAdditionalParticipant}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$pay_later_receipt}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{else}
+
+{ts}Please print this confirmation for your records.{/ts}
+{/if}
+
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Event Information and Location{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$event.event_title}
+{$event.event_start_date|date_format:"%A"} {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|date_format:"%A"} {$event.event_end_date|crmDate}{/if}{/if}
+{if $conference_sessions}
+
+
+{ts}Your schedule:{/ts}
+{assign var='group_by_day' value='NA'}
+{foreach from=$conference_sessions item=session}
+{if $session.start_date|date_format:"%Y/%m/%d" != $group_by_day|date_format:"%Y/%m/%d"}
+{assign var='group_by_day' value=$session.start_date}
+
+{$group_by_day|date_format:"%m/%d/%Y"}
+
+
+{/if}
+{$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}
+{if $session.location}    {$session.location}{/if}
+{/foreach}
+{/if}
+
+{if $event.participant_role neq 'Attendee' and $defaultRole}
+{ts}Participant Role{/ts}: {$event.participant_role}
+{/if}
+
+{if $isShowLocation}
+{if $location.address.1.name}
+
+{$location.address.1.name}
+{/if}
+{if $location.address.1.street_address}{$location.address.1.street_address}
+{/if}
+{if $location.address.1.supplemental_address_1}{$location.address.1.supplemental_address_1}
+{/if}
+{if $location.address.1.supplemental_address_2}{$location.address.1.supplemental_address_2}
+{/if}
+{if $location.address.1.city}{$location.address.1.city}, {$location.address.1.state_province} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}
+{/if}
+
+{/if}{*End of isShowLocation condition*}
+
+{if $location.phone.1.phone || $location.email.1.email}
+
+{ts}Event Contacts:{/ts}
+{foreach from=$location.phone item=phone}
+{if $phone.phone}
+
+{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if}
+{/foreach}
+{foreach from=$location.email item=eventEmail}
+{if $eventEmail.email}
+
+{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach}
+{/if}
+
+{capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture}
+{ts}Download iCalendar File:{/ts} {$icalFeed}
+
+{if $payer.name}
+You were registered by: {$payer.name}
+{/if}
+{if $event.is_monetary} {* This section for Paid events only.*}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$event.fee_label}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{if $lineItem}{foreach from=$lineItem item=value key=priceset}
+
+{if $value neq 'skip'}
+{if $isPrimary}
+{if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
+{ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info}
+
+{/if}
+{/if}
+-----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{capture assign=ts_item}{ts}Item{/ts}{/capture}
+{capture assign=ts_qty}{ts}Qty{/ts}{/capture}
+{capture assign=ts_each}{ts}Each{/ts}{/capture}
+{capture assign=ts_total}{ts}Total{/ts}{/capture}
+{if $pricesetFieldsCount }{capture assign=ts_participant_total}{ts}Total Participants{/ts}{/capture}{/if}
+{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
+-----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{foreach from=$value item=line}
+{if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture}{/if}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {$line.line_total|crmMoney:$currency|string_format:"%10s"}{$ts_participant_count|string_format:"%10s"}
+{/foreach}
+{/if}
+{/foreach}
+{/if}
+{if $amounts && !$lineItem}
+{foreach from=$amounts item=amnt key=level}{$amnt.amount|crmMoney:$currency} {$amnt.label}
+{/foreach}
+{/if}
+{if $isPrimary }
+
+{ts}Total Amount{/ts}: {$totalAmount|crmMoney:$currency} {if $hookDiscount.message}({$hookDiscount.message}){/if}
+
+{if $pricesetFieldsCount }
+      {assign var="count" value= 0}
+      {foreach from=$lineItem item=pcount}
+      {assign var="lineItemCount" value=0}
+      {if $pcount neq 'skip'}
+        {foreach from=$pcount item=p_count}
+        {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
+        {/foreach}
+      {if $lineItemCount < 1 }
+        {assign var="lineItemCount" value=1}
+      {/if}
+      {assign var="count" value=$count+$lineItemCount}
+      {/if}
+      {/foreach}
+
+{ts}Total Participants{/ts}: {$count}
+{/if}
+
+{if $register_date}
+{ts}Registration Date{/ts}: {$register_date|crmDate}
+{/if}
+{if $receive_date}
+{ts}Transaction Date{/ts}: {$receive_date|crmDate}
+{/if}
+{if $contributionTypeName}
+{ts}Financial Type{/ts}: {$contributionTypeName}
+{/if}
+{if $trxn_id}
+{ts}Transaction #{/ts}: {$trxn_id}
+{/if}
+{if $paidBy}
+{ts}Paid By{/ts}: {$paidBy}
+{/if}
+{if $checkNumber}
+{ts}Check Number{/ts}: {$checkNumber}
+{/if}
+{if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Billing Name and Address{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$billingName}
+{$address}
+{/if}
+
+{if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Credit Card Information{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+{/if}
+{/if}
+{/if} {* End of conditional section for Paid events *}
+
+{if $customPre}
+{foreach from=$customPre item=customPr key=i}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$customPre_grouptitle.$i}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$customPr item=customValue key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ {$customName}: {$customValue}
+{/if}
+{/foreach}
+{/foreach}
+{/if}
+
+{if $customPost}
+{foreach from=$customPost item=customPos key=j}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$customPost_grouptitle.$j}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$customPos item=customValue key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ {$customName}: {$customValue}
+{/if}
+{/foreach}
+{/foreach}
+{/if}
+{if $customProfile}
+
+{foreach from=$customProfile.profile item=eachParticipant key=participantID}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts 1=$participantID+2}Participant Information - Participant %1{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$eachParticipant item=eachProfile key=pid}
+----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{$customProfile.title.$pid}
+----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{foreach from=$eachProfile item=val key=field}
+{foreach from=$val item=v key=f}
+{$field}: {$v}
+{/foreach}
+{/foreach}
+{/foreach}
+{/foreach}
+{/if}
+{if $customGroup}
+{foreach from=$customGroup item=value key=customName}
+=========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$customName}
+=========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$value item=v key=n}
+{$n}: {$v}
+{/foreach}
+{/foreach}
+{/if}
index fe8ec704a82b10f85a6d904bb833c1114abb2c3a..f571143699ff6f642e57b28183ffa64e3108632e 100644 (file)
@@ -65,6 +65,9 @@ class CRM_Upgrade_Incremental_php_FourFour {
         $postUpgradeMessage .= '<br />' . ts("The setting to skip IDS check has been removed. Your site has this configured in civicrm.settings.php but it will no longer work. Instead, use the new permission 'skip IDS check' to bypass the IDS system.");
       }
     }
+    if ($rev == '4.4.3') {
+      $postUpgradeMessage .= '<br />' . ts('Default versions of the following System Workflow Message Templates have been modified to handle new functionality: <ul><li>Events - Registration Confirmation and Receipt (on-line)</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).');
+    }
   }
 
   function upgrade_4_4_alpha1($rev) {
index bbc88ab3d9c591b9aa222c1a3d2ca1e4c09617a9..3c4571aa1e4cda4409342eb084a72fbfe43fbee8 100644 (file)
@@ -477,14 +477,16 @@ AND    financial_account_type_id = {$accountType}
 ";
     $financialAccountId = CRM_Core_DAO::singleValueQuery($query);
 
-    $accountRelationsips = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
+    $accountRelationsips = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount',
+      'account_relationship', CRM_Core_DAO::$_nullArray, 'validate');
 
     $accountsReceivableAccount = array_search('Accounts Receivable Account is', $accountRelationsips);
     $incomeAccountIs = array_search('Income Account is', $accountRelationsips);
     $assetAccountIs = array_search('Asset Account is', $accountRelationsips);
     $expenseAccountIs = array_search('Expense Account is', $accountRelationsips);
 
-    $financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
+    $financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id',
+      CRM_Core_DAO::$_nullArray, 'validate');
     $unpaidStatus = array_search('Unpaid', $financialItemStatus);
     $paidStatus = array_search('Paid', $financialItemStatus);
 
index 20464bc5087d68ec77a8d0c1fcde4fd61968ca63..626b50290e9e083b8ce6fac77dd9c1348248dc0e 100644 (file)
@@ -30,7 +30,7 @@ WHERE cog.name IN ('grant_program_status', 'allocation_algorithm');
 -- CRM-12470
 UPDATE civicrm_financial_account
 SET is_default = 1
-WHERE name IN ('{ts escape="sql"}Premiums{/ts}', '{ts escape="sql"}Banking Fees{/ts}', '{ts escape="sql"}Accounts Payable{/ts}', '{ts escape="sql"}Donation{/ts}');
+WHERE name IN ('Premiums', 'Banking Fees', 'Accounts Payable', 'Donation');
 
 SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship';
 SELECT @option_group_id_fat := max(id) from civicrm_option_group where name = 'financial_account_type';
index fbec9a837e83daeb09e040070fed426274e25dfb..a547a77f08a3c4cb311af8f7d86093284c1db3a1 100644 (file)
@@ -543,14 +543,14 @@ ALTER TABLE civicrm_financial_type DROP accounting_code;
 INSERT INTO
    `civicrm_financial_account` (`name`, `contact_id`, `financial_account_type_id`, `description`, `accounting_code`, `account_type_code`, `is_reserved`, `is_active`, `is_deductible`, `is_default`)
 VALUES
-  ('{ts escape="sql"}Banking Fees{/ts}'         , @domainContactId, @opexp, 'Payment processor fees and manually recorded banking fees', '5200', 'EXP', 0, 1, 0, 0),
-  ('{ts escape="sql"}Deposit Bank Account{/ts}' , @domainContactId, @opAsset, 'All manually recorded cash and cheques go to this account', '1100', 'BANK', 0, 1, 0, 1),
-  ('{ts escape="sql"}Accounts Receivable{/ts}'  , @domainContactId, @opAsset, 'Amounts to be received later (eg pay later event revenues)', '1200', 'AR', 0, 1, 0, 0),
-  ('{ts escape="sql"}Accounts Payable{/ts}'     , @domainContactId, @opLiability, 'Amounts to be paid out such as grants and refunds', '2200', 'AP', 0, 1, 0, 0),
-  ('{ts escape="sql"}Premiums{/ts}'             , @domainContactId, @opCost, 'Account to record cost of premiums provided to payors', '5100', 'COGS', 0, 1, 0, 0),
-  ('{ts escape="sql"}Premiums Inventory{/ts}'   , @domainContactId, @opAsset, 'Account representing value of premiums inventory', '1375', 'OCASSET', 0, 1, 0, 0),
-  ('{ts escape="sql"}Discounts{/ts}'            , @domainContactId, @opval, 'Contra-revenue account for amounts discounted from sales', '4900', 'INC', 0, 1, 0, 0),
-  ('{ts escape="sql"}Payment Processor Account{/ts}', @domainContactId, @opAsset, 'Account to record payments into a payment processor merchant account', '1150', 'BANK', 0, 1, 0, 0);
+  ('Banking Fees'         , @domainContactId, @opexp, 'Payment processor fees and manually recorded banking fees', '5200', 'EXP', 0, 1, 0, 0),
+  ('Deposit Bank Account' , @domainContactId, @opAsset, 'All manually recorded cash and cheques go to this account', '1100', 'BANK', 0, 1, 0, 1),
+  ('Accounts Receivable'  , @domainContactId, @opAsset, 'Amounts to be received later (eg pay later event revenues)', '1200', 'AR', 0, 1, 0, 0),
+  ('Accounts Payable'     , @domainContactId, @opLiability, 'Amounts to be paid out such as grants and refunds', '2200', 'AP', 0, 1, 0, 0),
+  ('Premiums'             , @domainContactId, @opCost, 'Account to record cost of premiums provided to payors', '5100', 'COGS', 0, 1, 0, 0),
+  ('Premiums Inventory'   , @domainContactId, @opAsset, 'Account representing value of premiums inventory', '1375', 'OCASSET', 0, 1, 0, 0),
+  ('Discounts'            , @domainContactId, @opval, 'Contra-revenue account for amounts discounted from sales', '4900', 'INC', 0, 1, 0, 0),
+  ('Payment Processor Account', @domainContactId, @opAsset, 'Account to record payments into a payment processor merchant account', '1150', 'BANK', 0, 1, 0, 0);
 
 -- CRM-10926
 SELECT @option_value_rel_id_exp  := value FROM `civicrm_option_value` WHERE `option_group_id` = @option_group_id_arel AND `name` = 'Expense Account is';
index 3e398b27f606ed1b1fa9437a17500c42615aa9f1..93ff07e8b3161038d393682d41b21481143cffb8 100644 (file)
@@ -1 +1,8 @@
 {* file to handle db changes in 4.4.3 during upgrade *}
+{include file='../CRM/Upgrade/4.4.3.msg_template/civicrm_msg_template.tpl'}
+
+-- CRM-13420
+UPDATE civicrm_option_value
+INNER JOIN civicrm_option_group ON civicrm_option_value.option_group_id = civicrm_option_group.id
+SET civicrm_option_value.is_default  = 1
+WHERE civicrm_option_group.name = 'payment_instrument' AND civicrm_option_value.name = 'Check';
\ No newline at end of file
index e9acb7df1a1e9e58a8b0969715213585f344cb13..304b9bb8bd21d17daa4262f0e60faceac01cfffe 100644 (file)
@@ -29,7 +29,12 @@ abstract class CRM_Utils_System_Base {
 
     // TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
     // but the parts should be copied into cleaner subclass implementations
-    if (function_exists('theme') && !$print) {
+    $config = CRM_Core_Config::singleton();
+    if (
+      $config->userSystem->is_drupal &&
+      function_exists('theme') &&
+      !$print
+    ) {
       if ($maintenance) {
         drupal_set_breadcrumb('');
         drupal_maintenance_theme();
@@ -44,7 +49,8 @@ abstract class CRM_Utils_System_Base {
     $out = $content;
 
     $config = &CRM_Core_Config::singleton();
-    if (!$print &&
+    if (
+      !$print &&
       $config->userFramework == 'WordPress'
     ) {
       if (is_admin()) {
@@ -175,11 +181,41 @@ abstract class CRM_Utils_System_Base {
     }
   }
 
+
   /**
    * Get timezone from CMS
    * @return boolean|string
    */
+  /**
+   * Get timezone from Drupal
+   * @return boolean|string
+   */
   function getTimeZoneOffset(){
+    $timezone = $this->getTimeZoneString();
+    if($timezone){
+      $tzObj = new DateTimeZone($timezone);
+      $dateTime = new DateTime("now", $tzObj);
+      $tz = $tzObj->getOffset($dateTime);
+
+      if(empty($tz)){
+        return false;
+      }
+
+      $timeZoneOffset = sprintf("%02d:%02d", $tz / 3600, ($tz/60)%60 );
+
+      if($timeZoneOffset > 0){
+        $timeZoneOffset = '+' . $timeZoneOffset;
+      }
+      return $timeZoneOffset;
+    }
+  }
+
+  /**
+   * Over-ridable function to get timezone as a string eg.
+   * @return string Timezone e.g. 'America/Los_Angeles'
+   */
+  function getTimeZoneString() {
+    return NULL;
   }
 }
 
index 42649a736d038fa008e3e9fdc450a767d871cea2..389c2c06927d8f84687b5367bc196fddf1ec3e9f 100644 (file)
@@ -433,6 +433,11 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
     }
 
     require_once ($cmsRootPath . DIRECTORY_SEPARATOR . 'wp-load.php');
+    $wpUserTimezone = get_option('timezone_string');
+    if ($wpUserTimezone) {
+      date_default_timezone_set($wpUserTimezone);
+      CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
+    }
     return true;
   }
 
@@ -622,5 +627,13 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
       return 'Unknown';
     }
   }
+
+  /**
+   * get timezone as a string
+   * @return string Timezone e.g. 'America/Los_Angeles'
+   */
+  function getTimeZoneString() {
+    return get_option('timezone_string');
+  }
 }
 
index 1e32f917d1602ad4e7edbf492fdc13b7b544c55d..d910f68ae41c9872eaa3aab5b0c53a81bf2f4138 100644 (file)
@@ -60,6 +60,16 @@ function civicrm_api3_action_schedule_get($params) {
  * {@getfields action_schedule_create}
  */
 function civicrm_api3_action_schedule_create($params) {
+  if (!CRM_Utils_Array::value('id', $params)) {
+    // an update does not require any mandatory parameters
+    civicrm_api3_verify_one_mandatory($params,
+      NULL,
+      array(
+        'title','mapping_id', 'entity_status', 'entity_value',
+      )
+    );
+  }
+  
   $ids = array();
   if (isset($params['id']) && !CRM_Utils_Rule::integer($params['id'])) {
     return civicrm_api3_create_error('Invalid value for ID');
@@ -103,4 +113,6 @@ function _civicrm_api3_action_schedule_create_spec(&$params) {
  */
 function civicrm_api3_action_schedule_delete($params) {
   return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
-}
\ No newline at end of file
+}
+
+
index 423190976a1b184b3d039436e060b4cd232e0840..7c4bd8f9a86633595ea1a2535ed1f8c0c6ab2605 100644 (file)
@@ -650,7 +650,8 @@ function civicrm_api3_contact_getquick($params) {
   }
 
   if (CRM_Utils_Array::value('contact_sub_type', $params)) {
-    $where .= " AND cc.contact_sub_type = \"{$params['contact_sub_type']}\" ";
+    $contactSubType = CRM_Utils_Type::escape($params['contact_sub_type'], 'String');
+    $where .= " AND cc.contact_sub_type = '{$contactSubType}'";
   }
 
   //set default for current_employer or return contact with particular id
index 196512eaf80697444ed1d25ecd826b853d59146d..a96d60686d2f577d3a8da3114e7bf4905136682a 100644 (file)
@@ -46,7 +46,7 @@ function contribution_create_expectedresult(){
           'contact_id' => '1',
           'financial_type_id' => '1',
           'contribution_page_id' => '1',
-          'payment_instrument_id' => '',
+          'payment_instrument_id' => '4',
           'receive_date' => '20120511000000',
           'non_deductible_amount' => '',
           'total_amount' => '100',
index dea9755a4b496d292d8ed95c1a2773f10b9cfb29..59ba512613afc10d225161669b8c59d1a273b746 100644 (file)
@@ -1005,6 +1005,16 @@ function _civicrm_api3_basic_create($bao_name, &$params, $entity = NULL) {
   if (is_null($bao)) {
     return civicrm_api3_create_error('Entity not created (' . $fct_name . ')');
   }
+  elseif (is_a($bao, 'CRM_Core_Error')) {
+    //some wierd circular thing means the error takes itself as an argument
+    $msg = $bao->getMessages($bao);
+    // the api deals with entities on a one-by-one basis. However, the contribution bao pushes entities
+    // onto the error object - presumably because the contribution import is not handling multiple errors correctly
+    // so we need to reset the error object here to avoid getting concatenated errors
+    //@todo - the mulitple error handling should be moved out of the contribution object to the import / multiple entity processes
+    CRM_Core_Error::singleton()->reset();
+    throw new API_Exception($msg);
+  }
   else {
     $values = array();
     _civicrm_api3_object_to_array($bao, $values[$bao->id]);
index e6bf92efeada4eea81bcbac92719f5ac068a2d79..93d6d7d0eb46dfed292158ae16accbcf60af2bb8 100644 (file)
@@ -1086,6 +1086,12 @@ class Installer extends InstallRequirements {
     if (!$this->errors) {
       global $installType, $installURLPath;
 
+      $registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
+      $commonOutputMessage = "
+                      <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='$registerSiteURL' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume  mailing list).</li>
+                      <li>We have integrated KCFinder with CKEditor and TinyMCE. This allows a user to upload images. All uploaded images are public.</li>
+";
+
       $output = NULL;
       if (
         $installType == 'drupal' &&
@@ -1111,12 +1117,10 @@ class Installer extends InstallRequirements {
         $drupalURL = civicrm_cms_base();
         $drupalPermissionsURL = "{$drupalURL}index.php?q=admin/people/permissions";
         $drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1";
-        $registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
 
         $output .= "<li>Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you <a target='_blank' href={$drupalPermissionsURL}>review these permissions</a> to ensure that they are appropriate for your requirements (<a target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'>learn more...</a>)</li>
                       <li>Use the <a target='_blank' href=\"$drupalURL\">Configuration Checklist</a> to review and configure settings for your new site</li>
-                      <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='$registerSiteURL' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume  mailing list).</li>
-                      <li>We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.</li>";
+                      {$commonOutputMessage}";
 
         // automatically enable CiviCRM module once it is installed successfully.
         // so we need to Bootstrap Drupal, so that we can call drupal hooks.
@@ -1182,12 +1186,10 @@ class Installer extends InstallRequirements {
         $drupalURL = civicrm_cms_base();
         $drupalPermissionsURL = "{$drupalURL}index.php?q=admin/user/permissions";
         $drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1";
-        $registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
 
         $output .= "<li>Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you <a target='_blank' href={$drupalPermissionsURL}>review these permissions</a> to ensure that they are appropriate for your requirements (<a target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'>learn more...</a>)</li>
                       <li>Use the <a target='_blank' href=\"$drupalURL\">Configuration Checklist</a> to review and configure settings for your new site</li>
-                      <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='$registerSiteURL' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume  mailing list).</li>
-                      <li>We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.</li>";
+                      {$commonOutputMessage}";
 
         // explicitly setting error reporting, since we cannot handle drupal related notices
         error_reporting(1);
@@ -1227,15 +1229,18 @@ class Installer extends InstallRequirements {
 
         $cmsURL = civicrm_cms_base();
         $cmsURL .= "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/configtask&reset=1";
-        $registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
-
-        echo "<li>Use the <a target='_blank' href=\"$cmsURL\">Configuration Checklist</a> to review and configure settings for your new site</li>
-                    <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='$registerSiteURL' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume  mailing list).</li>
-                    <li>We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.</li>";
-        echo '</ul>';
-        echo '</div>';
-      }
-    }
+        $wpPermissionsURL = "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/access/wp-permissions&reset=1";
+
+        $output .= "
+           <li>WordPress user permissions have been automatically set - giving Anonymous and Subscribers access to public CiviCRM forms and features. We recommend that you <a target='_blank' href={$wpPermissionsURL}>review these permissions</a> to ensure that they are appropriate for your requirements (<a target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'>learn more...</a>)</li>
+           <li>Use the <a target='_blank' href=\"$cmsURL\">Configuration Checklist</a> to review and configure settings for your new site</li>
+          {$commonOutputMessage}
+";
+
+         echo '</ul>';
+         echo '</div>';
+       }
+     }
 
     return $this->errors;
   }
index 4f1cfc6192a4f3eabb1aa994e756cbe36fcd6818..596f99683689fd411a468e19cb6a5d67d28a5863 100644 (file)
@@ -516,6 +516,28 @@ When enabled, statistics about your CiviCRM installation are reported anonymousl
     'description' => null,
     'help_text' => null,
   ),
+  'blogUrl' => array(
+    'group_name' => 'CiviCRM Preferences',
+    'group' => 'core',
+    'name' => 'blogUrl',
+    'prefetch' => 0,
+    'config_only'=> 0,
+    'type' => 'String',
+    'quick_form_type' => 'Element',
+    'html_type' => 'text',
+    'html_attributes' => array(
+      'size' => 64,
+      'maxlength' => 128,
+    ),
+    'html_type' => 'Text',
+    'default' => '*default*',
+    'add' => '4.3',
+    'title' => 'Blog Feed URL',
+    'is_domain' => 1,
+    'is_contact' => 0,
+    'description' => 'Blog feed URL used by the blog dashlet',
+    'help_text' => 'Use "*default*" for the system default or override with a custom URL',
+  ),
   'communityMessagesUrl' => array(
     'group_name' => 'CiviCRM Preferences',
     'group' => 'core',
index 5ced2fce5dc9b77be98db5a3afe26b3b3ba8daab..a19fb449b08263c1b1a60c69a788f18a479da3db 100644 (file)
 
 {literal}
 <script type='text/javascript'>
+  cj(function($) {
+    $().crmAccordions();
+  });
     var entityMapping = eval({/literal}{$entityMapping}{literal});
     var recipientMapping = eval({/literal}{$recipientMapping}{literal});
 
index 5e231515aea6f2a404ea5327732afb442a914e1c..7461727feba018531f6b4e9713fc6e5fc31a00d5 100644 (file)
           </tr>
           <tr class="crm-contribution-form-block-payment_instrument_id">
             <td class="label">{$form.payment_instrument_id.label}</td>
-            <td {$valueStyle}>{$form.payment_instrument_id.html}<br />
-              <span class="description">{ts}Leave blank for non-monetary contributions.{/ts}</span>
+            <td {$valueStyle}>{$form.payment_instrument_id.html} {help id="payment_instrument_id"}</td>
             </td>
           </tr>
           {if $showCheckNumber || !$isOnline}
index 8217994cd5b4e31e533fb09d46742e0a3a3b33fd..5f010733876ad345c602df067fcb51ee28945506 100644 (file)
 {ts}Select the appropriate financial type for this transaction.{/ts}
 {/htxt}
 
+{htxt id="payment_instrument_id-title"}
+  {ts}Payment Instrument{/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}
+  </p>
+
+{/htxt}
+
 {htxt id="id-trans_id-title"}
   {ts}Transaction ID{/ts}
 {/htxt}
index 5e0cbf408006614050057afc563070bc0779f714..bcd86c041a28901ad383aea024312b3ed4d57c0a 100644 (file)
@@ -81,7 +81,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}</td><td>{$form.payment_instrument_id.html}</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 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 686c1706f29f7ca20adb8f656add437631a6202a..e4cdec27e9985f58d2f41fb07f87fabf7cb784f0 100644 (file)
                   <td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
                 </tr>
                 <tr class="crm-membership-form-block-payment_instrument_id">
-                  <td class="label">{$form.payment_instrument_id.label}</td>
-                  <td>{$form.payment_instrument_id.html}</td>
+                  <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 id="checkNumber" class="crm-membership-form-block-check_number">
                   <td class="label">{$form.check_number.label}</td>
index ce28f4e61a4fa348e44dc3b4aa233d1ba1469d02..217fb1c763100ecb299acf7b59200b2896300b2c 100644 (file)
                   <td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
                 </tr>
                 <tr class="crm-member-membershiprenew-form-block-payment_instrument_id">
-                  <td class="label">{$form.payment_instrument_id.label}</td>
-                  <td>{$form.payment_instrument_id.html}</td>
+                  <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 id="checkNumber" class="crm-member-membershiprenew-form-block-check_number">
                   <td class="label">{$form.check_number.label}</td>
index 3a8902eed459039300336ac0f082e68af004dd31..fe9e0e723d398b304017a9ad09916feae920d181 100644 (file)
@@ -24,8 +24,9 @@
  +--------------------------------------------------------------------+
 *}
 {* CiviMember DashBoard (launch page) *}
-<h3>{ts}Membership Summary{/ts} {help id="id-member-intro"}</h3>
-<table class="report">
+{if $membershipSummary}
+  <h3>{ts}Membership Summary{/ts} {help id="id-member-intro"}</h3>
+  <table class="report">
     <tr class="columnheader-dark">
       <th scope="col" rowspan="2">{ts}Members by Type{/ts}</th>
         {if $preMonth}
     {$year} {ts 1=$month}through %1{/ts}
             {/if}
         </th>
-  <th scope="col" rowspan="2">
-            {if $isCurrent}
-                {ts}Current #{/ts}
-            {else}
-                {ts 1=$month 2=$year}Members as of %1 %2{/ts}
-            {/if}
-        </th>
+      <th scope="col" rowspan="2">
+        {if $isCurrent}
+          {ts}Current #{/ts}
+        {else}
+          {ts 1=$month 2=$year}Members as of %1 %2{/ts}
+        {/if}
+      </th>
     </tr>
 
     <tr class="columnheader-dark">
@@ -73,7 +74,7 @@
                 <a href="{$row.premonth.total.url}" title="view details">{$row.premonth.total.count}</a>
               {else}
                 {$row.premonth.total.count}
-              {/if}&nbsp;[ 
+              {/if}&nbsp;[
               {if $row.premonth_owner.premonth_owner.url}
                 <a href="{$row.premonth_owner.premonth_owner.url}" title="view details">{$row.premonth_owner.premonth_owner.count}</a>
               {else}
@@ -95,7 +96,7 @@
                 <a href="{$row.month.total.url}" title="view details">{$row.month.total.count}</a>
               {else}
                 {$row.month.total.count}
-              {/if}&nbsp;[ 
+              {/if}&nbsp;[
               {if $row.month_owner.month_owner.url}
                 <a href="{$row.month_owner.month_owner.url}" title="view details">{$row.month_owner.month_owner.count}</a>
               {else}
                 <a href="{$row.year.total.url}" title="view details">{$row.year.total.count}</a>
               {else}
                 {$row.year.total.count}
-              {/if}&nbsp;[ 
+              {/if}&nbsp;[
               {if $row.year_owner.year_owner.url}
                 <a href="{$row.year_owner.year_owner.url}" title="view details">{$row.year_owner.year_owner.count}</a>
               {else}
                 <a href="{$totalCount.premonth.total.url}" title="view details">{$totalCount.premonth.total.count}</a>
               {else}
                 {$totalCount.premonth.total.count}
-              {/if}&nbsp;[ 
+              {/if}&nbsp;[
               {if $totalCount.premonth_owner.premonth_owner.url}
                 <a href="{$totalCount.premonth_owner.premonth_owner.url}" title="view details">{$totalCount.premonth_owner.premonth_owner.count}</a>
               {else}
                 <a href="{$totalCount.month.total.url}" title="view details">{$totalCount.month.total.count}</a>
               {else}
                 {$totalCount.month.total.count}
-              {/if}&nbsp;[ 
+              {/if}&nbsp;[
               {if $totalCount.month_owner.month_owner.url}
                 <a href="{$totalCount.month_owner.month_owner.url}" title="view details">{$totalCount.month_owner.month_owner.count}</a>
               {else}
                 <a href="{$totalCount.year.total.url}" title="view details">{$totalCount.year.total.count}</a>
               {else}
                 {$totalCount.year.total.count}
-              {/if}&nbsp;[ 
+              {/if}&nbsp;[
               {if $totalCount.year_owner.year_owner.url}
                 <a href="{$totalCount.year_owner.year_owner.url}" title="view details">{$totalCount.year_owner.year_owner.count}</a>
               {else}
     <tr><td colspan='11'>
       Primary member counts (those who "own" the membership rather than receiving via relationship) are in [brackets].
     </td></tr>
-</table>
-
+  </table>
+{/if}
 <div class="spacer"></div>
 
 {if $rows}
 {* if $pager->_totalItems *}
-    <h3>{ts}Recent Memberships{/ts}</h3>
-    <div class="form-item">
-        { include file="CRM/Member/Form/Selector.tpl" context="dashboard" }
-    </div>
+  <h3>{ts}Recent Memberships{/ts}</h3>
+  <div class="form-item">
+    { include file="CRM/Member/Form/Selector.tpl" context="dashboard" }
+  </div>
 {* /if *}
 {/if}
index aef5f44f4632a1509ae77558f4c2db60e9b99c2d..b7a483349a3cfc85602882cba0e17733468bc6bf 100644 (file)
@@ -39,6 +39,7 @@ class api_v3_ActionScheduleTest extends CiviUnitTestCase {
   protected $_apiversion = 3;
 
   public $_eNoticeCompliant = TRUE;
+  
   /**
    *  Test setup for every test
    *
@@ -65,21 +66,82 @@ class api_v3_ActionScheduleTest extends CiviUnitTestCase {
   }
 
   
-  function testActionScheduleCreate() {
-       
+  function testSimpleActionScheduleCreate() {
        $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
+       $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
+       $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
+       $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
+       $scheduledStatus = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
+       $mappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value');
+       $activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', "Meeting", 'name');
+       $title = "simpleActionSchedule".substr(sha1(rand()), 0, 7);
        $params = array(
-      'title' => 'simpleAction',
-      'entity_value' => '46',
+      'title' => $title,
+         'recipient' => $assigneeID,
+         'limit_to' => 1,
+         'entity_value' => $activityTypeId,
+         'entity_status' => $scheduledStatus,
+         'is_active' => 1,
+         'record_activity' => 1,
+         'mapping_id' => $mappingId,
     );
-       
        $actionSchedule = $this->callAPISuccess('action_schedule', 'create', $params);
        $this->assertTrue(is_numeric($actionSchedule['id']), "In line " . __LINE__);
        $this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__);
        $newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
        $this->assertEquals($oldCount+1, $newCount);
-
   }
-
+  
+  /**
+   * check if required fields are not passed
+   */
+  function testActionScheduleCreateWithoutRequired() {
+       $params = array(
+                       'subject' => 'this case should fail',
+                       'scheduled_date_time' => date('Ymd'),
+       );
+       $result = $this->callAPIFailure('activity', 'create', $params);
+  }
+  
+  function testActionScheduleWithScheduledDatesCreate() {
+       $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
+       $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
+       $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
+       $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
+       $scheduledStatus = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
+       $mappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value');
+       $activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', "Meeting", 'name');
+       $title = "simpleActionSchedule".substr(sha1(rand()), 0, 7);
+       $params = array(
+      'title' => $title,
+         'recipient' => $assigneeID,
+         'limit_to' => 1,
+         'entity_value' => $activityTypeId,
+         'entity_status' => $scheduledStatus,
+         'is_active' => 1,
+         'record_activity' => 1,
+         'mapping_id' => $mappingId,
+         'start_action_offset' => 3,
+         'start_action_unit' => 'day',
+         'start_action_condition' => 'before',
+         'start_action_date' => 'activity_date_time',
+         'is_repeat' => 1,
+         'repetition_frequency_unit'=> 'day',
+         'repetition_frequency_interval' => 3,
+         'end_frequency_unit' => 'hour',
+         'end_frequency_interval' => 0,
+         'end_action' => 'before',
+         'end_date' => 'activity_date_time',
+         'body_html' => 'Test description',
+         'subject' => 'Test subject'
+    );
+       $actionSchedule = $this->callAPISuccess('action_schedule', 'create', $params);
+       $this->assertTrue(is_numeric($actionSchedule['id']), "In line " . __LINE__);
+       $this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__);
+       $this->assertEquals($actionSchedule['values'][$actionSchedule['id']]['start_action_offset'][0], $params['start_action_offset']);
+       $newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
+       $this->assertEquals($oldCount+1, $newCount);
+       
+  }
 
 }
index 767d7f7587064bc564048dc692eff89761404500..27ab3bbea66b06f74aa98c7dc69e5fc591984594 100644 (file)
@@ -644,7 +644,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
     $this->assertAPISuccess($result);
     $contributionId = $result['id'];
     $expectedResult = contribution_create_expectedresult();
-    $this->checkArrayEquals($result, $expectedResult);
+    $this->checkArrayEquals($expectedResult, $result);
     $this->contributionDelete($contributionId);
   }
 
@@ -895,7 +895,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
     );
     $contribution = $this->callAPISuccess('contribution', 'update', $newParams);
     $this->assertAPISuccess($contribution);
-    $this->_checkFinancialTrxn($contribution, 'paymentInstrument');
+    $this->_checkFinancialTrxn($contribution, 'paymentInstrument', $instrumentId);
   }
 
   /*
@@ -1444,7 +1444,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
    }
  }
 
- function _checkFinancialTrxn($contribution, $context) {
+ function _checkFinancialTrxn($contribution, $context, $instrumentId = NULL) {
    $trxnParams = array(
      'entity_id' =>   $contribution['id'],
      'entity_table' => 'civicrm_contribution',
@@ -1460,12 +1460,6 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
        'from_financial_account_id' => CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId),
      );
    }
-   elseif ($context == 'paymentInstrument') {
-     $compareParams = array(
-       'from_financial_account_id' => 6,
-       'to_financial_account_id'  =>  7,
-     );
-   }
    elseif ($context == 'refund') {
      $compareParams = array(
        'to_financial_account_id' => 6,
@@ -1480,7 +1474,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
        'status_id' => 3,
      );
    }
-   elseif ($context == 'changeFinancial') {
+   elseif ($context == 'changeFinancial' || $context == 'paymentInstrument') {
      $entityParams = array(
        'entity_id' =>   $contribution['id'],
        'entity_table' => 'civicrm_contribution',
@@ -1491,16 +1485,27 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
         'id' => $trxn['financial_trxn_id'],
      );
      $compareParams = array(
-       'to_financial_account_id' => 12,
        'total_amount' => -100,
        'status_id' => 1,
      );
+     if ($context == 'paymentInstrument') {
+       $compareParams += array(
+         'to_financial_account_id' => CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount(4),
+         'payment_instrument_id' => 4,
+       );
+     }
+     else {
+       $compareParams['to_financial_account_id'] = 12;
+     }
      $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams1, $compareParams);
-     $compareParams = array(
-       'to_financial_account_id' => 12,
-       'total_amount' => 100,
-       'status_id' => 1,
-     );
+     $compareParams['total_amount'] = 100;
+     if ($context == 'paymentInstrument') {
+       $compareParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($instrumentId);
+       $compareParams['payment_instrument_id'] = $instrumentId;
+     }
+     else {
+       $compareParams['to_financial_account_id'] = 12;
+     }
    }
 
    $this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $params, $compareParams);
index c8f0ee7d793a441bc02f7f5c4dce9975a26abfaf..10aa925d26a57910f3a5126aa4ab94ebc021548f 100644 (file)
@@ -20,6 +20,7 @@
   </primaryKey>
   <field>
     <name>title</name>
+    <title>Contribution Page Title</title>
     <type>varchar</type>
     <length>255</length>
     <localizable>true</localizable>
@@ -28,6 +29,7 @@
   </field>
   <field>
     <name>intro_text</name>
+    <title>Contribution Page Introduction Text</title>
     <type>text</type>
     <htmlType>textarea</htmlType>
     <rows>6</rows>
   </field>
   <field>
     <name>honor_block_title</name>
+    <title>Contribution Page Honor Block Title</title>
     <type>varchar</type>
     <length>255</length>
     <localizable>true</localizable>
   </field>
   <field>
     <name>honor_block_text</name>
+    <title>Contribution Page Honor Block Text</title>
     <type>text</type>
     <htmlType>textarea</htmlType>
     <rows>2</rows>
   </field>
   <field>
     <name>created_id</name>
+    <title>Contribution Page Created By</title>
     <type>int unsigned</type>
     <comment>FK to civicrm_contact, who created this contribution page</comment>
     <add>3.0</add>
   </field>
   <field>
     <name>currency</name>
+    <title>Contribution Page Currency</title>
     <type>varchar</type>
     <length>3</length>
     <default>NULL</default>
   </field>
   <field>
     <name>campaign_id</name>
+    <title>Contribution Page Campaign ID</title>
     <type>int unsigned</type>
     <comment>The campaign for which we are collecting contributions with this page.</comment>
     <add>3.4</add>
   </foreignKey>
   <field>
     <name>is_share</name>
+    <title>Is Contribution Page Shared?</title>
     <type>boolean</type>
     <default>1</default>
     <comment>Can people share the contribution page through social media?</comment>
index 01602426f1437af580e921a4b444e4e1543ccc7c..5be85af26010416dea5360b384b8e641bcea0d3e 100644 (file)
     <default>1</default>
     <import>true</import>
     <add>1.6</add>
+    <pseudoconstant>
+      <optionGroupName>contribution_status</optionGroupName>
+    </pseudoconstant>
   </field>
   <index>
     <name>index_contribution_status</name>
     <type>int unsigned</type>
     <comment>FK to Financial Type</comment>
     <add>4.3</add>
+    <pseudoconstant>
+      <table>civicrm_financial_type</table>
+      <keyColumn>id</keyColumn>
+      <labelColumn>name</labelColumn>
+    </pseudoconstant>
   </field>
   <foreignKey>
     <name>financial_type_id</name>
index 18b275cbe4536fd819ecae1c50176a16ce2c2fee..0264054a561e6376bd34fe79697fcdfd2f1875dc 100644 (file)
@@ -400,11 +400,11 @@ VALUES
    (@option_group_id_acc, 'Amex'      ,  3, 'Amex'      , NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL),
    (@option_group_id_acc, 'Discover'  ,  4, 'Discover'  , NULL, 0, NULL, 4, NULL, 0, 0, 1, NULL, NULL),
 
-  (@option_group_id_pi, '{ts escape="sql"}Credit Card{/ts}',  1, 'Credit Card', NULL, 0, NULL, 1, NULL, 0, 1, 1, NULL, NULL),
-  (@option_group_id_pi, '{ts escape="sql"}Debit Card{/ts}',   2, 'Debit Card',  NULL, 0, NULL, 2, NULL, 0, 1, 1, NULL, NULL),
-  (@option_group_id_pi, '{ts escape="sql"}Cash{/ts}',         3, 'Cash',        NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL),
-  (@option_group_id_pi, '{ts escape="sql"}Check{/ts}',        4, 'Check',       NULL, 0, NULL, 4, NULL, 0, 1, 1, NULL, NULL),
-  (@option_group_id_pi, '{ts escape="sql"}EFT{/ts}',          5, 'EFT',         NULL, 0, NULL, 5, NULL, 0, 0, 1, NULL, NULL),
+  (@option_group_id_pi, '{ts escape="sql"}Credit Card{/ts}',  1, 'Credit Card', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL),
+  (@option_group_id_pi, '{ts escape="sql"}Debit Card{/ts}',   2, 'Debit Card',  NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL),
+  (@option_group_id_pi, '{ts escape="sql"}Cash{/ts}',         3, 'Cash',        NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL),
+  (@option_group_id_pi, '{ts escape="sql"}Check{/ts}',        4, 'Check',       NULL, 0, 1, 4, NULL, 0, 1, 1, NULL, NULL),
+  (@option_group_id_pi, '{ts escape="sql"}EFT{/ts}',          5, 'EFT',         NULL, 0, 0, 5, NULL, 0, 0, 1, NULL, NULL),
 
   (@option_group_id_cs, '{ts escape="sql"}Completed{/ts}'  , 1, 'Completed'  , NULL, 0, NULL, 1, NULL, 0, 1, 1, NULL, NULL),
   (@option_group_id_cs, '{ts escape="sql"}Pending{/ts}'    , 2, 'Pending'    , NULL, 0, NULL, 2, NULL, 0, 1, 1, NULL, NULL),
index e3ca9f4a737b2c0e85ce4f8f826dbee2230947ec..22098fc22c2b9cc779a97f8bc58fe68aeea63285 100644 (file)
@@ -27,7 +27,7 @@
      <p>{$event.confirm_email_text|htmlize}</p>
 
     {else}
-  <p>Thank you for your participation.  This letter is a confirmation that your registration has been received and your status has been updated to <strong>{if $isOnWaitlist}waitlisted{else}registered{/if}</strong> for the following:</p>
+  <p>Thank you for your participation.  This letter is a confirmation that your registration has been received and your status has been updated to <strong>{if $participant_status}{$participant_status}{else}{if $isOnWaitlist}waitlisted{else}registered{/if}{/if}</strong> for the following:</p>
 
     {/if}
 
index f7cc098a5c73697115af990b55554435de0ec476..e373d2b320bcb01c4f83456a2050a8dbf8fa9f55 100644 (file)
@@ -4,7 +4,7 @@ Dear {contact.display_name},
 {$event.confirm_email_text}
 
 {else}
-Thank you for your participation.  This letter is a confirmation that your registration has been received and your status has been updated to {if $participant_status}$participant_status{else}{if $isOnWaitlist}waitlisted{else}registered{/if}{/if} for the following:
+Thank you for your participation.  This letter is a confirmation that your registration has been received and your status has been updated to {if $participant_status}{$participant_status}{else}{if $isOnWaitlist}waitlisted{else}registered{/if}{/if} for the following:
 
 {/if}