Merge pull request #10171 from seamuslee001/CRM-20427
authorEileen McNaughton <eileen@mcnaughty.com>
Tue, 18 Apr 2017 22:08:48 +0000 (10:08 +1200)
committerGitHub <noreply@github.com>
Tue, 18 Apr 2017 22:08:48 +0000 (10:08 +1200)
CRM-20427 Fix issue with the regex in I18n query rewriting and add tests

35 files changed:
.github/CONTRIBUTING.md
CRM/Admin/Form/Setting/Miscellaneous.php
CRM/Contact/Form/Task/PDFLetterCommon.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/BAO/Query.php
CRM/Core/BAO/FinancialTrxn.php
CRM/Core/DAO/AllCoreTables.data.php
CRM/Financial/DAO/FinancialTrxn.php
CRM/Report/Form/Contribute/Bookkeeping.php
CRM/Report/Form/Contribute/Detail.php
CRM/Report/Form/Contribute/History.php
CRM/Report/Form/Contribute/HouseholdSummary.php
CRM/Report/Form/Contribute/Lybunt.php
CRM/Report/Form/Contribute/OrganizationSummary.php
CRM/Report/Form/Contribute/PCP.php
CRM/Report/Form/Contribute/Recur.php
CRM/Report/Form/Contribute/SoftCredit.php
CRM/Report/Form/Contribute/Summary.php
CRM/Report/Form/Contribute/Sybunt.php
CRM/Report/Form/Contribute/TopDonor.php
CRM/Upgrade/Incremental/sql/4.7.19.mysql.tpl
CRM/Upgrade/Snapshot/V4p2/Price/DAO/SetEntity.php
CRM/Utils/ConsoleTee.php [new file with mode: 0644]
CRM/Utils/PDF/Document.php
CRM/Utils/PDF/Utils.php
css/civicrm.css
distmaker/dists/backdrop_php5.sh
settings/Core.setting.php
sql/civicrm_generated.mysql
templates/CRM/Admin/Form/Setting/Miscellaneous.tpl
templates/CRM/Contribute/Form/Search/Common.tpl
templates/CRM/Report/Form/Grant/Statistics.tpl
tests/phpunit/CRM/Contact/Form/Task/PrintDocumentTest.php
tests/phpunit/CRM/Core/BAO/FinancialTrxnTest.php
xml/schema/Financial/FinancialTrxn.xml

index 9a1e22a5d85f3c3b12fe351bd4039846f7bdb874..c456f00e10f76bc5eceed5c8c53ddf049e80b911 100644 (file)
@@ -16,6 +16,12 @@ and ensure the next release works -- all with a predictable timeline.
    [Release Management README](https://github.com/civicrm/release-management/blob/master/README.md).
  * For an example invitation, see the previous [invitation for the April-May 2016](https://github.com/civicrm/release-management/issues/1).
 
+## Pull-Request Scope
+
+A good pull request (PR) addresses a clearly-defined problem. There should be a detailed description logged in the [issue tracker](http://issues.civicrm.org/). Excellent PRs also increase test coverage. If you are tempted to do additional tweaks or code cleanup outside the scope of that issue, you could make a separate commit and include them in the PR if they are minor & non-controversial, or create a seperate PR if they are more complex.
+
+There is no size limit for PRs as long as they are focused on completely solving a discreet problem. As a practical matter, though, bigger PRs may take longer to review and merge. When possible, split "epic" issues into bite-sized chunks as long as each seperate PR is functionally complete and does not cause merge conflicts with your other PRs. In the latter case, add commits to an existing PR.
+
 ## Pull-Request Subject
 
 When filing a pull-request, use a descriptive subject. These are good examples:
index acc22807638e929d5272bdb7f65a5b39dba7c0ec..6f9b6457e465b9f6742664f9d9f8afcca47d54b3 100644 (file)
@@ -43,6 +43,7 @@ class CRM_Admin_Form_Setting_Miscellaneous extends CRM_Admin_Form_Setting {
     'logging' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
     'maxFileSize' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
     'doNotAttachPDFReceipt' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
+    'recordGeneratedLetters' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
     'secondDegRelPermissions' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
     'checksum_timeout' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
     'recaptchaOptions' => CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
index ae4a758fb0094146483fc7ee70ee57f6655341e9..6f1003913f9d3080f5c62187d09b544a387b64b2 100644 (file)
  */
 class CRM_Contact_Form_Task_PDFLetterCommon {
 
+  /**
+   * @return array
+   *   Array(string $machineName => string $label).
+   */
+  public static function getLoggingOptions() {
+    return array(
+      'none' => ts('Do not record'),
+      'multiple' => ts('Multiple activities (one per contact)'),
+      'combined' => ts('One combined activity'),
+      'combined-attached' => ts('One combined activity plus one file attachment'),
+      // 'multiple-attached' <== not worth the work
+    );
+  }
+
   /**
    * Build all the data structures needed to build the form.
    *
@@ -345,11 +359,11 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
     $buttonName = $form->controller->getButtonName();
     $skipOnHold = isset($form->skipOnHold) ? $form->skipOnHold : FALSE;
     $skipDeceased = isset($form->skipDeceased) ? $form->skipDeceased : TRUE;
-    $html = $document = array();
+    $html = $activityIds = array();
 
     // CRM-16725 Skip creation of activities if user is previewing their PDF letter(s)
     if ($buttonName == '_qf_PDF_upload') {
-      self::createActivities($form, $html_message, $form->_contactIds);
+      $activityIds = self::createActivities($form, $html_message, $form->_contactIds);
     }
 
     if (!empty($formValues['document_file_path'])) {
@@ -396,16 +410,48 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
       $html[] = $tokenHtml;
     }
 
+    $tee = NULL;
+    if (Civi::settings()->get('recordGeneratedLetters') === 'combined-attached') {
+      if (count($activityIds) !== 1) {
+        throw new CRM_Core_Exception("When recordGeneratedLetters=combined-attached, there should only be one activity.");
+      }
+      $tee = CRM_Utils_ConsoleTee::create()->start();
+    }
+
     $type = $formValues['document_type'];
+    $mimeType = self::getMimeType($type);
+    // ^^ Useful side-effect: consistently throws error for unrecognized types.
 
     if ($type == 'pdf') {
-      CRM_Utils_PDF_Utils::html2pdf($html, "CiviLetter.pdf", FALSE, $formValues);
+      $fileName = "CiviLetter.$type";
+      CRM_Utils_PDF_Utils::html2pdf($html, $fileName, FALSE, $formValues);
     }
     elseif (!empty($formValues['document_file_path'])) {
-      CRM_Utils_PDF_Document::printDocuments($formValues['document_file_path'], $html, $type, $zip);
+      $fileName = pathinfo($formValues['document_file_path'], PATHINFO_FILENAME) . '.' . $type;
+      CRM_Utils_PDF_Document::printDocuments($html, $fileName, $type, $zip);
     }
     else {
-      CRM_Utils_PDF_Document::html2doc($html, "CiviLetter.$type", $formValues);
+      $fileName = "CiviLetter.$type";
+      CRM_Utils_PDF_Document::html2doc($html, $fileName, $formValues);
+    }
+
+    if ($tee) {
+      $tee->stop();
+      $content = file_get_contents($tee->getFileName(), NULL, NULL, NULL, 5);
+      if (empty($content)) {
+        throw new \CRM_Core_Exception("Failed to capture document content (type=$type)!");
+      }
+      foreach ($activityIds as $activityId) {
+        civicrm_api3('Attachment', 'create', array(
+          'entity_table' => 'civicrm_activity',
+          'entity_id' => $activityId,
+          'name' => $fileName,
+          'mime_type' => $mimeType,
+          'options' => array(
+            'move-file' => $tee->getFileName(),
+          ),
+        ));
+      }
     }
 
     $form->postProcessHook();
@@ -415,8 +461,12 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
 
   /**
    * @param CRM_Core_Form $form
-   * @param $html_message
-   * @param $contactIds
+   * @param string $html_message
+   * @param array $contactIds
+   * @return array
+   *   List of activity IDs.
+   *   There may be 1 or more, depending on the system-settings
+   *   and use-case.
    *
    * @throws CRM_Core_Exception
    */
@@ -442,34 +492,51 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
     if (!empty($form->_activityId)) {
       $activityParams += array('id' => $form->_activityId);
     }
-    if ($form->_cid) {
-      $activity = CRM_Activity_BAO_Activity::create($activityParams);
-      if (!empty($form->_caseId)) {
-        $caseActivityParams = array('activity_id' => $activity->id, 'case_id' => $form->_caseId);
-        CRM_Case_BAO_Case::processCaseActivity($caseActivityParams);
-      }
+
+    // This seems silly, but the old behavior was to first check `_cid`
+    // and then use the provided `$contactIds`. Probably not even necessary,
+    // but difficult to audit.
+    $contactIds = $form->_cid ? array($form->_cid) : $contactIds;
+
+    $activityIds = array();
+    switch (Civi::settings()->get('recordGeneratedLetters')) {
+      case 'none':
+        return array();
+
+      case 'multiple':
+        // One activity per contact.
+        foreach ($contactIds as $contactId) {
+          $fullParams = array(
+            'target_contact_id' => $contactId,
+          ) + $activityParams;
+          $activity = CRM_Activity_BAO_Activity::create($fullParams);
+          $activityIds[$contactId] = $activity->id;
+        }
+
+        break;
+
+      case 'combined':
+      case 'combined-attached':
+        // One activity with all contacts.
+        $fullParams = array(
+          'target_contact_id' => $contactIds,
+        ) + $activityParams;
+        $activity = CRM_Activity_BAO_Activity::create($fullParams);
+        $activityIds[] = $activity->id;
+        break;
+
+      default:
+        throw new CRM_Core_Exception("Unrecognized option in recordGeneratedLetters: " . Civi::settings()->get('recordGeneratedLetters'));
     }
-    else {
-      // create  Print PDF activity for each selected contact. CRM-6886
-      $activityIds = array();
-      foreach ($contactIds as $contactId) {
-        $activityID = CRM_Activity_BAO_Activity::create($activityParams);
-        $activityIds[$contactId] = $activityID->id;
+
+    if (!empty($form->_caseId)) {
+      foreach ($activityIds as $activityId) {
+        $caseActivityParams = array('activity_id' => $activityId, 'case_id' => $form->_caseId);
+        CRM_Case_BAO_Case::processCaseActivity($caseActivityParams);
       }
     }
 
-    $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
-    $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
-
-    //@todo why are we using $form->_contactIds here & contactIds above - need comment
-    foreach ($form->_contactIds as $contactId) {
-      $activityTargetParams = array(
-        'activity_id' => empty($activity->id) ? $activityIds[$contactId] : $activity->id,
-        'contact_id' => $contactId,
-        'record_type_id' => $targetID,
-      );
-      CRM_Activity_BAO_ActivityContact::create($activityTargetParams);
-    }
+    return $activityIds;
   }
 
   /**
@@ -515,4 +582,26 @@ class CRM_Contact_Form_Task_PDFLetterCommon {
     $message = implode($newLineOperators['p']['oper'], $htmlMsg);
   }
 
+  /**
+   * Convert from a vague-type/file-extension to mime-type.
+   *
+   * @param string $type
+   * @return string
+   * @throws \CRM_Core_Exception
+   */
+  private static function getMimeType($type) {
+    $mimeTypes = array(
+      'pdf' => 'application/pdf',
+      'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
+      'odt' => 'application/vnd.oasis.opendocument.text',
+      'html' => 'text/html',
+    );
+    if (isset($mimeTypes[$type])) {
+      return $mimeTypes[$type];
+    }
+    else {
+      throw new \CRM_Core_Exception("Cannot determine mime type");
+    }
+  }
+
 }
index a196c7c53bcbd09c53bf147e6a0d209e1e371b31..6e715176d1cb88db73ed3e56f1c30fa059d2e992 100644 (file)
@@ -3371,7 +3371,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
               civicrm_api3('FinancialTrxn', 'create', array('id' => $refundIDs['financialTrxnId'], 'trxn_id' => $params['refund_trxn_id']));
             }
           }
-          $cardType = CRM_Utils_Array::value('card_type', $params);
+          $cardType = CRM_Utils_Array::value('card_type_id', $params);
           $panTruncation = CRM_Utils_Array::value('pan_truncation', $params);
           CRM_Core_BAO_FinancialTrxn::updateCreditCardDetails($params['contribution']->id, $panTruncation, $cardType);
         }
@@ -4066,7 +4066,7 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']})
         SELECT GROUP_CONCAT(fa.`name`) as financial_account,
           ft.total_amount,
           ft.payment_instrument_id,
-          ft.trxn_date, ft.trxn_id, ft.status_id, ft.check_number, ft.currency, ft.pan_truncation, ft.card_type
+          ft.trxn_date, ft.trxn_id, ft.status_id, ft.check_number, ft.currency, ft.pan_truncation, ft.card_type_id
 
         FROM civicrm_contribution con
           LEFT JOIN civicrm_entity_financial_trxn eft ON (eft.entity_id = con.id AND eft.entity_table = 'civicrm_contribution')
@@ -4088,8 +4088,8 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']})
       while ($resultDAO->fetch()) {
         $paidByLabel = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'payment_instrument_id', $resultDAO->payment_instrument_id);
         $paidByName = CRM_Core_PseudoConstant::getName('CRM_Core_BAO_FinancialTrxn', 'payment_instrument_id', $resultDAO->payment_instrument_id);
-        if ($resultDAO->card_type) {
-          $creditCardType = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'card_type', $resultDAO->card_type);
+        if ($resultDAO->card_type_id) {
+          $creditCardType = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_FinancialTrxn', 'card_type_id', $resultDAO->card_type_id);
           $pantruncation = '';
           if ($resultDAO->pan_truncation) {
             $pantruncation = ": {$resultDAO->pan_truncation}";
index 416cf0a9c104586f2f1e136494385396b785af55..185f38cfe75324c93d46ff137b5de06fc2a0fc3c 100644 (file)
@@ -443,11 +443,11 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query {
         $query->_tables['civicrm_financial_trxn'] = $query->_whereTables['civicrm_financial_trxn'] = 1;
         return;
 
-      case 'financial_trxn_card_type':
-        $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_financial_trxn.card_type', $op, $value);
+      case 'financial_trxn_card_type_id':
+        $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause('civicrm_financial_trxn.card_type_id', $op, $value);
         $query->_tables['civicrm_financial_trxn'] = $query->_whereTables['civicrm_financial_trxn'] = 1;
         $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
-        list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Financial_DAO_FinancialTrxn', 'card_type', $value, $op);
+        list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Financial_DAO_FinancialTrxn', 'card_type_id', $value, $op);
         $query->_qill[$grouping][] = ts('Card Type %1 %2', array(1 => $op, 2 => $value));
         return;
 
@@ -967,7 +967,7 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query {
       )
     );
 
-    $form->addField('financial_trxn_card_type', array('entity' => 'FinancialTrxn', 'name' => 'card_type', 'action' => 'get'));
+    $form->addField('financial_trxn_card_type_id', array('entity' => 'FinancialTrxn', 'name' => 'card_type_id', 'action' => 'get'));
 
     $form->add('text', 'financial_trxn_pan_truncation', ts('Card Number'), array(
       'size' => 5,
index 1d22a677321444f6eb0af31ee742a72a091c2d1f..f2f448c3ddd4648bcaa7ff140146ec71026662fd 100644 (file)
@@ -723,7 +723,7 @@ WHERE ft.to_financial_account_id != {$toFinancialAccount} AND ft.to_financial_ac
     $financialTrxnId = $financialTrxn['financial_trxn_id'];
     $trxnparams = array('id' => $financialTrxnId);
     if (isset($cardType)) {
-      $trxnparams['card_type'] = $cardType;
+      $trxnparams['card_type_id'] = $cardType;
     }
     if (isset($panTruncation)) {
       $trxnparams['pan_truncation'] = $panTruncation;
index 3b769206c05823de7946f65d43bdd1912c3123cd..42aff8cb26c3ddeabc676078e9e03e2a0bb29a90 100644 (file)
@@ -24,7 +24,7 @@
 | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
 +--------------------------------------------------------------------+
 */
-// (GenCodeChecksum:4cb264e1d72064f4be4909c4e3ecf3ad)
+// (GenCodeChecksum:345a72fb0f5f60672c3145e2fd078a37)
 return array(
   'CRM_Core_DAO_AddressFormat' => array(
     'name' => 'AddressFormat',
index a9d9ab0791c542bcf2b60d0bccd450451fc7b8f5..b0a6c67f4da3e36219b4f9cf9191542f10fed98d 100644 (file)
@@ -30,7 +30,7 @@
  *
  * Generated from xml/schema/CRM/Financial/FinancialTrxn.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:505b36cf7c6c052f88ab1ca0f0fc82a0)
+ * (GenCodeChecksum:2c30f842e4a913eaac8e180219bc522e)
  */
 require_once 'CRM/Core/DAO.php';
 require_once 'CRM/Utils/Type.php';
@@ -138,7 +138,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
    *
    * @var int unsigned
    */
-  public $card_type;
+  public $card_type_id;
   /**
    * Check number
    *
@@ -401,10 +401,10 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
             'optionEditPath' => 'civicrm/admin/options/payment_instrument',
           )
         ) ,
-        'financial_trxn_card_type' => array(
-          'name' => 'card_type',
+        'financial_trxn_card_type_id' => array(
+          'name' => 'card_type_id',
           'type' => CRM_Utils_Type::T_INT,
-          'title' => ts('Card Type') ,
+          'title' => ts('Card Type ID') ,
           'description' => 'FK to accept_creditcard option group values',
           'table_name' => 'civicrm_financial_trxn',
           'entity' => 'FinancialTrxn',
index a1ae4005875384fdf9c08b40280e479efe8d751f..0309e36e31f002fd3ca6460533f89c69a9948c6b 100644 (file)
@@ -347,7 +347,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
             'title' => ts('Trans #'),
             'default' => TRUE,
           ),
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
           ),
         ),
@@ -376,10 +376,10 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
             'options' => CRM_Contribute_PseudoConstant::contributionStatus(),
             'default' => array(1),
           ),
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialTrxn', 'card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -648,7 +648,7 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
     $contributionTypes = CRM_Contribute_PseudoConstant::financialType();
     $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
     $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
-    $creditCardTypes = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialTrxn', 'card_type');
+    $creditCardTypes = CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id');
     foreach ($rows as $rowNum => $row) {
       // convert display name to links
       if (array_key_exists('civicrm_contact_sort_name', $row) &&
@@ -690,8 +690,8 @@ class CRM_Report_Form_Contribute_Bookkeeping extends CRM_Report_Form {
         $entryFound = TRUE;
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = CRM_Utils_Array::value($row['civicrm_financial_trxn_card_type'], $creditCardTypes);
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = CRM_Utils_Array::value($row['civicrm_financial_trxn_card_type_id'], $creditCardTypes);
         $entryFound = TRUE;
       }
 
index 3c3d536fab4d4c2e6aac0425acbef53bc6629333..81f72ac16e56067a39a3e67169239c778896bc76 100644 (file)
@@ -292,16 +292,16 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -765,8 +765,8 @@ UNION ALL
         $rows[$rowNum]['civicrm_batch_batch_id'] = CRM_Utils_Array::value($row['civicrm_batch_batch_id'], $batches);
         $entryFound = TRUE;
       }
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
index d70e4847a0e676bd15e44944129eb2be0c5efa6d..0cb76f1fad74cab4ae3c2659eb562d179ef306e4 100644 (file)
@@ -273,16 +273,16 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -876,8 +876,8 @@ class CRM_Report_Form_Contribute_History extends CRM_Report_Form {
         $rows[$rowNum]['civicrm_contact_sort_name_hover'] = ts("View Contribution Details for this Contact.");
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
index ffaa4fd237d161065c43cff53375fe299fcd9369..43135d64e31f964ec4a566265a2c2fa1466908e6 100644 (file)
@@ -164,16 +164,16 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -561,8 +561,8 @@ class CRM_Report_Form_Contribute_HouseholdSummary extends CRM_Report_Form {
         $row['civicrm_contribution_total_amount'] = CRM_Utils_Money::format($row['civicrm_contribution_total_amount'], $row['civicrm_contribution_currency']);
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
index 93bcf8ec56a367408d166fb5328309ebe8be9ea4..b0877276d6d6335f2f1cff9cffa732da7c3d2668 100644 (file)
@@ -252,16 +252,16 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -756,8 +756,8 @@ class CRM_Report_Form_Contribute_Lybunt extends CRM_Report_Form {
         $entryFound = TRUE;
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
index 64b97337feb7b37f14571993ac0b57096822f11d..9a310fe91d8747d922bb28b6bb70a46faffba373 100644 (file)
@@ -196,16 +196,16 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -553,8 +553,8 @@ class CRM_Report_Form_Contribute_OrganizationSummary extends CRM_Report_Form {
         $entryFound = TRUE;
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
index 6a137a1b15db8589931e4bca31ffdad5893a9e14..bc3506824efabb78740439e4dcaa271b074a96a8 100644 (file)
@@ -169,16 +169,16 @@ class CRM_Report_Form_Contribute_PCP extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -376,8 +376,8 @@ LEFT JOIN civicrm_contribution_page {$this->_aliases['civicrm_contribution_page'
         $entryFound = TRUE;
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
index 6ec3dd3cacbbf04f15cc3a408b0764e6979ffa58..602b8f5607fbd95774ad6407bae13c28475d85db 100644 (file)
@@ -109,16 +109,16 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -392,8 +392,8 @@ class CRM_Report_Form_Contribute_Recur extends CRM_Report_Form {
         $rows[$rowNum]['civicrm_contribution_recur_amount'] = CRM_Utils_Money::format($rows[$rowNum]['civicrm_contribution_recur_amount'], $rows[$rowNum]['civicrm_contribution_recur_currency']);
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
       }
     }
   }
index 1ebfb6e83071ecb71325ccbca0a341e06196fd9b..0ad8445917a259b978c92c0a0e42d833530de127 100644 (file)
@@ -305,16 +305,16 @@ class CRM_Report_Form_Contribute_SoftCredit extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -661,8 +661,8 @@ GROUP BY   {$this->_aliases['civicrm_contribution']}.currency
         $entryFound = TRUE;
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type']) && !in_array('Subtotal', $rows[$rowNum])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id']) && !in_array('Subtotal', $rows[$rowNum])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
index 88389779931321df91f3c70b28177c4d3cc9542d..5fd12b81bac2a6a606ca72b78431801e80a09a66 100644 (file)
@@ -229,16 +229,16 @@ class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialTrxn', 'card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -968,8 +968,8 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
         $entryFound = TRUE;
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
index 0892bb172d7cc266d60ece6a2ce7fa1bf56093ae..2299e9d7b8df2159e250da8a8994b98afa5f7397 100644 (file)
@@ -250,17 +250,17 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'default' => NULL,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'type' => CRM_Utils_Type::T_STRING,
           ),
         ),
@@ -635,8 +635,8 @@ class CRM_Report_Form_Contribute_Sybunt extends CRM_Report_Form {
         $entryFound = TRUE;
       }
 
-      if (!empty($row['civicrm_financial_trxn_card_type'])) {
-        $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+      if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+        $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
         $entryFound = TRUE;
       }
 
index 856807efb40a337d9d803c7e5343e3db9a456fca..8a7ad5bead8502014d1d589ca6ce3f06a85cafe9 100644 (file)
@@ -165,16 +165,16 @@ class CRM_Report_Form_Contribute_TopDonor extends CRM_Report_Form {
       'civicrm_financial_trxn' => array(
         'dao' => 'CRM_Financial_DAO_FinancialTrxn',
         'fields' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
-            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type SEPARATOR ",")',
+            'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
           ),
         ),
         'filters' => array(
-          'card_type' => array(
+          'card_type_id' => array(
             'title' => ts('Credit Card Type'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type'),
+            'options' => CRM_Financial_DAO_FinancialTrxn::buildOptions('card_type_id'),
             'default' => NULL,
             'type' => CRM_Utils_Type::T_STRING,
           ),
@@ -516,8 +516,8 @@ ORDER BY civicrm_contribution_total_amount_sum DESC
           $entryFound = TRUE;
         }
 
-        if (!empty($row['civicrm_financial_trxn_card_type'])) {
-          $rows[$rowNum]['civicrm_financial_trxn_card_type'] = $this->getLabels($row['civicrm_financial_trxn_card_type'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type');
+        if (!empty($row['civicrm_financial_trxn_card_type_id'])) {
+          $rows[$rowNum]['civicrm_financial_trxn_card_type_id'] = $this->getLabels($row['civicrm_financial_trxn_card_type_id'], 'CRM_Financial_DAO_FinancialTrxn', 'card_type_id');
           $entryFound = TRUE;
         }
 
index 2716b062d3e94b7b2ca080a0336c1397aa5fe8f3..2bcc98cf0926dd4d38fa3bf5fabdbf317643023e 100644 (file)
@@ -5,7 +5,7 @@ SELECT @close_acc_period_act_val := `value` FROM civicrm_option_value WHERE opti
 SELECT @close_accounting_period_activity_count := count(id) FROM `civicrm_activity` WHERE `activity_type_id` = @close_acc_period_act_val;
 
 -- Delete Close Accounting Period activity type
-DELETE FROM civicrm_option_value 
+DELETE FROM civicrm_option_value
     WHERE option_group_id = @option_group_id_act AND name = 'Close Accounting Period' AND @close_accounting_period_activity_count = 0;
 
 --  CRM-19517 Disable all price fields and price field options that use disabled fianancial types
@@ -38,3 +38,6 @@ INSERT INTO
  `civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}description{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`, `icon`)
 VALUES
   (@option_group_id_adOpt, {localize}'{ts escape="sql"}Supplemental Address 3{/ts}'{/localize}, (SELECT @max_val := @max_val + 1), 'supplemental_address_3', NULL, 0, NULL, (SELECT @supp2_wt := @supp2_wt + 1), {localize}''{/localize}, 0, 0, 1, NULL, NULL, NULL);
+
+-- CRM-20439 rename card_type to card_type_id of civicrm_financial_trxn table (IIDA-126)
+ALTER TABLE `civicrm_financial_trxn` CHANGE `card_type` `card_type_id` INT(10) UNSIGNED NULL DEFAULT NULL COMMENT 'FK to accept_creditcard option group values';
index 5ab117a985c966a9e835f6deb72f60558c1b8fd2..453445c09f611e8afb030f025757e1e56604b2a1 100644 (file)
@@ -131,7 +131,7 @@ class CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity extends CRM_Core_DAO {
    *
    * @return array
    */
-  pubic static function &fields() {
+  public static function &fields() {
     if (!(self::$_fields)) {
       self::$_fields = array(
         'id' => array(
diff --git a/CRM/Utils/ConsoleTee.php b/CRM/Utils/ConsoleTee.php
new file mode 100644 (file)
index 0000000..9659ddb
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | CiviCRM version 4.7                                                |
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
+ +--------------------------------------------------------------------+
+ | This file is a part of CiviCRM.                                    |
+ |                                                                    |
+ | CiviCRM is free software; you can copy, modify, and distribute it  |
+ | under the terms of the GNU Affero General Public License           |
+ | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
+ |                                                                    |
+ | CiviCRM is distributed in the hope that it will be useful, but     |
+ | WITHOUT ANY WARRANTY; without even the implied warranty of         |
+ | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
+ | See the GNU Affero General Public License for more details.        |
+ |                                                                    |
+ | You should have received a copy of the GNU Affero General Public   |
+ | License and the CiviCRM Licensing Exception along                  |
+ | with this program; if not, contact CiviCRM LLC                     |
+ | at info[AT]civicrm[DOT]org. If you have questions about the        |
+ | GNU Affero General Public License or the licensing of CiviCRM,     |
+ | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * Capture the output from the console, copy it to a file, and pass it on.
+ *
+ * @code
+ * $tee = CRM_Utils_ConsoleTee::create()->start();
+ * echo "hello world";
+ * $tee->stop();
+ * assertEquals("hello world", file_get_contents($tee->getFileName()));
+ * @endCode
+ *
+ * Loosely speaking, it serves a similar purpose to Unix `tee`.
+ *
+ * @link https://en.wikipedia.org/wiki/Tee_(command)
+ */
+class CRM_Utils_ConsoleTee {
+
+  /**
+   * Capture console output and copy to a temp file.
+   *
+   * @param string $prefix
+   * @return CRM_Utils_ConsoleTee
+   */
+  public static function create($prefix = 'ConsoleTee-') {
+    return new static(tempnam(sys_get_temp_dir(), $prefix));
+  }
+
+  /**
+   * @var string
+   */
+  protected $fileName;
+
+  /**
+   * @var resource
+   */
+  protected $fh;
+
+  /**
+   * CRM_Utils_ConsoleTee constructor.
+   *
+   * @param string $fileName
+   *   The full path of the file to write to.
+   */
+  public function __construct($fileName) {
+    $this->fileName = $fileName;
+  }
+
+  /**
+   * Start capturing console output and copying it to a file.
+   *
+   * @param string $mode
+   *   The file output mode, e.g. `w` or `w+`.
+   * @return CRM_Utils_ConsoleTee
+   * @see fopen
+   */
+  public function start($mode = 'w') {
+    $this->fh = fopen($this->fileName, $mode);
+    ob_start(array($this, 'onOutput'));
+    return $this;
+  }
+
+  /**
+   * Process a snippet of data from the output buffer.
+   *
+   * @param string $buf
+   * @return bool
+   * @see ob_start
+   */
+  public function onOutput($buf) {
+    fwrite($this->fh, $buf);
+    return FALSE;
+  }
+
+  /**
+   * Stop capturing console output.
+   *
+   * @return CRM_Utils_ConsoleTee
+   */
+  public function stop() {
+    ob_end_flush();
+    fclose($this->fh);
+    return $this;
+  }
+
+  /**
+   * @return string
+   */
+  public function getFileName() {
+    return $this->fileName;
+  }
+
+}
index e841d67ca09461f06fb36d0b0bf671dfffbbec9c..e2dac47b16e9f065ad163293b0082fb9c898d9c6 100644 (file)
@@ -57,7 +57,10 @@ class CRM_Utils_PDF_Document {
    * Convert html to a Doc file.
    *
    * @param array $pages
+   *   List of HTML snippets.
    * @param string $fileName
+   *   The logical filename to return to client.
+   *   Ex: "HelloWorld.odt".
    * @param array|int $format
    */
   public static function html2doc($pages, $fileName, $format = array()) {
@@ -100,7 +103,13 @@ class CRM_Utils_PDF_Document {
   /**
    * @param object|string $phpWord
    * @param string $ext
+   *   File extension/type.
+   *   Ex: docx, odt, html.
    * @param string $fileName
+   *   The logical filename to return to client.
+   *   Ex: "HelloWorld.odt".
+   *   Alternatively, a full path of a file to display. This seems sketchy.
+   *   Ex: "/var/lib/data/HelloWorld.odt".
    */
   public static function printDoc($phpWord, $ext, $fileName) {
     $formats = array(
@@ -173,10 +182,12 @@ class CRM_Utils_PDF_Document {
   /**
    * Modify contents of docx/odt file(s) and later merged into one final document
    *
-   * @param string $filePath
-   *   Document file path
    * @param array $contents
-   *   Content of formatted/token-replaced document
+   *   Content of formatted/token-replaced document.
+   *   List of HTML snippets.
+   * @param string $fileName
+   *   The logical filename to return to client.
+   *   Ex: "HelloWorld.odt".
    * @param string $docType
    *   Document type e.g. odt/docx
    * @param clsTbsZip $zip
@@ -186,7 +197,7 @@ class CRM_Utils_PDF_Document {
    *
    * @return string
    */
-  public static function printDocuments($filePath, $contents, $docType, $zip, $returnFinalContent = FALSE) {
+  public static function printDocuments($contents, $fileName, $docType, $zip, $returnFinalContent = FALSE) {
     $dataMap = self::$ooxmlMap[$docType];
 
     $finalContent = $zip->FileRead($dataMap['dataFile']);
@@ -215,7 +226,6 @@ class CRM_Utils_PDF_Document {
     // Replace the loaded document file content located at $filePath with $finaContent
     $zip->FileReplace($dataMap['dataFile'], $finalContent, TBSZIP_STRING);
 
-    $fileName = pathinfo($filePath, PATHINFO_FILENAME) . '.' . $docType;
     $zip->Flush(TBSZIP_DOWNLOAD, $fileName);
   }
 
index f8696f04c76c280621cef0efc32cc185e3fbc273..9b42f7fad84b2fe1d5e3fdcf6a97226d189c3890 100644 (file)
@@ -36,10 +36,15 @@ use Dompdf\Options;
 class CRM_Utils_PDF_Utils {
 
   /**
-   * @param $text
+   * @param array $text
+   *   List of HTML snippets.
    * @param string $fileName
+   *   The logical filename to display.
+   *   Ex: "HelloWorld.pdf".
    * @param bool $output
+   *   FALSE to display PDF. TRUE to return as string.
    * @param null $pdfFormat
+   *   Unclear. Possibly PdfFormat or formValues.
    *
    * @return string|void
    */
index d9db723990e8641d5f31225e06bfa36fa878f21b..12b2f0114d0ca82ca14ab55a0b1d97d33769387b 100644 (file)
@@ -1498,7 +1498,7 @@ input.crm-form-entityref {
   text-decoration: none;
 }
 
-.crm-container .panel {
+.crm-container ul.panel {
   display: none;
   z-index: 9999;
   position: absolute;
@@ -3844,4 +3844,4 @@ span.crm-status-icon {
   padding: 1px 5px;
   border-radius: 3px;
   border: 1px solid grey;
-}
\ No newline at end of file
+}
index 411386be1dd5cc2a557c04655b69ee2a948ea8fc..58b35d7881660f2cd503ec3acd92f7382a2cf65c 100644 (file)
@@ -26,7 +26,7 @@ dm_install_drupal "$SRC/backdrop" "$TRG/backdrop"
 
 # gen tarball
 cd $TRG/..
-tar czf $DM_TARGETDIR/civicrm-$DM_VERSION-backdrop-unstable.tar.gz civicrm
+tar czf $DM_TARGETDIR/civicrm-$DM_VERSION-backdrop.tar.gz civicrm
 
 # clean up
 rm -rf $TRG
index dd8ad7919fcc21ef4986f53a10c85d05e07f161c..b2c8940e3900de3840d1c1b7f32d05ac185ede48 100644 (file)
@@ -437,6 +437,27 @@ return array(
     'description' => "If enabled, CiviCRM sends PDF receipt as an attachment during event signup or online contribution.",
     'help_text' => NULL,
   ),
+  'recordGeneratedLetters' => array(
+    'group_name' => 'CiviCRM Preferences',
+    'group' => 'core',
+    'name' => 'recordGeneratedLetters',
+    'type' => 'String',
+    'quick_form_type' => 'Select',
+    'html_type' => 'Select',
+    'html_attributes' => array(
+      'class' => 'crm-select2',
+    ),
+    'default' => 'multiple',
+    'add' => '4.7',
+    'title' => 'Record generated letters',
+    'is_domain' => 1,
+    'is_contact' => 0,
+    'description' => 'When generating a letter (PDF/Word) via mail-merge, how should the letter be recorded?',
+    'help_text' => NULL,
+    'pseudoconstant' => array(
+      'callback' => 'CRM_Contact_Form_Task_PDFLetterCommon::getLoggingOptions',
+    ),
+  ),
   'wkhtmltopdfPath' => array(
     'group_name' => 'CiviCRM Preferences',
     'group' => 'core',
index a887350847479cf584f02dd8c22168212f002ec1..fbc51d5a231b2eb890f6ccd75a75c5e70d8f7611 100644 (file)
@@ -533,7 +533,7 @@ UNLOCK TABLES;
 
 LOCK TABLES `civicrm_financial_trxn` WRITE;
 /*!40000 ALTER TABLE `civicrm_financial_trxn` DISABLE KEYS */;
-INSERT INTO `civicrm_financial_trxn` (`id`, `from_financial_account_id`, `to_financial_account_id`, `trxn_date`, `total_amount`, `fee_amount`, `net_amount`, `currency`, `is_payment`, `trxn_id`, `trxn_result_code`, `status_id`, `payment_processor_id`, `payment_instrument_id`, `card_type`, `check_number`, `pan_truncation`) VALUES (1,NULL,6,'2010-04-11 00:00:00',125.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'1041',NULL),(2,NULL,12,'2010-03-21 00:00:00',50.00,NULL,NULL,'USD',1,'P20901X1',NULL,1,NULL,1,NULL,NULL,NULL),(3,NULL,6,'2010-04-29 00:00:00',25.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'2095',NULL),(4,NULL,6,'2010-04-11 00:00:00',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'10552',NULL),(5,NULL,6,'2010-04-15 00:00:00',500.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'509',NULL),(6,NULL,6,'2010-04-11 00:00:00',175.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'102',NULL),(7,NULL,12,'2010-03-27 00:00:00',50.00,NULL,NULL,'USD',1,'P20193L2',NULL,1,NULL,1,NULL,NULL,NULL),(8,NULL,12,'2010-03-08 00:00:00',10.00,NULL,NULL,'USD',1,'P40232Y3',NULL,1,NULL,1,NULL,NULL,NULL),(9,NULL,12,'2010-04-22 00:00:00',250.00,NULL,NULL,'USD',1,'P20193L6',NULL,1,NULL,1,NULL,NULL,NULL),(10,NULL,12,'2009-07-01 11:53:50',500.00,NULL,NULL,'USD',1,'PL71',NULL,1,NULL,1,NULL,NULL,NULL),(11,NULL,12,'2009-07-01 12:55:41',200.00,NULL,NULL,'USD',1,'PL43II',NULL,1,NULL,1,NULL,NULL,NULL),(12,NULL,12,'2009-10-01 11:53:50',200.00,NULL,NULL,'USD',1,'PL32I',NULL,1,NULL,1,NULL,NULL,NULL),(13,NULL,12,'2009-12-01 12:55:41',200.00,NULL,NULL,'USD',1,'PL32II',NULL,1,NULL,1,NULL,NULL,NULL),(14,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(15,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(16,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(17,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(18,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(19,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(20,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(21,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(22,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(23,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(24,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(25,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(26,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(27,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(28,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(29,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(30,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(31,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(32,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(33,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(34,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(35,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(36,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(37,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(38,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(39,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(40,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(41,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(42,NULL,12,'2017-04-16 14:13:14',1200.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(43,NULL,12,'2017-04-16 14:13:14',1200.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(44,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(45,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(46,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(47,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(48,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(49,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(50,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(51,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(52,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(53,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(54,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(55,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(56,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(57,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(58,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(59,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(60,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(61,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(62,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(63,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(64,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(65,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(66,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(67,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(68,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(69,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(70,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(71,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(72,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(73,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(74,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(75,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(76,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(77,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(78,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(79,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(80,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(81,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(82,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(83,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(84,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(85,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(86,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(87,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(88,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(89,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(90,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(91,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(92,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(93,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL);
+INSERT INTO `civicrm_financial_trxn` (`id`, `from_financial_account_id`, `to_financial_account_id`, `trxn_date`, `total_amount`, `fee_amount`, `net_amount`, `currency`, `is_payment`, `trxn_id`, `trxn_result_code`, `status_id`, `payment_processor_id`, `payment_instrument_id`, `card_type_id`, `check_number`, `pan_truncation`) VALUES (1,NULL,6,'2010-04-11 00:00:00',125.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'1041',NULL),(2,NULL,12,'2010-03-21 00:00:00',50.00,NULL,NULL,'USD',1,'P20901X1',NULL,1,NULL,1,NULL,NULL,NULL),(3,NULL,6,'2010-04-29 00:00:00',25.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'2095',NULL),(4,NULL,6,'2010-04-11 00:00:00',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'10552',NULL),(5,NULL,6,'2010-04-15 00:00:00',500.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'509',NULL),(6,NULL,6,'2010-04-11 00:00:00',175.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,4,NULL,'102',NULL),(7,NULL,12,'2010-03-27 00:00:00',50.00,NULL,NULL,'USD',1,'P20193L2',NULL,1,NULL,1,NULL,NULL,NULL),(8,NULL,12,'2010-03-08 00:00:00',10.00,NULL,NULL,'USD',1,'P40232Y3',NULL,1,NULL,1,NULL,NULL,NULL),(9,NULL,12,'2010-04-22 00:00:00',250.00,NULL,NULL,'USD',1,'P20193L6',NULL,1,NULL,1,NULL,NULL,NULL),(10,NULL,12,'2009-07-01 11:53:50',500.00,NULL,NULL,'USD',1,'PL71',NULL,1,NULL,1,NULL,NULL,NULL),(11,NULL,12,'2009-07-01 12:55:41',200.00,NULL,NULL,'USD',1,'PL43II',NULL,1,NULL,1,NULL,NULL,NULL),(12,NULL,12,'2009-10-01 11:53:50',200.00,NULL,NULL,'USD',1,'PL32I',NULL,1,NULL,1,NULL,NULL,NULL),(13,NULL,12,'2009-12-01 12:55:41',200.00,NULL,NULL,'USD',1,'PL32II',NULL,1,NULL,1,NULL,NULL,NULL),(14,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(15,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(16,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(17,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(18,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(19,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(20,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(21,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(22,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(23,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(24,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(25,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(26,NULL,12,'2017-04-16 14:13:14',100.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(27,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(28,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(29,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(30,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(31,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(32,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(33,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(34,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(35,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(36,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(37,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(38,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(39,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(40,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(41,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(42,NULL,12,'2017-04-16 14:13:14',1200.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(43,NULL,12,'2017-04-16 14:13:14',1200.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(44,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(45,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(46,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(47,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(48,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(49,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(50,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(51,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(52,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(53,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(54,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(55,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(56,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(57,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(58,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(59,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(60,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(61,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(62,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(63,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(64,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(65,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(66,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(67,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(68,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(69,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(70,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(71,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(72,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(73,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(74,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(75,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(76,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(77,NULL,12,'2017-04-16 14:13:14',800.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(78,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(79,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(80,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(81,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(82,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(83,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(84,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(85,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(86,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(87,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(88,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(89,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(90,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(91,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(92,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL),(93,NULL,12,'2017-04-16 14:13:14',50.00,NULL,NULL,'USD',1,NULL,NULL,1,NULL,1,NULL,NULL,NULL);
 /*!40000 ALTER TABLE `civicrm_financial_trxn` ENABLE KEYS */;
 UNLOCK TABLES;
 
index 1646f2accd60419e50ff9177c7203cec21ec4856..f58f79590c0ddfe96336b522bc2ea66d3a115357 100644 (file)
                 <p class="description">{ts}If enabled, CiviCRM sends PDF receipt as an attachment during event signup or online contribution.{/ts}</p>
             </td>
         </tr>
+        <tr class="crm-miscellaneous-form-block-recordGeneratedLetters">
+            <td class="label">{$form.recordGeneratedLetters.label}</td>
+            <td>{$form.recordGeneratedLetters.html}<br />
+                <p class="description">{ts}When generating a letter (PDF/Word) via mail-merge, how should the letter be recorded?{/ts}</p>
+            </td>
+        </tr>
         <tr class="crm-miscellaneous-form-block-wkhtmltopdfPath">
             <td class="label">{$form.wkhtmltopdfPath.label}</td>
             <td>{$form.wkhtmltopdfPath.html}<br />
index f1bd95f629d20a82254c8a77581fb3a06705ced3..2e601e47a0b4bc9028bdc4ecf2416e75442c4989 100644 (file)
@@ -47,9 +47,9 @@
       {$form.contribution_check_number.label} <br />
       {$form.contribution_check_number.html}
     </div>
-    <div class="float-left" id="financial_trxn_card_type_wrapper">
-      {$form.financial_trxn_card_type.label} <br />
-      {$form.financial_trxn_card_type.html}
+    <div class="float-left" id="financial_trxn_card_type_id_wrapper">
+      {$form.financial_trxn_card_type_id.label} <br />
+      {$form.financial_trxn_card_type_id.html}
     </div>
     <div class="float-left" id="pan_truncation_wrapper">
       {$form.financial_trxn_pan_truncation.label} <br />
index fc31df0c59ba42b339a3ed8392aa5a0bc895cfa2..4a042bc11efd15a716b951192872e9a68e330079 100644 (file)
@@ -64,8 +64,8 @@
     <table class="report-layout display">
       <tr>
         <th class="statistics" scope="row"></th>
-        <th class="statistics right" scope="row">Count</th>
-        <th class="statistics right" scope="row">Amount</th>
+        <th class="statistics right" scope="row">{ts}Count{/ts}</th>
+        <th class="statistics right" scope="row">{ts}Amount{/ts}</th>
       </tr>
         {foreach from=$totalStatistics.total_statistics key=key item=val}
            <tr>
@@ -83,8 +83,8 @@
       {foreach from=$grantStatistics item=values key=key}
        <tr>
          <th class="statistics" scope="row">{$values.title}</th>
-         <th class="statistics right" scope="row">Number of Grants (%)</th>
-         <th class="statistics right" scope="row">Total Amount (%)</th>
+         <th class="statistics right" scope="row">{ts}Number of Grants (%){/ts}</th>
+         <th class="statistics right" scope="row">{ts}Total Amount (%){/ts}</th>
        </tr>
          {foreach from=$values.value item=row key=field}
            <tr>
index 3571b7ec070a346221c5d391cda17fc80aef0955..5f9095e5ab9cf73fe3de68c1306da38937779c97 100644 (file)
@@ -84,7 +84,8 @@ class CRM_Contact_Form_Task_PrintDocumentTest extends CiviUnitTestCase {
       $html[] = CRM_Utils_Token::replaceContactTokens($html_message, $contact[$contactId], TRUE, $messageToken);
     }
 
-    $returnContent = CRM_Utils_PDF_Document::printDocuments($formValues['document_file_path'], $html, $type, $zip, TRUE);
+    $fileName = pathinfo($formValues['document_file_path'], PATHINFO_FILENAME) . '.' . $type;
+    $returnContent = CRM_Utils_PDF_Document::printDocuments($html, $fileName, $type, $zip, TRUE);
     $returnContent = strip_tags($returnContent);
 
     $this->assertTrue(strpos($returnContent, 'Hello Antonia D`souza') !== 0);
index 5fdf40cebc9eec5047369d57779fd73fdcca9ded..aa354f26f794f300bb0f61a3f7b3db8cb9fa1dd9 100644 (file)
@@ -188,13 +188,13 @@ class CRM_Core_BAO_FinancialTrxnTest extends CiviUnitTestCase {
       'FinancialTrxn',
       array(
         'id' => $lastFinancialTrxnId['financialTrxnId'],
-        'return' => array('card_type', 'pan_truncation'),
+        'return' => array('card_type_id', 'pan_truncation'),
       )
     );
-    $this->assertEquals(CRM_Utils_Array::value('card_type', $financialTrxn), NULL);
+    $this->assertEquals(CRM_Utils_Array::value('card_type_id', $financialTrxn), NULL);
     $this->assertEquals(CRM_Utils_Array::value('pan_truncation', $financialTrxn), NULL);
     $params = array(
-      'card_type' => 2,
+      'card_type_id' => 2,
       'pan_truncation' => 4567,
       'id' => $contribution->id,
     );
@@ -203,10 +203,10 @@ class CRM_Core_BAO_FinancialTrxnTest extends CiviUnitTestCase {
       'FinancialTrxn',
       array(
         'id' => $lastFinancialTrxnId['financialTrxnId'],
-        'return' => array('card_type', 'pan_truncation'),
+        'return' => array('card_type_id', 'pan_truncation'),
       )
     );
-    $this->assertEquals($financialTrxn['card_type'], 2);
+    $this->assertEquals($financialTrxn['card_type_id'], 2);
     $this->assertEquals($financialTrxn['pan_truncation'], 4567);
   }
 
@@ -227,20 +227,20 @@ class CRM_Core_BAO_FinancialTrxnTest extends CiviUnitTestCase {
       'FinancialTrxn',
       array(
         'id' => $lastFinancialTrxnId['financialTrxnId'],
-        'return' => array('card_type', 'pan_truncation'),
+        'return' => array('card_type_id', 'pan_truncation'),
       )
     );
-    $this->assertEquals(CRM_Utils_Array::value('card_type', $financialTrxn), NULL);
+    $this->assertEquals(CRM_Utils_Array::value('card_type_id', $financialTrxn), NULL);
     $this->assertEquals(CRM_Utils_Array::value('pan_truncation', $financialTrxn), NULL);
     CRM_Core_BAO_FinancialTrxn::updateCreditCardDetails($contribution->id, 4567, 2);
     $financialTrxn = $this->callAPISuccessGetSingle(
       'FinancialTrxn',
       array(
         'id' => $lastFinancialTrxnId['financialTrxnId'],
-        'return' => array('card_type', 'pan_truncation'),
+        'return' => array('card_type_id', 'pan_truncation'),
       )
     );
-    $this->assertEquals($financialTrxn['card_type'], 2);
+    $this->assertEquals($financialTrxn['card_type_id'], 2);
     $this->assertEquals($financialTrxn['pan_truncation'], 4567);
   }
 
index 84deead46d0419b5e7bd651e5b38c681df374609..cab63a2707f30a89cb04456734a40d7136433123 100644 (file)
     <add>4.3</add>
   </index>
   <field>
-    <name>card_type</name>
-    <uniqueName>financial_trxn_card_type</uniqueName>
-    <title>Card Type</title>
+    <name>card_type_id</name>
+    <uniqueName>financial_trxn_card_type_id</uniqueName>
+    <title>Card Type ID</title>
     <type>int unsigned</type>
     <comment>FK to accept_creditcard option group values</comment>
     <pseudoconstant>