);
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 *
}
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;
* @var string
*/
public $entity_table;
+ /**
+ *
+ * @var boolean
+ */
+ public $mode;
/**
* class constructor
*
'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',
) ,
);
}
'parent_id' => 'parent_id',
'entity_id' => 'entity_id',
'entity_table' => 'entity_table',
+ 'mode' => 'mode',
);
}
return self::$_fieldKeys;
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';
}
<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>
}
}
});
- 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}
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,
<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>