Commit 9c41fa61 authored by deb.monish's avatar deb.monish

add upgrade code

parent 3c49839d
......@@ -456,6 +456,16 @@ class CRM_Upgrade_Incremental_php_FourSeven extends CRM_Upgrade_Incremental_Base
$this->addTask('Remove broken Contribution_logging reports', 'removeContributionLoggingReports');
}
/**
* Upgrade function.
*
* @param string $rev
*/
public function upgrade_4_7_27($rev) {
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
$this->addTask('CRM-20572: Fix date fields in save search criteria of Contrib Sybunt custom search ', 'fixDateFieldsInSmartGroups');
}
/*
* Important! All upgrade functions MUST add a 'runSql' task.
* Uncomment and use the following template for a new upgrade version
......@@ -1287,4 +1297,22 @@ FROM `civicrm_dashboard_contact` JOIN `civicrm_contact` WHERE civicrm_dashboard_
return $config->imageUploadDir && $config->imageUploadURL && $check->isDirAccessible($config->imageUploadDir, $config->imageUploadURL);
}
/**
* CRM-20572 - Format date fields in Contrib Sybunt custom search's saved criteria.
*
* @param \CRM_Queue_TaskContext $ctx
*
* @return bool
*/
public static function fixDateFieldsInSmartGroups(CRM_Queue_TaskContext $ctx) {
$dao = CRM_Core_DAO::executeQuery("SELECT id, form_values FROM civicrm_saved_search WHERE form_values LIKE '%CRM_Contact_Form_Search_Custom_ContribSYBNT%'");
while ($dao->fetch()) {
$formValues = unserialize($dao->form_values);
CRM_Contact_Form_Search_Custom_ContribSYBNT::formatSavedSearchFields($formValues);
CRM_Core_DAO::executeQuery("UPDATE civicrm_saved_search SET form_values = %1 WHERE id = {$dao->id}", array(1 => array(serialize($formValues), 'String')));
}
return TRUE;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment