CRM-13142 limited tidy up to extract js from tpl using new standards (I have complete...
authoreileen <eileen@fuzion.co.nz>
Wed, 31 Jul 2013 23:49:14 +0000 (11:49 +1200)
committereileen <eileen@fuzion.co.nz>
Wed, 31 Jul 2013 23:49:14 +0000 (11:49 +1200)
CRM/Batch/Form/Entry.php
templates/CRM/Batch/Form/Entry.tpl

index 36586acd45c266bb6ab6434512365a8dcc0f9670..8c5efd085bd18b8ce24ac49b3d7a9a14ee157ac9 100644 (file)
@@ -106,6 +106,8 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
       // get the profile id associted with this batch type
       $this->_profileId = CRM_Batch_BAO_Batch::getProfileId($this->_batchInfo['type_id']);
     }
+    CRM_Core_Resources::singleton()
+    ->addSetting(array('batch' => array('type_id' => $this->_batchInfo['type_id'])));
   }
 
   /**
index d3639aa1072d2bacac3ac78d9a6a40f3d2f7f17a..29c8527e05c2c8f0e676f8b024e5a620adacf053 100644 (file)
 cj(function () {
   cj('.selector-rows').change(function () {
     var options = {
-      'url': {/literal}"{crmURL p='civicrm/ajax/batch' h=0}"{literal}
+      'url': CRM.url('civicrm/ajax/batch')
     };
 
     cj("#Entry").ajaxSubmit(options);
@@ -132,21 +132,22 @@ cj(function () {
     calculateActualTotal();
   });
 
-  {/literal}{if $batchType eq 1 }{literal}
-  // hide all dates if send receipt is checked
-  hideSendReceipt();
+  if (CRM.batch.type_id == 1) {
+    // hide all dates if send receipt is checked
+    hideSendReceipt();
 
-  // hide the receipt date if send receipt is checked
-  cj('input[id*="][send_receipt]"]').change(function () {
-    showHideReceipt(cj(this));
-  });
+    // hide the receipt date if send receipt is checked
+    cj('input[id*="][send_receipt]"]').change(function () {
+      showHideReceipt(cj(this));
+    });
 
-  {/literal}{else}{literal}
-  cj('select[id^="member_option_"]').each(function () {
-    if (cj(this).val() == 1) {
-      cj(this).attr('disabled', true);
-    }
-  });
+  }
+  else{
+    cj('select[id^="member_option_"]').each(function () {
+      if (cj(this).val() == 1) {
+        cj(this).attr('disabled', true);
+      }
+    });
 
   // set payment info accord to membership type
   cj('select[id*="_membership_type_0"]').change(function () {
@@ -157,7 +158,7 @@ cj(function () {
     setPaymentBlock(cj(this), cj(this).val());
   });
 
-  {/literal}{/if}{literal}
+  }
 
   // line breaks between radio buttons and checkboxes
   cj('input.form-radio').next().after('<br />');
@@ -170,7 +171,7 @@ cj(function () {
 
 function setPaymentBlock(form, memType) {
   var rowID = form.closest('div.crm-grid-row').attr('entity_id');
-  var dataUrl = {/literal}"{crmURL p='civicrm/ajax/memType' h=0}"{literal};
+  var dataUrl = CRM.url('civicrm/ajax/memType');
 
   if (!memType) {
     memType = cj('select[id="field_' + rowID + '_membership_type_1"]').val();
@@ -321,7 +322,7 @@ function updateContactInfo(blockNo, prefix) {
 
       // for membership batch entry based on contact we need to enable / disable
       // add membership select
-      {/literal}{if $batchType eq 2}{literal}
+      if(CRM.batch.type_id == 2) {
       CRM.api('Membership', 'get', {
           'sequential': '1',
           'contact_id': contactId,
@@ -346,7 +347,7 @@ function updateContactInfo(blockNo, prefix) {
           }
         }
         });
-      {/literal}{/if}{literal}
+      }
     }
     });
 }