mirror of
https://codeberg.org/artfulrobot/contactcats.git
synced 2025-06-25 23:28:04 +02:00
36 lines
955 B
PHP
36 lines
955 B
PHP
<?php
|
|
|
|
use Civi\Api4\ContactCategory;
|
|
|
|
/**
|
|
* Job.Contactcatsync API specification
|
|
*
|
|
* This ensures that the contact categories are applied each night. It is a simple wrapper
|
|
* around ContactCategory.Sync api4 action. It can be called hourly but the api4 activity
|
|
* will ensure it only runs once a day, around 3am (server timezone).
|
|
*
|
|
* @param array $spec description of fields supported by this API call
|
|
*
|
|
* @see https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
|
|
*/
|
|
function _civicrm_api3_job_Contactcatsync_spec(&$spec) {
|
|
}
|
|
|
|
/**
|
|
* Job.Contactcatsync API
|
|
*
|
|
* @param array $params
|
|
*
|
|
* @return array
|
|
* API result descriptor
|
|
*
|
|
* @see civicrm_api3_create_success
|
|
*
|
|
* @throws CRM_Core_Exception
|
|
*/
|
|
function civicrm_api3_job_Contactcatsync($params) {
|
|
$returnValues = ContactCategory::sync(FALSE)
|
|
->execute()->getArrayCopy();
|
|
|
|
return civicrm_api3_create_success($returnValues, $params, 'Job', 'Contactcatsync');
|
|
}
|