CRM add remaining missing comment blocks (autogenerated)
[civicrm-core.git] / CRM / Financial / BAO / ExportFormat.php
index 399261954ca6689f875628f49ebe9d310215ad84..d6105f9dde414f1c27c76cc996afdd069591044a 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                             |
+ | CiviCRM version 4.5                                             |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -61,11 +61,19 @@ class CRM_Financial_BAO_ExportFormat {
   }
 
   // Override to assemble the appropriate subset of financial data for the specific export format
+  /**
+   * @param $exportParams
+   *
+   * @return mixed
+   */
   function export($exportParams) {
     $this->_exportParams = $exportParams;
     return $exportParams;
   }
 
+  /**
+   * @param null $fileName
+   */
   function output($fileName = NULL) {
     switch ($this->getFileExtension()) {
       case 'csv':
@@ -73,7 +81,7 @@ class CRM_Financial_BAO_ExportFormat {
       break;
 
       case 'iif':
-        $tplFile = $this->getTemplateFileName();
+        $tplFile = $this->getHookedTemplateFileName();
         $out = self::getTemplate()->fetch($tplFile);
         $fileName = $this->putFile($out);
         self::createActivityExport($this->_batchIds, $fileName);
@@ -81,23 +89,39 @@ class CRM_Financial_BAO_ExportFormat {
     }
   }
 
+  /**
+   * @return string
+   */
   function getMimeType() {
     return 'text/plain';
   }
 
+  /**
+   * @return string
+   */
   function getFileExtension() {
     return 'txt';
   }
 
   // Override this if appropriate
+  /**
+   * @return null
+   */
   function getTemplateFileName() {
     return null;
   }
 
+  /**
+   * @return object
+   */
   static function &getTemplate() {
     return self::$_template;
   }
 
+  /**
+   * @param $var
+   * @param null $value
+   */
   function assign($var, $value = NULL) {
     self::$_template->assign($var, $value);
   }
@@ -108,6 +132,12 @@ class CRM_Financial_BAO_ExportFormat {
    * Depending on the output format might want to override this, e.g. for IIF tabs need to be escaped etc,
    * but for CSV it doesn't make sense because php has built in csv output functions.
    */
+  /**
+   * @param $s
+   * @param string $type
+   *
+   * @return null
+   */
   static function format($s, $type = 'string') {
     if (!empty($s)) {
       return $s;
@@ -145,6 +175,12 @@ class CRM_Financial_BAO_ExportFormat {
     }
   }
 
+  /**
+   * @param $batchIds
+   * @param $fileName
+   *
+   * @throws CRM_Core_Exception
+   */
   static function createActivityExport($batchIds, $fileName) {
     $session = CRM_Core_Session::singleton();
     $values = array();
@@ -160,10 +196,10 @@ class CRM_Financial_BAO_ExportFormat {
     }
     $details = '<p>' . ts('Record: ') . $values['title'] . '</p><p>' . ts('Description: ') . '</p><p>' . ts('Created By: ') . $createdBy . '</p><p>' . ts('Created Date: ') . $values['created_date'] . '</p><p>' . ts('Last Modified By: ') . $modifiedBy . '</p><p>' . ts('Payment Instrument: ') . $values['payment_instrument_id'] . '</p>';
     $subject = '';
-    if (CRM_Utils_Array::value('total', $values)) {
+    if (!empty($values['total'])) {
       $subject .= ts('Total') . '['. CRM_Utils_Money::format($values['total']) .'],';
     }
-    if (CRM_Utils_Array::value('item_count', $values)) {
+    if (!empty($values['item_count'])) {
       $subject .= ' ' . ts('Count') . '['. $values['item_count'] .'],';
     }
 
@@ -190,6 +226,13 @@ class CRM_Financial_BAO_ExportFormat {
     CRM_Activity_BAO_Activity::create($activityParams);
   }
 
+  /**
+   * @param array $files
+   * @param null $destination
+   * @param bool $overwrite
+   *
+   * @return bool
+   */
   function createZip($files = array(), $destination = NULL, $overwrite = FALSE) {
     //if the zip file already exists and overwrite is false, return false
     if (file_exists($destination) && !$overwrite) {
@@ -219,4 +262,4 @@ class CRM_Financial_BAO_ExportFormat {
         return FALSE;
       }
   }
-}
\ No newline at end of file
+}