From 390a2f4b4dce6a02424bd4a6990f4d7b9560ecf3 Mon Sep 17 00:00:00 2001 From: colemanw Date: Wed, 19 Jul 2023 14:07:10 -0400 Subject: [PATCH] Job - uppercase api entity --- CRM/Admin/Form/Job.php | 6 ++-- .../Incremental/sql/5.65.alpha1.mysql.tpl | 3 ++ sql/civicrm_data/civicrm_job.sqldata.php | 34 +++++++++---------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/CRM/Admin/Form/Job.php b/CRM/Admin/Form/Job.php index 9c962aa053..78583aec7f 100644 --- a/CRM/Admin/Form/Job.php +++ b/CRM/Admin/Form/Job.php @@ -195,11 +195,9 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form { $defaults['scheduled_run_date'] = date("Y-m-d H:i:s", $ts); } - // CRM-10708 - // job entity thats shipped with core is all lower case. - // this makes sure camel casing is followed for proper working of default population. + // Legacy data might use lowercase api entity name, but it should always be CamelCase if (!empty($defaults['api_entity'])) { - $defaults['api_entity'] = ucfirst($defaults['api_entity']); + $defaults['api_entity'] = CRM_Utils_String::convertStringToCamel($defaults['api_entity']); } return $defaults; diff --git a/CRM/Upgrade/Incremental/sql/5.65.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.65.alpha1.mysql.tpl index 7b22176538..ca22e0fdbc 100644 --- a/CRM/Upgrade/Incremental/sql/5.65.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/5.65.alpha1.mysql.tpl @@ -3,6 +3,9 @@ -- Ensure new name field is not null/unique. Setting to ID is a bit lazy - but it works. UPDATE civicrm_group SET `name` = `id` WHERE name IS NULL; +-- Ensure API entity names always start with uppercase +UPDATE `civicrm_job` SET `api_entity` = CONCAT(UPPER(SUBSTRING(`api_entity`, 1 ,1)), SUBSTRING(`api_entity`, 2)); + -- Add name field, make frontend_title required (in conjunction with php function) {if $multilingual} {foreach from=$locales item=locale} diff --git a/sql/civicrm_data/civicrm_job.sqldata.php b/sql/civicrm_data/civicrm_job.sqldata.php index 5fbce16e0c..f3af14cddc 100644 --- a/sql/civicrm_data/civicrm_job.sqldata.php +++ b/sql/civicrm_data/civicrm_job.sqldata.php @@ -13,7 +13,7 @@ return CRM_Core_CodeGen_SqlData::create('civicrm_job') 'name' => 'CiviCRM Update Check', 'description' => 'Checks for CiviCRM version updates. Important for keeping the database secure. Also sends anonymous usage statistics to civicrm.org to to assist in prioritizing ongoing development efforts.', // FIXME: "to to" - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'version_check', 'is_active' => 1, ], @@ -21,28 +21,28 @@ return CRM_Core_CodeGen_SqlData::create('civicrm_job') 'run_frequency' => 'Always', 'name' => 'Send Scheduled Mailings', 'description' => 'Sends out scheduled CiviMail mailings', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'process_mailing', ], [ 'run_frequency' => 'Hourly', 'name' => 'Fetch Bounces', 'description' => 'Fetches bounces from mailings and writes them to mailing statistics', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'fetch_bounces', ], [ 'run_frequency' => 'Hourly', 'name' => 'Process Inbound Emails', 'description' => 'Inserts activity for a contact or a case by retrieving inbound emails from a mail directory', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'fetch_activities', ], [ 'run_frequency' => 'Daily', 'name' => 'Process Pledges', 'description' => 'Updates pledge records and sends out reminders', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'process_pledge', 'parameters' => 'send_reminders=[1 or 0] optional- 1 to send payment reminders', ], @@ -50,7 +50,7 @@ return CRM_Core_CodeGen_SqlData::create('civicrm_job') 'run_frequency' => 'Daily', 'name' => 'Geocode and Parse Addresses', 'description' => 'Retrieves geocodes (lat and long) and / or parses street addresses (populates street number, street name, etc.)', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'geocode', 'parameters' => 'geocoding=[1 or 0] required parse=[1 or 0] required @@ -62,7 +62,7 @@ throttle=[1 or 0] optional-1 adds five second sleep', 'run_frequency' => 'Daily', 'name' => 'Update Greetings and Addressees', 'description' => 'Goes through contact records and updates email and postal greetings, or addressee value', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'update_greeting', 'parameters' => 'ct=[Individual or Household or Organization] required gt=[email_greeting or postal_greeting or addressee] required @@ -73,7 +73,7 @@ limit=Number optional-Limit the number of contacts to update', 'run_frequency' => 'Daily', 'name' => 'Mail Reports', 'description' => 'Generates and sends out reports via email', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'mail_report', 'parameters' => 'instanceId=[ID of report instance] required format=[csv or print] optional-output CSV or print-friendly HTML, else PDF', @@ -82,49 +82,49 @@ format=[csv or print] optional-output CSV or print-friendly HTML, else PDF', 'run_frequency' => 'Hourly', 'name' => 'Send Scheduled Reminders', 'description' => 'Sends out scheduled reminders via email', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'send_reminder', ], [ 'run_frequency' => 'Always', 'name' => 'Update Participant Statuses', 'description' => 'Updates pending event participant statuses based on time', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'process_participant', ], [ 'run_frequency' => 'Daily', 'name' => 'Update Membership Statuses', 'description' => 'Updates membership statuses. WARNING: Membership renewal reminders have been migrated to the Schedule Reminders functionality, which supports multiple renewal reminders.', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'process_membership', ], [ 'run_frequency' => 'Always', 'name' => 'Process Survey Respondents', 'description' => 'Releases reserved survey respondents when they have been reserved for longer than the Release Frequency days specified for that survey.', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'process_respondent', ], [ 'run_frequency' => 'Hourly', 'name' => 'Clean-up Temporary Data and Files', 'description' => 'Removes temporary data and files, and clears old data from cache tables. Recommend running this job every hour to help prevent database and file system bloat.', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'cleanup', ], [ 'run_frequency' => 'Always', 'name' => 'Send Scheduled SMS', 'description' => 'Sends out scheduled SMS', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'process_sms', ], [ 'run_frequency' => 'Always', 'name' => 'Rebuild Smart Group Cache', 'description' => 'Rebuilds the smart group cache.', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'group_rebuild', 'parameters' => 'limit=Number optional-Limit the number of smart groups rebuild', ], @@ -132,14 +132,14 @@ format=[csv or print] optional-output CSV or print-friendly HTML, else PDF', 'run_frequency' => 'Daily', 'name' => 'Disable expired relationships', 'description' => 'Disables relationships that have expired (ie. those relationships whose end date is in the past).', - 'api_entity' => 'job', + 'api_entity' => 'Job', 'api_action' => 'disable_expired_relationships', ], [ 'run_frequency' => 'Daily', 'name' => 'Validate Email Address from Mailings.', 'description' => 'Updates the reset_date on an email address to indicate that there was a valid delivery to this email address.', - 'api_entity' => 'mailing', + 'api_entity' => 'Mailing', 'api_action' => 'update_email_resetdate', 'parameters' => 'minDays, maxDays=Consider mailings that have completed between minDays and maxDays', ], -- 2.25.1