CRM-13066, update the code accord to schema changes
authorkurund <kurund@civicrm.org>
Thu, 29 Aug 2013 13:25:34 +0000 (18:55 +0530)
committerkurund <kurund@civicrm.org>
Thu, 29 Aug 2013 13:25:34 +0000 (18:55 +0530)
----------------------------------------
* CRM-13066: 'Clean up Caches' deletes in progress batches
  http://issues.civicrm.org/jira/browse/CRM-13066

CRM/Batch/Form/Entry.php
CRM/Batch/Page/AJAX.php

index 78ca7157408297983750d43c946c570e162335a3..cfedc822fd33ec600fb047f46e836361a1b9012b 100644 (file)
@@ -337,10 +337,11 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
       }
     }
     else {
-      // get the existing batch values from cache table
-      $cacheKeyString = CRM_Batch_BAO_Batch::getCacheKeyForBatch($this->_batchId);
-      $defaults = CRM_Core_BAO_Cache::getItem('batch entry', $cacheKeyString);
+      // get the cached info from data column of civicrm_batch
+      $data = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', $this->_batchId, 'data');
+      $defaults = json_decode($data, TRUE);
     }
+
     return $defaults;
   }
 
index 6b39b7120b9933a618fe080d5b1df703db051717..f3f6bff75cb48ec47c698d7351015d5dc284fb41 100644 (file)
@@ -42,16 +42,12 @@ class CRM_Batch_Page_AJAX {
    * Save record
    */
   function batchSave() {
-    // save in cache table
+    // save the entered information in 'data' column
     $batchId = CRM_Utils_Type::escape($_POST['batch_id'], 'Positive');
 
-    $cacheKeyString = CRM_Batch_BAO_Batch::getCacheKeyForBatch($batchId);
-
-    // check if we can retrieve from database cache
     unset($_POST['qfKey']);
-    CRM_Core_BAO_Cache::setItem($_POST, 'batch entry', $cacheKeyString);
+    CRM_Core_DAO::setFieldValue('CRM_Batch_DAO_Batch', $batchId, 'data', json_encode($_POST));
 
-    // return true if saved correctly
     CRM_Utils_System::civiExit();
   }