1. dao generations fixes 2. cascade-type to mode
authorpriyankakaran26 <priyanka.karan26@gmail.com>
Sun, 7 Sep 2014 15:32:41 +0000 (16:32 +0100)
committerdeepak-srivastava <deepak.srivastava.0303@gmail.com>
Fri, 3 Oct 2014 08:55:16 +0000 (09:55 +0100)
CRM/Core/BAO/RecurringEntity.php
CRM/Core/DAO/RecurringEntity.php
CRM/Core/Page/AJAX/RecurringEntity.php
CRM/Core/xml/Menu/Misc.xml
templates/CRM/Core/Form/RecurringEntity.tpl
templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl
xml/schema/Core/RecurringEntity.xml

index d6edd0528032d89ba2747ddc2c9cac33631801ec..92d5b2fe8194fdd920f7ac9ffd7a93313b32a764 100644 (file)
@@ -92,7 +92,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
     );
 
     if (!$mode) {
-      $mode = CRM_Core_DAO::singleValueQuery("SELECT cascade_type FROM civicrm_recurring_entity WHERE entity_id = %3 AND entity_table = %2", $queryParams);
+      $mode = CRM_Core_DAO::singleValueQuery("SELECT mode FROM civicrm_recurring_entity WHERE entity_id = %3 AND entity_table = %2", $queryParams);
     }
 
     $query = "SELECT *
@@ -168,6 +168,15 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity {
   }
 
   static public function triggerUpdate($obj) {
+    // if DB version is earlier than 4.6 skip any processing
+    static $currentVer = NULL;
+    if (!$currentVer) {
+      $currentVer = CRM_Core_BAO_Domain::version();
+    }
+    if (version_compare($currentVer, '4.6.alpha1') < 0) {
+      return;
+    }
+
     static $processedEntities = array();
     if (empty($obj->id) || empty($obj->__table)) {
       return FALSE;
index bd19e139c49c84f22d97a457e01c483294e50390..812464bba3938425e7d0e10c9e7828718749f4fe 100644 (file)
@@ -108,6 +108,11 @@ class CRM_Core_DAO_RecurringEntity extends CRM_Core_DAO
    * @var string
    */
   public $entity_table;
+  /**
+   *
+   * @var boolean
+   */
+  public $mode;
   /**
    * class constructor
    *
@@ -151,7 +156,15 @@ class CRM_Core_DAO_RecurringEntity extends CRM_Core_DAO
           'type' => CRM_Utils_Type::T_STRING,
           'title' => ts('Entity Table') ,
           'required' => true,
-          'size' => CRM_Utils_Type::TWO,
+          'maxlength' => 64,
+          'size' => CRM_Utils_Type::BIG,
+        ) ,
+        'mode' => array(
+          'name' => 'mode',
+          'type' => CRM_Utils_Type::T_BOOLEAN,
+          'title' => ts('Cascade Type') ,
+          'required' => true,
+          'default' => '1',
         ) ,
       );
     }
@@ -172,6 +185,7 @@ class CRM_Core_DAO_RecurringEntity extends CRM_Core_DAO
         'parent_id' => 'parent_id',
         'entity_id' => 'entity_id',
         'entity_table' => 'entity_table',
+        'mode' => 'mode',
       );
     }
     return self::$_fieldKeys;
index 0c3061008cdbc2d135e3dbb22a023511bc07b779..30fd29dd2de51c0d07bae1a906975cdaaab5f4b6 100644 (file)
 
 class CRM_Core_Page_AJAX_RecurringEntity {
   
-  public static function updateCascadeType(){
-    if(CRM_Utils_Array::value('cascadeType', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST)){
+  public static function updateMode() {
+    if(CRM_Utils_Array::value('mode', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST)){
       $finalResult = array();
-      $cascadeType = CRM_Utils_Type::escape($_REQUEST['cascadeType'], 'Integer');
+      $mode = CRM_Utils_Type::escape($_REQUEST['mode'], 'Integer');
       $entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer');
-      
+
       $sql = "UPDATE
-          civicrm_recurring_entity
-          SET cascade_type = (%1)
-          WHERE entity_id = (%2) AND entity_table = 'civicrm_event'";
+        civicrm_recurring_entity
+        SET mode = %1
+        WHERE entity_id = %2 AND entity_table = 'civicrm_event'";
       $params = array(
-                  1 => array($cascadeType, 'Integer'),          
-                  2 => array($entityId, 'Integer')
-                );
+        1 => array($mode, 'Integer'),          
+        2 => array($entityId, 'Integer')
+      );
       CRM_Core_DAO::executeQuery($sql, $params);
       $finalResult['status'] = 'Done';
     }
index bd681ea47b34fb325bd24d4dc5e69949a5622b4f..670660f0b39ab253ef71ee0340663e6fd3a7ef1b 100644 (file)
     <access_arguments>access CiviCRM</access_arguments>
   </item>
   <item>
-     <path>civicrm/ajax/recurringEntity/update_cascade_type</path>
-     <page_callback>CRM_Core_Page_AJAX_RecurringEntity::updateCascadeType</page_callback>
+     <path>civicrm/ajax/recurringentity/update-mode</path>
+     <page_callback>CRM_Core_Page_AJAX_RecurringEntity::updateMode</page_callback>
      <access_arguments>access CiviCRM,access CiviEvent</access_arguments>
   </item>
   <item>
-     <path>civicrm/ajax/recurringEntity/generate_preview</path>
+     <path>civicrm/ajax/recurringentity/generate-preview</path>
      <page_callback>CRM_Core_Page_AJAX_RecurringEntity::generatePreview</page_callback>
      <access_arguments>access CiviCRM,access CiviEvent</access_arguments>
   </item>
index a471e81d0a1118a6fd7e09538fea5af223f74965..793a9d78d0a1140a0c9cdc2b556c7c9a4fc12d7f 100644 (file)
                 }
             }
         });
-        var ajaxurl = CRM.url("civicrm/ajax/recurringEntity/generate_preview");
+        var ajaxurl = CRM.url("civicrm/ajax/recurringentity/generate-preview");
         var eventID = {/literal}{$currentEntityId}{literal};
         if(eventID != ""){
             ajaxurl += "?event_id="+eventID;
         }
     }
 </script>
-{/literal}  
\ No newline at end of file
+{/literal}  
index 22bb92ff37829ffb4bd4aefe09d2c2973034538a..dd2fe864fd39ab6841f059da696b312291072eba 100644 (file)
@@ -97,8 +97,8 @@
     function updateMode(mode) {
       var eventID = {/literal}{$id}{literal};
       if (eventID != "" && mode) {
-        var ajaxurl = CRM.url("civicrm/ajax/recurringEntity/update_cascade_type");
-        var data    = {cascadeType: mode, entityId: eventID};
+        var ajaxurl = CRM.url("civicrm/ajax/recurringentity/update-mode");
+        var data    = {mode: mode, entityId: eventID};
         $.ajax({
           dataType: "json",
           data: data,
index 1448925a3a55a5f23068af96828b2fa2bf31dec2..6d6b460af623a0661dfb4ce2dd61d1ca0f518aab 100644 (file)
       <add>4.6</add>
   </field>
   <field>
-      <name>cascade_type</name>
-      <type>tinyint unsigned</type>
+      <name>mode</name>
+      <type>boolean</type>
       <default>1</default>
-      <length>4</length>
       <title>Cascade Type</title>
       <required>true</required>
       <add>4.6</add>
   </field>
-</table>
\ No newline at end of file
+</table>