INFRA-132 - CRM/Batch - phpcbf
authorTim Otten <totten@civicrm.org>
Tue, 6 Jan 2015 21:09:19 +0000 (13:09 -0800)
committerTim Otten <totten@civicrm.org>
Tue, 6 Jan 2015 23:04:25 +0000 (15:04 -0800)
CRM/Batch/BAO/Batch.php
CRM/Batch/Form/Batch.php
CRM/Batch/Form/Entry.php
CRM/Batch/Page/AJAX.php
CRM/Batch/Page/Batch.php

index 863db0b3ebfc1eebd8b3e7728ca01f9794921d26..bd9840fcdb8625b48c1223a289cb6dd8fbc6947f 100755 (executable)
@@ -176,7 +176,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
     $batch = new CRM_Batch_DAO_Batch();
     $batch->id = $batchId;
     $batch->delete();
-    return true;
+    return TRUE;
   }
 
   /**
@@ -198,7 +198,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
 
     // get batch totals for open batches
     $fetchTotals = array();
-    $batchStatus =  CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id', array('labelColumn' => 'name'));
+    $batchStatus = CRM_Core_PseudoConstant::get('CRM_Batch_DAO_Batch', 'status_id', array('labelColumn' => 'name'));
     $batchStatus = array(
       array_search('Open', $batchStatus),
       array_search('Reopened', $batchStatus),
@@ -311,9 +311,11 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
           case 'Open':
             CRM_Utils_Array::remove($newLinks, 'reopen', 'download');
             break;
+
           case 'Closed':
             CRM_Utils_Array::remove($newLinks, 'close', 'edit', 'download');
             break;
+
           case 'Exported':
             CRM_Utils_Array::remove($newLinks, 'close', 'edit', 'reopen', 'export');
         }
@@ -329,7 +331,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
       }
       $tokens = array('id' => $object->id, 'status' => $values['status_id']);
       if ($values['status_id'] == array_search('Exported', $batchStatusByName)) {
-        $aid = CRM_Core_OptionGroup::getValue('activity_type','Export Accounting Batch');
+        $aid = CRM_Core_OptionGroup::getValue('activity_type', 'Export Accounting Batch');
         $activityParams = array('source_record_id' => $object->id, 'activity_type_id' => $aid);
         $exportActivity = CRM_Activity_BAO_Activity::retrieve($activityParams, $val);
         $fid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $exportActivity->id, 'file_id', 'entity_id');
@@ -426,37 +428,37 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
   public function links($context = NULL) {
     if ($context == 'financialBatch') {
       $links = array(
-        'transaction' =>  array(
+        'transaction' => array(
           'name'  => ts('Transactions'),
           'url'   => 'civicrm/batchtransaction',
           'qs'    => 'reset=1&bid=%%id%%',
           'title' => ts('View/Add Transactions to Batch'),
         ),
-        'edit' =>    array(
+        'edit' => array(
           'name'  => ts('Edit'),
           'url'   => 'civicrm/financial/batch',
           'qs'    => 'reset=1&action=update&id=%%id%%&context=1',
           'title' => ts('Edit Batch'),
         ),
-        'close' =>   array(
+        'close' => array(
           'name'  => ts('Close'),
           'title' => ts('Close Batch'),
           'url'   => '#',
           'extra' => 'rel="close"',
         ),
-        'export' =>  array(
+        'export' => array(
           'name'  => ts('Export'),
           'title' => ts('Export Batch'),
           'url'   => '#',
           'extra' => 'rel="export"',
         ),
-        'reopen' =>  array(
+        'reopen' => array(
           'name'  => ts('Re-open'),
           'title' => ts('Re-open Batch'),
           'url'   => '#',
           'extra' => 'rel="reopen"',
         ),
-        'delete' =>  array(
+        'delete' => array(
           'name'  => ts('Delete'),
           'title' => ts('Delete Batch'),
           'url'   => '#',
@@ -502,7 +504,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
    * excluding batches with data entry in progress
    */
   public static function getBatches() {
-    $dataEntryStatusId = CRM_Core_OptionGroup::getValue('batch_status','Data Entry', 'name');
+    $dataEntryStatusId = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     $query = "SELECT id, title
       FROM civicrm_batch
       WHERE item_count >= 1
@@ -627,7 +629,7 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch {
       $params['id'] = $ids['batchID'] = $value;
       self::create($params, $ids);
     }
-    $url = CRM_Utils_System::url('civicrm/financial/financialbatches',"reset=1&batchStatus={$params['status_id']}");
+    $url = CRM_Utils_System::url('civicrm/financial/financialbatches', "reset=1&batchStatus={$params['status_id']}");
     CRM_Utils_System::redirect($url);
   }
 
@@ -725,7 +727,7 @@ LEFT JOIN civicrm_contribution_soft ON civicrm_contribution_soft.contribution_id
         $query = new CRM_Contact_BAO_Query($searchParams,
           CRM_Contribute_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_CONTRIBUTE,
             FALSE
-          ),NULL, FALSE, FALSE,CRM_Contact_BAO_Query::MODE_CONTRIBUTE
+          ), NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE
         );
         if ($field == 'contribution_date_high' || $field == 'contribution_date_low') {
           $query->dateQueryBuilder($params[$field], 'civicrm_contribution', 'contribution_date', 'receive_date', 'Contribution Date');
@@ -744,7 +746,7 @@ LEFT JOIN civicrm_contribution_soft ON civicrm_contribution_soft.contribution_id
 
     if (!$searchValue) {
       if (!$notPresent) {
-        $where =  " ( civicrm_entity_batch.batch_id = {$entityID}
+        $where = " ( civicrm_entity_batch.batch_id = {$entityID}
         AND civicrm_entity_batch.entity_table = 'civicrm_financial_trxn'
         AND civicrm_entity_financial_trxn.entity_table = 'civicrm_contribution') ";
       }
index ffe7bffdb09541a13fb92214433f7eb0ff577cdc..498bef783a803f3bd88ea0e325db37476d6f5a5c 100755 (executable)
@@ -118,7 +118,7 @@ class CRM_Batch_Form_Batch extends CRM_Admin_Form {
     }
 
     // always create with data entry status
-    $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status','Data Entry', 'name');
+    $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     $batch = CRM_Batch_BAO_Batch::create($params);
 
     // redirect to batch entry page.
index 395185feca59e4337528fbee1854c2000cb62321..34b3110d2d9553c815c020b6350c1ff30a52b8a0 100755 (executable)
@@ -65,7 +65,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
   public $_params;
 
-  public $_membershipId = null;
+  public $_membershipId = NULL;
   /**
    * When not to reset sort_name
    */
@@ -126,20 +126,20 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
     $this->addElement('hidden', 'batch_id', $this->_batchId);
 
-    $batchTypes = CRM_Core_Pseudoconstant::get('CRM_Batch_DAO_Batch', 'type_id',array('flip' => 1), 'validate');
+    $batchTypes = CRM_Core_Pseudoconstant::get('CRM_Batch_DAO_Batch', 'type_id', array('flip' => 1), 'validate');
     // get the profile information
     if ($this->_batchInfo['type_id'] == $batchTypes['Contribution']) {
       CRM_Utils_System::setTitle(ts('Batch Data Entry for Contributions'));
       $customFields = CRM_Core_BAO_CustomField::getFields('Contribution');
     }
-   elseif ($this->_batchInfo['type_id'] == $batchTypes['Membership']) {
+    elseif ($this->_batchInfo['type_id'] == $batchTypes['Membership']) {
       CRM_Utils_System::setTitle(ts('Batch Data Entry for Memberships'));
       $customFields = CRM_Core_BAO_CustomField::getFields('Membership');
     }
-   elseif ($this->_batchInfo['type_id'] == $batchTypes['Pledge Payment']) {
-     CRM_Utils_System::setTitle(ts('Batch Data Entry for Pledge Payments'));
-     $customFields = CRM_Core_BAO_CustomField::getFields('Contribution');
-   }
+    elseif ($this->_batchInfo['type_id'] == $batchTypes['Pledge Payment']) {
+      CRM_Utils_System::setTitle(ts('Batch Data Entry for Pledge Payments'));
+      $customFields = CRM_Core_BAO_CustomField::getFields('Contribution');
+    }
     $this->_fields = array();
     $this->_fields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, CRM_Core_Action::VIEW);
 
@@ -209,7 +209,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         $this->add('select', "member_option[$rowNumber]", '', $options);
       }
       if ($this->_batchInfo['type_id'] == $batchTypes['Pledge Payment']) {
-        $options =  array('' => '-select-');
+        $options = array('' => '-select-');
         $optionTypes = array(
           '1' => ts('Adjust Pledge Payment Schedule?'),
           '2' => ts('Adjust Total Pledge Amount?'),
@@ -227,7 +227,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         }
 
         $this->add('select', "open_pledges[$rowNumber]", '', $options);
-     }
+      }
 
       foreach ($this->_fields as $name => $field) {
         if (in_array($field['field_type'], $contactTypes)) {
@@ -244,7 +244,8 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
     $this->assign('fields', $this->_fields);
     CRM_Core_Resources::singleton()
-    ->addSetting(array('contact' => array(
+    ->addSetting(array(
+    'contact' => array(
       'return' => implode(',', $contactReturnProperties),
       'fieldmap' => array_flip($contactReturnProperties),
     )));
@@ -490,7 +491,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         $value['skipRecentView'] = TRUE;
 
         // build line item params
-        $this->_priceSet['fields'][$priceFieldID]['options'][$priceFieldValueID ]['amount'] =  $value['total_amount'];
+        $this->_priceSet['fields'][$priceFieldID]['options'][$priceFieldValueID]['amount'] = $value['total_amount'];
         $value['price_'. $priceFieldID] = 1;
 
         $lineItem = array();
@@ -563,12 +564,12 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
         //send receipt mail.
         if ($contribution->id && !empty($value['send_receipt'])) {
-            // add the domain email id
-            $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
-            $domainEmail = "$domainEmail[0] <$domainEmail[1]>";
-            $value['from_email_address'] = $domainEmail;
-            $value['contribution_id'] = $contribution->id;
-            CRM_Contribute_Form_AdditionalInfo::emailReceipt( $this, $value );
+          // add the domain email id
+          $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
+          $domainEmail = "$domainEmail[0] <$domainEmail[1]>";
+          $value['from_email_address'] = $domainEmail;
+          $value['contribution_id'] = $contribution->id;
+          CRM_Contribute_Form_AdditionalInfo::emailReceipt( $this, $value );
         }
       }
     }
@@ -697,7 +698,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         }
 
         if (!empty($value['receive_date'])) {
-          $value['receive_date'] = CRM_Utils_Date::processDate( $value['receive_date'], $value['receive_date_time'] , TRUE );
+          $value['receive_date'] = CRM_Utils_Date::processDate( $value['receive_date'], $value['receive_date_time'], TRUE );
         }
 
         $params['actualBatchTotal'] += $value['total_amount'];
@@ -761,10 +762,10 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         unset($value['membership_start_date']);
         unset($value['membership_end_date']);
 
-        $value['is_renew'] = false;
+        $value['is_renew'] = FALSE;
         if (!empty($params['member_option']) && CRM_Utils_Array::value( $key, $params['member_option'] ) == 2 ) {
           $this->_params = $params;
-          $value['is_renew'] = true;
+          $value['is_renew'] = TRUE;
           $membership = CRM_Member_BAO_Membership::renewMembershipFormWrapper(
             $value['contact_id'],
             $value['membership_type_id'],
@@ -804,14 +805,14 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
         //send receipt mail.
         if ( $membership->id && !empty($value['send_receipt'])) {
 
-            // add the domain email id
-            $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
-            $domainEmail = "$domainEmail[0] <$domainEmail[1]>";
+          // add the domain email id
+          $domainEmail = CRM_Core_BAO_Domain::getNameAndEmail();
+          $domainEmail = "$domainEmail[0] <$domainEmail[1]>";
 
-            $value['from_email_address'] = $domainEmail;
-            $value['membership_id']      = $membership->id;
-            $value['contribution_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $membership->id, 'contribution_id', 'membership_id');
-            CRM_Member_Form_Membership::emailReceipt( $this, $value, $membership );
+          $value['from_email_address'] = $domainEmail;
+          $value['membership_id']      = $membership->id;
+          $value['contribution_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipPayment', $membership->id, 'contribution_id', 'membership_id');
+          CRM_Member_Form_Membership::emailReceipt( $this, $value, $membership );
         }
       }
     }
index 7003a7148cdfd7bb87fc55e3b2124958946d6710..57d01df038de202400105534a52f25d9821faf54 100644 (file)
@@ -70,9 +70,7 @@ class CRM_Batch_Page_AJAX {
     $rowCount  =
       isset($_REQUEST['iDisplayLength']) ? CRM_Utils_Type::escape($_REQUEST['iDisplayLength'], 'Integer') : 25;
     $sort      =
-      isset($_REQUEST['iSortCol_0']) ?
-      CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) :
-      NULL;
+      isset($_REQUEST['iSortCol_0']) ? CRM_Utils_Array::value(CRM_Utils_Type::escape($_REQUEST['iSortCol_0'], 'Integer'), $sortMapper) : NULL;
     $sortOrder =
       isset($_REQUEST['sSortDir_0']) ? CRM_Utils_Type::escape($_REQUEST['sSortDir_0'], 'String') : 'asc';
     $context   =
@@ -88,7 +86,7 @@ class CRM_Batch_Page_AJAX {
 
     if ($context != 'financialBatch') {
       // data entry status batches
-      $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status','Data Entry', 'name');
+      $params['status_id'] = CRM_Core_OptionGroup::getValue('batch_status', 'Data Entry', 'name');
     }
 
     $params['context'] = $context;
index a4ff19fa38d8218c786e0fac2c03d73725945fbf..4684cd5e233917ea25f2fea9250c4864f6626a8b 100644 (file)
@@ -60,7 +60,8 @@ class CRM_Batch_Page_Batch extends CRM_Core_Page_Basic {
    *
    * @return array (reference) of action links
    */
-  public function &links() {}
+  public function &links() {
+  }
 
   /**
    * Get name of edit form
@@ -103,8 +104,7 @@ class CRM_Batch_Page_Batch extends CRM_Core_Page_Basic {
   }
 
   public function search() {
-    if ($this->_action &
-      (CRM_Core_Action::ADD |
+    if ($this->_action & (CRM_Core_Action::ADD |
         CRM_Core_Action::UPDATE |
         CRM_Core_Action::DELETE
       )