Add invoice number prefix and rename columns
authorGuanhuan Chen <oooomic@gmail.com>
Wed, 3 Jun 2015 14:20:50 +0000 (15:20 +0100)
committerGuanhuan Chen <oooomic@gmail.com>
Wed, 3 Jun 2015 14:20:50 +0000 (15:20 +0100)
CRM/Financial/BAO/ExportFormat/CSV.php

index f8bac88241560825dc7791f5b3c2ff976263e2d5..7bb44d39b3e764d97f7356a2885b1f19c50e7408 100644 (file)
@@ -174,6 +174,9 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
    * @param array $export
    */
   public function makeCSV($export) {
+    // getting data from admin page
+    $prefixValue = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::CONTRIBUTE_PREFERENCES_NAME, 'contribution_invoice_settings');
+
     foreach ($export as $batchId => $dao) {
       $financialItems = array();
       $this->_batchIds = $batchId;
@@ -194,11 +197,13 @@ class CRM_Financial_BAO_ExportFormat_CSV extends CRM_Financial_BAO_ExportFormat
           $creditAccount = $dao->from_credit_account;
         }
 
+        $invoiceNo = CRM_Utils_Array::value('invoice_prefix', $prefixValue) . "" . $dao->contribution_id;
+
         $financialItems[] = array(
           'Batch ID' => $dao->batch_id,
-          'Invoice ID' => $dao->contribution_id,
+          'Invoice No' => $invoiceNo,
           'Contact ID' => $dao->contact_id,
-          'Internal ID' => $dao->financial_trxn_id,
+          'Financial Trxn ID/Internal ID' => $dao->financial_trxn_id,
           'Transaction Date' => $dao->trxn_date,
           'Debit Account' => $dao->to_account_code,
           'Debit Account Name' => $dao->to_account_name,