diff --git a/civicrm.php b/civicrm.php index f560a3bba3e5ab6813982c250184064005f60e3c..8e56c3fa586806db6cfa0129f6ad3fb40aaecb8a 100644 --- a/civicrm.php +++ b/civicrm.php @@ -2,7 +2,7 @@ /* Plugin Name: CiviCRM Description: CiviCRM - Growing and Sustaining Relationships -Version: 5.17.5 +Version: 5.18.0 Author: CiviCRM LLC Author URI: https://civicrm.org/ Plugin URI: https://wiki.civicrm.org/confluence/display/CRMDOC/Installing+CiviCRM+for+WordPress @@ -137,17 +137,6 @@ if ( file_exists( CIVICRM_SETTINGS_PATH ) ) { // Prevent CiviCRM from rendering its own header define( 'CIVICRM_UF_HEAD', TRUE ); -/** - * Setting this to 'true' will replace all mailing URLs calls to 'extern/url.php' - * and 'extern/open.php' with their REST counterpart 'civicrm/v3/url' and 'civicrm/v3/open'. - * - * Use for test purposes, may affect mailing - * performance, see Plugin->replace_tracking_urls() method. - */ -if ( ! defined( 'CIVICRM_WP_REST_REPLACE_MAILING_TRACKING' ) ) { - define( 'CIVICRM_WP_REST_REPLACE_MAILING_TRACKING', false ); -} - /** * Define CiviCRM_For_WordPress Class. @@ -527,9 +516,6 @@ class CiviCRM_For_WordPress { include_once CIVICRM_PLUGIN_DIR . 'includes/civicrm.basepage.php'; $this->basepage = new CiviCRM_For_WordPress_Basepage; - // Include REST API autoloader class - require_once( CIVICRM_PLUGIN_DIR . 'wp-rest/Autoloader.php' ); - } @@ -642,12 +628,6 @@ class CiviCRM_For_WordPress { // Register hooks for clean URLs. $this->register_hooks_clean_urls(); - // Set up REST API. - CiviCRM_WP_REST\Autoloader::add_source( $source_path = trailingslashit( CIVICRM_PLUGIN_DIR . 'wp-rest' ) ); - - // Init REST API. - new CiviCRM_WP_REST\Plugin; - } @@ -852,12 +832,17 @@ class CiviCRM_For_WordPress { // CiviCRM Initialisation // --------------------------------------------------------------------------- + /** + * Check that the PHP version is supported. If not, raise a fatal error with a pointed message. + * + * One should check this before bootstrapping Civi - after we start the class-loader, the + * PHP-compatibility errors will become more ugly. + */ protected function assertPhpSupport() { - // Need to check this before bootstrapping - once we start bootstrapping, the error messages will become ugly. if ( version_compare( PHP_VERSION, CIVICRM_WP_PHP_MINIMUM ) < 0 ) { echo '<p>' . sprintf( - __( 'CiviCRM requires PHP version %s or greater. You are running PHP version %s', 'civicrm' ), + __( 'CiviCRM requires PHP version %1$s or greater. You are running PHP version %2$s', 'civicrm' ), CIVICRM_WP_PHP_MINIMUM, PHP_VERSION ) . diff --git a/civicrm/CRM/ACL/BAO/Cache.php b/civicrm/CRM/ACL/BAO/Cache.php index 921adfeaf6c08c03e4c94238af36bde567b793a9..c165e940c0d69357574b7063acddbe378f07182a 100644 --- a/civicrm/CRM/ACL/BAO/Cache.php +++ b/civicrm/CRM/ACL/BAO/Cache.php @@ -34,7 +34,7 @@ /** * Access Control Cache. */ -class CRM_ACL_BAO_Cache extends CRM_ACL_DAO_Cache { +class CRM_ACL_BAO_Cache extends CRM_ACL_DAO_ACLCache { public static $_cache = NULL; @@ -96,7 +96,7 @@ SELECT acl_id */ public static function store($id, &$cache) { foreach ($cache as $aclID => $data) { - $dao = new CRM_ACL_DAO_Cache(); + $dao = new CRM_ACL_BAO_Cache(); if ($id) { $dao->contact_id = $id; } diff --git a/civicrm/CRM/ACL/DAO/Cache.php b/civicrm/CRM/ACL/DAO/ACLCache.php similarity index 91% rename from civicrm/CRM/ACL/DAO/Cache.php rename to civicrm/CRM/ACL/DAO/ACLCache.php index 34a3e7360b56f9727e26ea3315146edf437e8daf..cbf774e4b27641421418c2d22ded5507ad8ec856 100644 --- a/civicrm/CRM/ACL/DAO/Cache.php +++ b/civicrm/CRM/ACL/DAO/ACLCache.php @@ -4,15 +4,15 @@ * @package CRM * @copyright CiviCRM LLC (c) 2004-2019 * - * Generated from xml/schema/CRM/ACL/Cache.xml + * Generated from xml/schema/CRM/ACL/ACLCache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:6180a43e0d4bd8f2008286be6683d0ba) + * (GenCodeChecksum:a7bccfc35714fdcf0fdb6f4cd24842bd) */ /** - * Database access object for the Cache entity. + * Database access object for the ACLCache entity. */ -class CRM_ACL_DAO_Cache extends CRM_Core_DAO { +class CRM_ACL_DAO_ACLCache extends CRM_Core_DAO { /** * Static instance to hold the table name. @@ -96,8 +96,8 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO { 'required' => TRUE, 'where' => 'civicrm_acl_cache.id', 'table_name' => 'civicrm_acl_cache', - 'entity' => 'Cache', - 'bao' => 'CRM_ACL_BAO_Cache', + 'entity' => 'ACLCache', + 'bao' => 'CRM_ACL_DAO_ACLCache', 'localizable' => 0, ], 'contact_id' => [ @@ -107,8 +107,8 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO { 'description' => ts('Foreign Key to Contact'), 'where' => 'civicrm_acl_cache.contact_id', 'table_name' => 'civicrm_acl_cache', - 'entity' => 'Cache', - 'bao' => 'CRM_ACL_BAO_Cache', + 'entity' => 'ACLCache', + 'bao' => 'CRM_ACL_DAO_ACLCache', 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', ], @@ -120,8 +120,8 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO { 'required' => TRUE, 'where' => 'civicrm_acl_cache.acl_id', 'table_name' => 'civicrm_acl_cache', - 'entity' => 'Cache', - 'bao' => 'CRM_ACL_BAO_Cache', + 'entity' => 'ACLCache', + 'bao' => 'CRM_ACL_DAO_ACLCache', 'localizable' => 0, 'FKClassName' => 'CRM_ACL_DAO_ACL', ], @@ -133,8 +133,8 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO { 'required' => FALSE, 'where' => 'civicrm_acl_cache.modified_date', 'table_name' => 'civicrm_acl_cache', - 'entity' => 'Cache', - 'bao' => 'CRM_ACL_BAO_Cache', + 'entity' => 'ACLCache', + 'bao' => 'CRM_ACL_DAO_ACLCache', 'localizable' => 0, ], ]; diff --git a/civicrm/CRM/ACL/Form/WordPress/Permissions.php b/civicrm/CRM/ACL/Form/WordPress/Permissions.php index bad293c934c17f1d0567697ce7abc3b935b3501e..65191fb9793aed95be6ef1190364b5fd59b5a109 100644 --- a/civicrm/CRM/ACL/Form/WordPress/Permissions.php +++ b/civicrm/CRM/ACL/Form/WordPress/Permissions.php @@ -54,7 +54,7 @@ class CRM_ACL_Form_WordPress_Permissions extends CRM_Core_Form { } foreach ($wp_roles->role_names as $role => $name) { // Don't show the permissions options for administrator, as they have all permissions - if ( is_multisite() OR $role !== 'administrator') { + if ($role !== 'administrator') { $roleObj = $wp_roles->get_role($role); if (!empty($roleObj->capabilities)) { foreach ($roleObj->capabilities as $ckey => $cname) { diff --git a/civicrm/CRM/Activity/BAO/Activity.php b/civicrm/CRM/Activity/BAO/Activity.php index 313fa5c1282749902ca579c43e32a15fd5fde457..2a999323cd61bc5da88bf96daabff9eee4474ea1 100644 --- a/civicrm/CRM/Activity/BAO/Activity.php +++ b/civicrm/CRM/Activity/BAO/Activity.php @@ -312,9 +312,9 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } // Set priority to Normal for Auto-populated activities (for Cases) - if (CRM_Utils_Array::value('priority_id', $params) === NULL && + if (!isset($params['priority_id']) && // if not set and not 0 - !CRM_Utils_Array::value('id', $params) + empty($params['id']) ) { $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'); $params['priority_id'] = array_search('Normal', $priority); @@ -902,6 +902,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { */ public function addSelectWhereClause() { $clauses = []; + // @todo - check if $permissedActivityTYpes === all activity types and do not add critieria if so. $permittedActivityTypeIDs = self::getPermittedActivityTypes(); if (empty($permittedActivityTypeIDs)) { // This just prevents a mysql fail if they have no access - should be extremely edge case. @@ -986,6 +987,56 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { return civicrm_api3('Activity', 'getcount', $activityParams); } + /** + * @param int $userID + * @param string $subject + * @param string $html + * @param string $text + * @param string $additionalDetails + * @param int $campaignID + * @param array $attachments + * + * @return int + * The created activity ID + * @throws \CRM_Core_Exception + */ + public static function createEmailActivity($userID, $subject, $html, $text, $additionalDetails, $campaignID, $attachments) { + $activityTypeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Email'); + + // CRM-6265: save both text and HTML parts in details (if present) + if ($html and $text) { + $details = "-ALTERNATIVE ITEM 0-\n$html$additionalDetails\n-ALTERNATIVE ITEM 1-\n$text$additionalDetails\n-ALTERNATIVE END-\n"; + } + else { + $details = $html ? $html : $text; + $details .= $additionalDetails; + } + + $activityParams = [ + 'source_contact_id' => $userID, + 'activity_type_id' => $activityTypeID, + 'activity_date_time' => date('YmdHis'), + 'subject' => $subject, + 'details' => $details, + // FIXME: check for name Completed and get ID from that lookup + 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Completed'), + 'campaign_id' => $campaignID, + ]; + + // CRM-5916: strip [case #…] before saving the activity (if present in subject) + $activityParams['subject'] = preg_replace('/\[case #([0-9a-h]{7})\] /', '', $activityParams['subject']); + + // add the attachments to activity params here + if ($attachments) { + // first process them + $activityParams = array_merge($activityParams, $attachments); + } + + $activity = self::create($activityParams); + + return $activity->id; + } + /** * Send the message to all the contacts. * @@ -1017,6 +1068,8 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { * * @return array * ( sent, activityId) if any email is sent and activityId + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public static function sendEmail( &$contactDetails, @@ -1060,45 +1113,8 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } //create the meta level record first ( email activity ) - $activityTypeID = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Email'); + $activityID = self::createEmailActivity($userID, $subject, $html, $text, $additionalDetails, $campaignId, $attachments); - // CRM-6265: save both text and HTML parts in details (if present) - if ($html and $text) { - $details = "-ALTERNATIVE ITEM 0-\n$html$additionalDetails\n-ALTERNATIVE ITEM 1-\n$text$additionalDetails\n-ALTERNATIVE END-\n"; - } - else { - $details = $html ? $html : $text; - $details .= $additionalDetails; - } - - $activityParams = [ - 'source_contact_id' => $userID, - 'activity_type_id' => $activityTypeID, - 'activity_date_time' => date('YmdHis'), - 'subject' => $subject, - 'details' => $details, - // FIXME: check for name Completed and get ID from that lookup - 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'status_id', 'Completed'), - 'campaign_id' => $campaignId, - ]; - - // CRM-5916: strip [case #…] before saving the activity (if present in subject) - $activityParams['subject'] = preg_replace('/\[case #([0-9a-h]{7})\] /', '', $activityParams['subject']); - - // add the attachments to activity params here - if ($attachments) { - // first process them - $activityParams = array_merge($activityParams, - $attachments - ); - } - - $activity = self::create($activityParams); - - // get the set of attachments from where they are stored - $attachments = CRM_Core_BAO_File::getEntityFile('civicrm_activity', - $activity->id - ); $returnProperties = []; if (isset($messageToken['contact'])) { foreach ($messageToken['contact'] as $key => $value) { @@ -1206,8 +1222,9 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { $tokenText, $tokenHtml, $emailAddress, - $activity->id, - $attachments, + $activityID, + // get the set of attachments from where they are stored + CRM_Core_BAO_File::getEntityFile('civicrm_activity', $activityID), $cc, $bcc ) @@ -1216,7 +1233,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity { } } - return [$sent, $activity->id]; + return [$sent, $activityID]; } /** diff --git a/civicrm/CRM/Activity/BAO/ActivityType.php b/civicrm/CRM/Activity/BAO/ActivityType.php new file mode 100644 index 0000000000000000000000000000000000000000..d26d1438316aff4ab55363c3a526f7a3f9f5bda4 --- /dev/null +++ b/civicrm/CRM/Activity/BAO/ActivityType.php @@ -0,0 +1,100 @@ +<?php +/* + +--------------------------------------------------------------------+ + | CiviCRM version 5 | + +--------------------------------------------------------------------+ + | Copyright CiviCRM LLC (c) 2004-2019 | + +--------------------------------------------------------------------+ + | This file is a part of CiviCRM. | + | | + | CiviCRM is free software; you can copy, modify, and distribute it | + | under the terms of the GNU Affero General Public License | + | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | + | | + | CiviCRM is distributed in the hope that it will be useful, but | + | WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | + | See the GNU Affero General Public License for more details. | + | | + | You should have received a copy of the GNU Affero General Public | + | License and the CiviCRM Licensing Exception along | + | with this program; if not, contact CiviCRM LLC | + | at info[AT]civicrm[DOT]org. If you have questions about the | + | GNU Affero General Public License or the licensing of CiviCRM, | + | see the CiviCRM license FAQ at http://civicrm.org/licensing | + +--------------------------------------------------------------------+ + */ + +/** + * + * @package CRM + * @copyright CiviCRM LLC (c) 2004-2019 + */ + +/** + * This class is a wrapper that moves some boilerplate code out of the Form class and helps remove some ambiguity with name and label. + */ +class CRM_Activity_BAO_ActivityType { + + /** + * key/value pair for this activity type + * + * @var array + * machineName The internal name for lookups - matches up to option_value 'name' column in the database + * displayLabel The label used for display/output - matches up to option_value 'label' column in the database + * id The value used to initialize this object - matches up to the option_value 'value' column in the database + */ + protected $_activityType = [ + 'machineName' => NULL, + 'displayLabel' => NULL, + 'id' => NULL, + ]; + + /** + * Constructor + * + * @param $activity_type_id int This matches up to the option_value 'value' column in the database. + */ + public function __construct($activity_type_id) { + $this->setActivityType($activity_type_id); + } + + /** + * Get the key/value pair representing this activity type. + * + * @return array + * @see $this->_activityType + */ + public function getActivityType() { + return $this->_activityType; + } + + /** + * Look up the key/value pair representing this activity type from the id. + * Generally called from constructor. + * + * @param $activity_type_id int This matches up to the option_value 'value' column in the database. + */ + public function setActivityType($activity_type_id) { + if ($activity_type_id && is_numeric($activity_type_id)) { + + /* + * These are pulled from CRM_Activity_Form_Activity. + * To avoid unexpectedly changing things like introducing hidden + * business logic or changing permission checks I've kept it using + * the same function call. It may or may not be desired to have + * that but this at least doesn't introduce anything that wasn't + * there before. + */ + $machineNames = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $activity_type_id, 'name'); + $displayLabels = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $activity_type_id, 'label'); + + $this->_activityType = [ + 'machineName' => CRM_Utils_Array::value($activity_type_id, $machineNames), + 'displayLabel' => CRM_Utils_Array::value($activity_type_id, $displayLabels), + 'id' => $activity_type_id, + ]; + } + } + +} diff --git a/civicrm/CRM/Activity/Form/Activity.php b/civicrm/CRM/Activity/Form/Activity.php index dc6718406bf50af730ff03acaa203095dc8043e1..e572fecd8639094a3f74b29e33895d0e00d4a425 100644 --- a/civicrm/CRM/Activity/Form/Activity.php +++ b/civicrm/CRM/Activity/Form/Activity.php @@ -323,30 +323,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { ); } - // Assigning Activity type name. - if ($this->_activityTypeId) { - $activityTName = CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $this->_activityTypeId, 'label'); - if ($activityTName[$this->_activityTypeId]) { - $this->_activityTypeName = $activityTName[$this->_activityTypeId]; - $this->assign('activityTName', $activityTName[$this->_activityTypeId]); - } - // Set title. - if (isset($activityTName)) { - $activityName = CRM_Utils_Array::value($this->_activityTypeId, $activityTName); - - if ($this->_currentlyViewedContactId) { - $displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId); - // Check if this is default domain contact CRM-10482. - if (CRM_Contact_BAO_Contact::checkDomainContact($this->_currentlyViewedContactId)) { - $displayName .= ' (' . ts('default organization') . ')'; - } - CRM_Utils_System::setTitle($displayName . ' - ' . $activityName); - } - else { - CRM_Utils_System::setTitle(ts('%1 Activity', [1 => $activityName])); - } - } - } + $this->assignActivityType(); // Check the mode when this form is called either single or as // search task action. @@ -483,6 +460,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } // when custom data is included in this page + $this->assign('cid', $this->_currentlyViewedContactId); if (!empty($_POST['hidden_custom'])) { // We need to set it in the session for the code below to work. // CRM-3014 @@ -666,7 +644,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $element = &$this->add('select', 'activity_type_id', ts('Activity Type'), ['' => '- ' . ts('select') . ' -'] + $this->_fields['followup_activity_type_id']['attributes'], FALSE, [ - 'onchange' => "CRM.buildCustomData( 'Activity', this.value );", + 'onchange' => "CRM.buildCustomData( 'Activity', this.value, false, false, false, false, false, false, {$this->_currentlyViewedContactId});", 'class' => 'crm-select2 required', ] ); @@ -744,7 +722,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { $this->assign('surveyActivity', $this->_isSurveyActivity); // Add the "Activity Separation" field - $actionIsAdd = $this->_action != CRM_Core_Action::UPDATE; + $actionIsAdd = ($this->_action != CRM_Core_Action::UPDATE && $this->_action != CRM_Core_Action::VIEW); $separationIsPossible = $this->supportsActivitySeparation; if ($actionIsAdd && $separationIsPossible) { $this->addRadio( @@ -1246,4 +1224,46 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { } } + /** + * For the moment keeping this the same as the original pulled from preProcess(). Also note the "s" at the end of the function name - planning to change that but in baby steps. + * + * @return string[] + */ + public function getActivityTypeDisplayLabels() { + return CRM_Core_OptionGroup::values('activity_type', FALSE, FALSE, FALSE, 'AND v.value = ' . $this->_activityTypeId, 'label'); + } + + /** + * For the moment this is just pulled from preProcess + */ + public function assignActivityType() { + if ($this->_activityTypeId) { + $activityTypeDisplayLabels = $this->getActivityTypeDisplayLabels(); + if ($activityTypeDisplayLabels[$this->_activityTypeId]) { + $this->_activityTypeName = $activityTypeDisplayLabels[$this->_activityTypeId]; + + // At the moment this is duplicating other code in this section, but refactoring in small steps. + $activityTypeObj = new CRM_Activity_BAO_ActivityType($this->_activityTypeId); + $this->assign('activityTypeNameAndLabel', $activityTypeObj->getActivityType()); + } + // Set title. + if (isset($activityTypeDisplayLabels)) { + // FIXME - it's not clear why the if line just above is needed here and why we can't just set this once above and re-use. What is interesting, but can't possibly be the reason, is that the first if block will fail if the label is the string '0', whereas this one won't. But who would have an activity type called '0'? + $activityTypeDisplayLabel = CRM_Utils_Array::value($this->_activityTypeId, $activityTypeDisplayLabels); + + if ($this->_currentlyViewedContactId) { + $displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId); + // Check if this is default domain contact CRM-10482. + if (CRM_Contact_BAO_Contact::checkDomainContact($this->_currentlyViewedContactId)) { + $displayName .= ' (' . ts('default organization') . ')'; + } + CRM_Utils_System::setTitle($displayName . ' - ' . $activityTypeDisplayLabel); + } + else { + CRM_Utils_System::setTitle(ts('%1 Activity', [1 => $activityTypeDisplayLabel])); + } + } + } + } + } diff --git a/civicrm/CRM/Activity/Form/Task/Batch.php b/civicrm/CRM/Activity/Form/Task/Batch.php index 9bdb768b8b50763e63c403e65bc0bdd91f696279..8b3fc1674536cf1a4bca5e5ddd82df9ca49e2bef 100644 --- a/civicrm/CRM/Activity/Form/Task/Batch.php +++ b/civicrm/CRM/Activity/Form/Task/Batch.php @@ -80,6 +80,7 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task { if (!empty($contactDetails)) { foreach ($contactDetails as $key => $value) { $assignee = CRM_Activity_BAO_ActivityAssignment::retrieveAssigneeIdsByActivityId($key); + $assigneeContact = []; foreach ($assignee as $values) { $assigneeContact[] = CRM_Contact_BAO_Contact::displayName($values); } diff --git a/civicrm/CRM/Activity/Page/AJAX.php b/civicrm/CRM/Activity/Page/AJAX.php index 6c78fb59c5b1d879c5f267da09a7487c6d6b6905..5688dd5093fd1d97c7fd6e35cdbb002da11e9e26 100644 --- a/civicrm/CRM/Activity/Page/AJAX.php +++ b/civicrm/CRM/Activity/Page/AJAX.php @@ -185,7 +185,7 @@ class CRM_Activity_Page_AJAX { else { foreach ($value as $clientRole) { $relClient = []; - $relClient['relation'] = 'Client'; + $relClient['relation'] = ts('Client'); $relClient['name'] = $clientRole['sort_name']; $relClient['phone'] = $clientRole['phone']; $relClient['email'] = $clientRole['email']; diff --git a/civicrm/CRM/Activity/Selector/Search.php b/civicrm/CRM/Activity/Selector/Search.php index abd0bdfb249f80ca24bb5bbd8e0fdfae048ef2b3..77bb0fa9a83275bb9f7141266fb540ffded74dab 100644 --- a/civicrm/CRM/Activity/Selector/Search.php +++ b/civicrm/CRM/Activity/Selector/Search.php @@ -129,7 +129,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM /** * The query object. * - * @var string + * @var \CRM_Contact_BAO_Query */ protected $_query; @@ -179,6 +179,13 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM // required here rather than "access my cases and activities" to // prevent those with only the later permission from seeing a list // of all cases which might present a privacy issue. + // @todo this is the cause of the current devastatingly bad performance on + // activity search - it involves a bad join. + // The correct fix is to use the permission infrastrucutre - ie. add in the + // clause generated by CRM_Activity_BAO_Query::addSelectWhere + // but some testing needs to check that before making the change + // see https://github.com/civicrm/civicrm-core/blob/be2fb01f90f5f299dd07402a41fed7c7c7567f00/CRM/Utils/SQL.php#L48 + // for how it's done in the api kernel. if (!CRM_Core_Permission::access($componentName, TRUE, TRUE)) { $componentClause[] = " (activity_type.component_id IS NULL OR activity_type.component_id <> {$componentID}) "; } @@ -435,7 +442,7 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM } /** - * @return string + * @return \CRM_Contact_BAO_Query */ public function &getQuery() { return $this->_query; diff --git a/civicrm/CRM/Admin/Form/Extensions.php b/civicrm/CRM/Admin/Form/Extensions.php index 852ebb082083eee4f0d3f61629d95f93edeaccd8..6826a159d4d8e2d9e324fa3e0286a686465bb8fe 100644 --- a/civicrm/CRM/Admin/Form/Extensions.php +++ b/civicrm/CRM/Admin/Form/Extensions.php @@ -205,7 +205,7 @@ class CRM_Admin_Form_Extensions extends CRM_Admin_Form { 'version' => 3, 'key' => $this->_key, ]); - if (!CRM_Utils_Array::value('is_error', $result, FALSE)) { + if (empty($result['is_error'])) { CRM_Core_Session::setStatus("", ts('Extension Upgraded'), "success"); } else { diff --git a/civicrm/CRM/Admin/Form/ScheduleReminders.php b/civicrm/CRM/Admin/Form/ScheduleReminders.php index e2365cb9d01e38fe9688c7c6e477de3d387c7ad1..b827be6910df771410d3d20adb44c8aa5d87fc71 100644 --- a/civicrm/CRM/Admin/Form/ScheduleReminders.php +++ b/civicrm/CRM/Admin/Form/ScheduleReminders.php @@ -523,7 +523,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { 'end_date', ]; - if (!CRM_Utils_Array::value('absolute_date', $params)) { + if (empty($params['absolute_date'])) { $params['absolute_date'] = 'null'; } foreach ($moreKeys as $mkey) { @@ -577,7 +577,7 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form { $params['is_active'] = CRM_Utils_Array::value('is_active', $values, 0); - if (CRM_Utils_Array::value('is_repeat', $values) == 0) { + if (empty($values['is_repeat'])) { $params['repetition_frequency_unit'] = 'null'; $params['repetition_frequency_interval'] = 'null'; $params['end_frequency_unit'] = 'null'; diff --git a/civicrm/CRM/Admin/Form/Setting/Localization.php b/civicrm/CRM/Admin/Form/Setting/Localization.php index 2e85c5924a39e05541a30690eac403174d4b9e79..a3cec9ae90c598d2e4441d6f4b5e27bb22d4f0e3 100644 --- a/civicrm/CRM/Admin/Form/Setting/Localization.php +++ b/civicrm/CRM/Admin/Form/Setting/Localization.php @@ -220,7 +220,7 @@ class CRM_Admin_Form_Setting_Localization extends CRM_Admin_Form_Setting { } // add a new db locale if the requested language is not yet supported by the db - if (!CRM_Utils_Array::value('makeSinglelingual', $values) and CRM_Utils_Array::value('addLanguage', $values)) { + if (empty($values['makeSinglelingual']) && !empty($values['addLanguage'])) { $domain = new CRM_Core_DAO_Domain(); $domain->find(TRUE); if (!substr_count($domain->locales, $values['addLanguage'])) { diff --git a/civicrm/CRM/Admin/Form/Setting/Smtp.php b/civicrm/CRM/Admin/Form/Setting/Smtp.php index cebf70c8ca4d739a60e2168019cdbaf6d5d0a77d..45dc52dccedea26c90685175b930922f458d37da 100644 --- a/civicrm/CRM/Admin/Form/Setting/Smtp.php +++ b/civicrm/CRM/Admin/Form/Setting/Smtp.php @@ -105,8 +105,8 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting { list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(); if (!$domainEmailAddress || $domainEmailAddress == 'info@EXAMPLE.ORG') { - $fixUrl = CRM_Utils_System::url("civicrm/admin/domain", 'action=update&reset=1'); - CRM_Core_Error::statusBounce(ts('The site administrator needs to enter a valid email address in <a href="%1">Administer CiviCRM » Communications » Organization Address and Contact Info</a>. The email address used may need to be a valid mail account with your email service provider.', [1 => $fixUrl])); + $fixUrl = CRM_Utils_System::url("civicrm/admin/options/from_email_address", 'action=update&reset=1'); + CRM_Core_Error::statusBounce(ts('The site administrator needs to enter a valid \'FROM Email Address\' in <a href="%1">Administer CiviCRM » System Settings » Option Groups » From Email Address</a>. The email address used may need to be a valid mail account with your email service provider.', [1 => $fixUrl])); } if (!$toEmail) { CRM_Core_Error::statusBounce(ts('Cannot send a test email because your user record does not have a valid email address.')); diff --git a/civicrm/CRM/Badge/BAO/Badge.php b/civicrm/CRM/Badge/BAO/Badge.php index 7775cd4ae5417cde3d33da537c07905199c16618..b4ff8e41030bcd2028e73c795275fd5a79504ca6 100644 --- a/civicrm/CRM/Badge/BAO/Badge.php +++ b/civicrm/CRM/Badge/BAO/Badge.php @@ -225,8 +225,8 @@ class CRM_Badge_BAO_Badge { break; } $this->pdf->Image($formattedRow['participant_image'], $x + $imageAlign, $y + $startOffset, CRM_Utils_Array::value('width_participant_image', $formattedRow), CRM_Utils_Array::value('height_participant_image', $formattedRow)); - if ($startOffset == NULL && CRM_Utils_Array::value('height_participant_image', $formattedRow)) { - $startOffset = CRM_Utils_Array::value('height_participant_image', $formattedRow); + if ($startOffset == NULL && !empty($formattedRow['height_participant_image'])) { + $startOffset = $formattedRow['height_participant_image']; } } diff --git a/civicrm/CRM/Batch/BAO/Batch.php b/civicrm/CRM/Batch/BAO/Batch.php index 771c0cc412138cf9f5d28344e4e5d0a684893066..93bb4b6c3e9f7399412fa265c2a9113fb0c47e30 100644 --- a/civicrm/CRM/Batch/BAO/Batch.php +++ b/civicrm/CRM/Batch/BAO/Batch.php @@ -334,9 +334,14 @@ class CRM_Batch_BAO_Batch extends CRM_Batch_DAO_Batch { $aid = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Export Accounting Batch'); $activityParams = ['source_record_id' => $values['id'], 'activity_type_id' => $aid]; $exportActivity = CRM_Activity_BAO_Activity::retrieve($activityParams, $val); - $fid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $exportActivity->id, 'file_id', 'entity_id'); - $fileHash = CRM_Core_BAO_File::generateFileHash($exportActivity->id, $fid); - $tokens = array_merge(['eid' => $exportActivity->id, 'fid' => $fid, 'fcs' => $fileHash], $tokens); + if ($exportActivity) { + $fid = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_EntityFile', $exportActivity->id, 'file_id', 'entity_id'); + $fileHash = CRM_Core_BAO_File::generateFileHash($exportActivity->id, $fid); + $tokens = array_merge(['eid' => $exportActivity->id, 'fid' => $fid, 'fcs' => $fileHash], $tokens); + } + else { + CRM_Utils_Array::remove($newLinks, 'export', 'download'); + } } $values['action'] = CRM_Core_Action::formLink( $newLinks, diff --git a/civicrm/CRM/Batch/Form/Entry.php b/civicrm/CRM/Batch/Form/Entry.php index 038f32094446fa57932af70f5732988569719df6..5d98871c54b81d288a7769f3dfc4636fd524bcf4 100644 --- a/civicrm/CRM/Batch/Form/Entry.php +++ b/civicrm/CRM/Batch/Form/Entry.php @@ -395,7 +395,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { $completeStatus = CRM_Contribute_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'); $specialFields = [ - 'join_date' => date('Y-m-d'), + 'membership_join_date' => date('Y-m-d'), 'receive_date' => $currentDate, 'contribution_status_id' => $completeStatus, ]; @@ -825,7 +825,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { } else { $dateTypes = [ - 'join_date' => 'joinDate', + 'membership_join_date' => 'joinDate', 'membership_start_date' => 'startDate', 'membership_end_date' => 'endDate', ]; diff --git a/civicrm/CRM/Case/BAO/Query.php b/civicrm/CRM/Case/BAO/Query.php index 321118bf96e74613625e82dd299eff8ff4338cfe..3db0adee600152aefe70f4492b3de3d6f7d55cdd 100644 --- a/civicrm/CRM/Case/BAO/Query.php +++ b/civicrm/CRM/Case/BAO/Query.php @@ -481,7 +481,14 @@ class CRM_Case_BAO_Query extends CRM_Core_BAO_Query { $tags = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', ['onlyActive' => FALSE]); if (!empty($value)) { - $val = explode(',', $value); + if (is_array($value)) { + // Search tag(s) are part of a tag set + $val = array_keys($value); + } + else { + // Search tag(s) are part of the tag tree + $val = explode(',', $value); + } foreach ($val as $v) { if ($v) { $names[] = $tags[$v]; diff --git a/civicrm/CRM/Case/Form/Activity/ChangeCaseStatus.php b/civicrm/CRM/Case/Form/Activity/ChangeCaseStatus.php index 6316f3a223c58c710faee75ef7e44781113b2481..aa4a6ce43fd484a60aa93a320d0fa2264bfeb99f 100644 --- a/civicrm/CRM/Case/Form/Activity/ChangeCaseStatus.php +++ b/civicrm/CRM/Case/Form/Activity/ChangeCaseStatus.php @@ -165,7 +165,6 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { * @param CRM_Activity_BAO_Activity $activity */ public static function endPostProcess(&$form, &$params, $activity) { - $groupingValues = CRM_Core_OptionGroup::values('case_status', FALSE, TRUE, FALSE, NULL, 'value'); // Set case end_date if we're closing the case. Clear end_date if we're (re)opening it. @@ -175,14 +174,14 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { // End case-specific relationships (roles) foreach ($params['target_contact_id'] as $cid) { $rels = CRM_Case_BAO_Case::getCaseRoles($cid, $params['case_id']); - // FIXME: Is there an existing function to close a relationship? - $query = 'UPDATE civicrm_relationship SET end_date=%2 WHERE id=%1'; foreach ($rels as $relId => $relData) { - $relParams = [ - 1 => [$relId, 'Integer'], - 2 => [$params['end_date'], 'Timestamp'], + $relationshipParams = [ + 'id' => $relId, + 'end_date' => $params['end_date'], ]; - CRM_Core_DAO::executeQuery($query, $relParams); + // @todo we can't switch directly to api because there is too much business logic and it breaks closing cases with organisations as client relationships + //civicrm_api3('Relationship', 'create', $relationshipParams); + CRM_Contact_BAO_Relationship::add($relationshipParams); } } } @@ -192,11 +191,14 @@ class CRM_Case_Form_Activity_ChangeCaseStatus { // Reopen case-specific relationships (roles) foreach ($params['target_contact_id'] as $cid) { $rels = CRM_Case_BAO_Case::getCaseRoles($cid, $params['case_id'], NULL, FALSE); - // FIXME: Is there an existing function? - $query = 'UPDATE civicrm_relationship SET end_date=NULL WHERE id=%1'; foreach ($rels as $relId => $relData) { - $relParams = [1 => [$relId, 'Integer']]; - CRM_Core_DAO::executeQuery($query, $relParams); + $relationshipParams = [ + 'id' => $relId, + 'end_date' => 'null', + ]; + // @todo we can't switch directly to api because there is too much business logic and it breaks closing cases with organisations as client relationships + //civicrm_api3('Relationship', 'create', $relationshipParams); + CRM_Contact_BAO_Relationship::add($relationshipParams); } } } diff --git a/civicrm/CRM/Case/Form/Activity/ChangeCaseType.php b/civicrm/CRM/Case/Form/Activity/ChangeCaseType.php index 2a8ac64e850ca4df14af58d5fec022c931a53993..1e683a8beb71af863b4a100203cdd8adf451d592 100644 --- a/civicrm/CRM/Case/Form/Activity/ChangeCaseType.php +++ b/civicrm/CRM/Case/Form/Activity/ChangeCaseType.php @@ -119,7 +119,7 @@ class CRM_Case_Form_Activity_ChangeCaseType { $params['id'] = $form->_id; } - if (CRM_Utils_Array::value('is_reset_timeline', $params) == 0) { + if (empty($params['is_reset_timeline'])) { unset($params['reset_date_time']); } } diff --git a/civicrm/CRM/Case/XMLProcessor/Process.php b/civicrm/CRM/Case/XMLProcessor/Process.php index 4cfb5c8d7e1abcf6142a5e97ab2acc580d1663c3..1b96b2e152485abeec18c83236471e043dea6240 100644 --- a/civicrm/CRM/Case/XMLProcessor/Process.php +++ b/civicrm/CRM/Case/XMLProcessor/Process.php @@ -105,7 +105,7 @@ class CRM_Case_XMLProcessor_Process extends CRM_Case_XMLProcessor { foreach ($xml->CaseRoles as $caseRoleXML) { foreach ($caseRoleXML->RelationshipType as $relationshipTypeXML) { if ((int ) $relationshipTypeXML->creator == 1) { - if (!$this->createRelationships((string ) $relationshipTypeXML->name, + if (!$this->createRelationships($this->locateNameOrLabel($relationshipTypeXML), $params ) ) { @@ -846,4 +846,34 @@ AND a.is_deleted = 0 return $default; } + /** + * At some point name and label got mixed up for case roles. + * Check for higher priority tag <machineName> first which represents name, then fall back to the <name> tag which somehow became label. + * We do this to avoid requiring people to update their xml files which can be stored in external files. + * + * Note this is different than doing something like comparing the <name> tag against name in the database and then falling back to comparing label in the database, which is subject to an edge case where you would get the wrong one (where the label of one relationship type is the same as the name of another). Here there are two tags with explicit single meanings. + * + * @param SimpleXMLElement $xml + * + * @return string + */ + public function locateNameOrLabel($xml) { + /* While it's unlikely, it's possible somebody is using '0' as their machineName, so we should let them. + * Specifically if machineName is: + * missing - use name + * null - use name + * blank - use name + * the string '0' - use machineName + * the number 0 - use machineName (but can't really have number 0 in simplexml unless cast to number) + * the word 'null' - use machineName and best not to think about it + */ + if (isset($xml->machineName)) { + $machineName = (string) $xml->machineName; + if ($machineName !== '') { + return $machineName; + } + } + return (string) $xml->name; + } + } diff --git a/civicrm/CRM/Contact/BAO/Contact/Utils.php b/civicrm/CRM/Contact/BAO/Contact/Utils.php index 1d9f166a7131f492c503051b79195ea34ce9c977..28f380249093a9fd91665141bfd39241fbda55bb 100644 --- a/civicrm/CRM/Contact/BAO/Contact/Utils.php +++ b/civicrm/CRM/Contact/BAO/Contact/Utils.php @@ -242,33 +242,6 @@ WHERE id IN ( $idString ) return ($inputTS + ($inputLF * 60 * 60) >= $now); } - /** - * Get the count of contact loctions. - * - * @param int $contactId - * Contact id. - * - * @return int - * max locations for the contact - */ - public static function maxLocations($contactId) { - $contactLocations = []; - - // find number of location blocks for this contact and adjust value accordinly - // get location type from email - $query = " -( SELECT location_type_id FROM civicrm_email WHERE contact_id = {$contactId} ) -UNION -( SELECT location_type_id FROM civicrm_phone WHERE contact_id = {$contactId} ) -UNION -( SELECT location_type_id FROM civicrm_im WHERE contact_id = {$contactId} ) -UNION -( SELECT location_type_id FROM civicrm_address WHERE contact_id = {$contactId} ) -"; - $dao = CRM_Core_DAO::executeQuery($query); - return $dao->N; - } - /** * Create Current employer relationship for a individual. * @@ -469,9 +442,6 @@ WHERE id={$contactId}; "; * */ public static function buildOnBehalfForm(&$form, $contactType, $countryID, $stateID, $title) { - - $config = CRM_Core_Config::singleton(); - $form->assign('contact_type', $contactType); $form->assign('fieldSetTitle', $title); $form->assign('contactEditMode', TRUE); @@ -509,7 +479,7 @@ WHERE id={$contactId}; "; ); } - $addressSequence = $config->addressSequence(); + $addressSequence = CRM_Utils_Address::sequence(\Civi::settings()->get('address_format')); $form->assign('addressSequence', array_fill_keys($addressSequence, 1)); //Primary Phone diff --git a/civicrm/CRM/Contact/BAO/ContactType.php b/civicrm/CRM/Contact/BAO/ContactType.php index 8ee3011f2779d071fa1c2f249b39a9bdff1ffd17..a4d7cc6af43f680f4b1ff042c1cd242b5e294523 100644 --- a/civicrm/CRM/Contact/BAO/ContactType.php +++ b/civicrm/CRM/Contact/BAO/ContactType.php @@ -149,65 +149,45 @@ WHERE parent_id IS NULL * .. * @param bool $all * @param bool $ignoreCache - * @param bool $reset * * @return array * Array of sub type information */ - public static function subTypeInfo($contactType = NULL, $all = FALSE, $ignoreCache = FALSE, $reset = FALSE) { - static $_cache = NULL; - - if ($reset === TRUE) { - $_cache = NULL; - } - - if ($_cache === NULL) { - $_cache = []; - } - if ($contactType && !is_array($contactType)) { - $contactType = [$contactType]; - } - + public static function subTypeInfo($contactType = NULL, $all = FALSE, $ignoreCache = FALSE) { $argString = $all ? 'CRM_CT_STI_1_' : 'CRM_CT_STI_0_'; if (!empty($contactType)) { + $contactType = (array) $contactType; $argString .= implode('_', $contactType); } + if (!Civi::cache('contactTypes')->has($argString) || $ignoreCache) { + $ctWHERE = ''; + if (!empty($contactType)) { + $ctWHERE = " AND parent.name IN ('" . implode("','", $contactType) . "')"; + } - if ((!array_key_exists($argString, $_cache)) || $ignoreCache) { - $cache = CRM_Utils_Cache::singleton(); - $_cache[$argString] = $cache->get($argString); - if (!$_cache[$argString] || $ignoreCache) { - $_cache[$argString] = []; - - $ctWHERE = ''; - if (!empty($contactType)) { - $ctWHERE = " AND parent.name IN ('" . implode("','", $contactType) . "')"; - } - - $sql = " + $sql = " SELECT subtype.*, parent.name as parent, parent.label as parent_label FROM civicrm_contact_type subtype INNER JOIN civicrm_contact_type parent ON subtype.parent_id = parent.id WHERE subtype.name IS NOT NULL AND subtype.parent_id IS NOT NULL {$ctWHERE} "; - if ($all === FALSE) { - $sql .= " AND subtype.is_active = 1 AND parent.is_active = 1 ORDER BY parent.id"; - } - $dao = CRM_Core_DAO::executeQuery($sql, [], - FALSE, 'CRM_Contact_DAO_ContactType' - ); - while ($dao->fetch()) { - $value = []; - CRM_Core_DAO::storeValues($dao, $value); - $value['parent'] = $dao->parent; - $value['parent_label'] = $dao->parent_label; - $_cache[$argString][$dao->name] = $value; - } - - $cache->set($argString, $_cache[$argString]); + if ($all === FALSE) { + $sql .= " AND subtype.is_active = 1 AND parent.is_active = 1 ORDER BY parent.id"; } + $dao = CRM_Core_DAO::executeQuery($sql, [], + FALSE, 'CRM_Contact_DAO_ContactType' + ); + $values = []; + while ($dao->fetch()) { + $value = []; + CRM_Core_DAO::storeValues($dao, $value); + $value['parent'] = $dao->parent; + $value['parent_label'] = $dao->parent_label; + $values[$dao->name] = $value; + } + Civi::cache('contactTypes')->set($argString, $values); } - return $_cache[$argString]; + return Civi::cache('contactTypes')->get($argString); } /** @@ -378,6 +358,7 @@ WHERE type.name IS NOT NULL $isSeparator = TRUE, $separator = '__' ) { + // @todo - use Cache class - ie like Civi::cache('contactTypes') static $_cache = NULL; if ($_cache === NULL) { @@ -467,6 +448,7 @@ AND ( p.is_active = 1 OR p.id IS NULL ) * basicTypes. */ public static function getBasicType($subType) { + // @todo - use Cache class - ie like Civi::cache('contactTypes') static $_cache = NULL; if ($_cache === NULL) { $_cache = []; @@ -617,8 +599,9 @@ DELETE FROM civicrm_navigation WHERE name = %1"; $params = [1 => ["New $name", 'String']]; - $dao = CRM_Core_DAO::executeQuery($sql, $params); + CRM_Core_DAO::executeQuery($sql, $params); CRM_Core_BAO_Navigation::resetNavigation(); + Civi::cache('contactTypes')->clear(); } return TRUE; } @@ -680,9 +663,7 @@ WHERE name = %1"; CRM_Core_BAO_Navigation::add($navigation); } CRM_Core_BAO_Navigation::resetNavigation(); - - // reset the cache after adding - self::subTypeInfo(NULL, FALSE, FALSE, TRUE); + Civi::cache('contactTypes')->clear(); return $contactType; } diff --git a/civicrm/CRM/Contact/BAO/Query.php b/civicrm/CRM/Contact/BAO/Query.php index e7fca08a8d930e7307f193061bd577573b176651..9d5e64a38a51f8abc6ded53b8399ec8d61e7d0cd 100644 --- a/civicrm/CRM/Contact/BAO/Query.php +++ b/civicrm/CRM/Contact/BAO/Query.php @@ -1585,7 +1585,17 @@ class CRM_Contact_BAO_Query { self::filterCountryFromValuesIfStateExists($formValues); // We shouldn't have to whitelist fields to not hack but here we are, for now. - $nonLegacyDateFields = ['participant_register_date_relative', 'receive_date_relative']; + $nonLegacyDateFields = [ + 'participant_register_date_relative', + 'receive_date_relative', + 'pledge_end_date_relative', + 'pledge_create_date_relative', + 'pledge_start_date_relative', + 'pledge_payment_scheduled_date_relative', + 'membership_join_date_relative', + 'membership_start_date_relative', + 'membership_end_date_relative', + ]; // Handle relative dates first foreach (array_keys($formValues) as $id) { if ( @@ -1818,6 +1828,7 @@ class CRM_Contact_BAO_Query { $this->buildRelativeDateQuery($values); return; } + // @todo also handle _low, _high generically here with if ($query->buildDateRangeQuery($values)) {return} // do not process custom fields or prefixed contact ids or component params if (CRM_Core_BAO_CustomField::getKeyID($values[0]) || @@ -5264,7 +5275,7 @@ civicrm_relationship.start_date > {$today} * @param string $dateFormat */ public function dateQueryBuilder( - &$values, $tableName, $fieldName, + $values, $tableName, $fieldName, $dbFieldName, $fieldTitle, $appendTimeStamp = TRUE, $dateFormat = 'YmdHis' @@ -6950,6 +6961,47 @@ AND displayRelType.is_active = 1 return isset($this->_fields[$realField]); } + /** + * Get the specifications for the field, if available. + * + * @param string $fieldName + * Fieldname as displayed on the form. + * + * @return array + */ + public function getFieldSpec($fieldName) { + if (isset($this->_fields[$fieldName])) { + return $this->_fields[$fieldName]; + } + $lowFieldName = str_replace('_low', '', $fieldName); + if (isset($this->_fields[$lowFieldName])) { + return array_merge($this->_fields[$lowFieldName], ['field_name' => $lowFieldName]); + } + $highFieldName = str_replace('_high', '', $fieldName); + if (isset($this->_fields[$highFieldName])) { + return array_merge($this->_fields[$highFieldName], ['field_name' => $highFieldName]); + } + return []; + } + + public function buildWhereForDate() { + + } + + /** + * Is the field a relative date field. + * + * @param string $fieldName + * + * @return bool + */ + protected function isADateRangeField($fieldName) { + if (substr($fieldName, -4, 4) !== '_low' && substr($fieldName, -5, 5) !== '_high') { + return FALSE; + } + return !empty($this->getFieldSpec($fieldName)); + } + /** * @param $values */ @@ -6995,6 +7047,23 @@ AND displayRelType.is_active = 1 } } + /** + * Build the query for a date field if it is a _high or _low field. + * + * @param $values + * + * @return bool + */ + public function buildDateRangeQuery($values) { + if ($this->isADateRangeField($values[0])) { + $fieldSpec = $this->getFieldSpec($values[0]); + $title = empty($fieldSpec['unique_title']) ? $fieldSpec['title'] : $fieldSpec['unique_title']; + $this->dateQueryBuilder($values, $fieldSpec['table_name'], $fieldSpec['field_name'], $fieldSpec['name'], $title); + return TRUE; + } + return FALSE; + } + /** * Add the address table into the query. * diff --git a/civicrm/CRM/Contact/BAO/Relationship.php b/civicrm/CRM/Contact/BAO/Relationship.php index 5d55ef141a8269032ea3fca6c3dded375a8a18e8..b210da587acac3c2dc8eb687a85c1a3b45bb5637 100644 --- a/civicrm/CRM/Contact/BAO/Relationship.php +++ b/civicrm/CRM/Contact/BAO/Relationship.php @@ -181,6 +181,7 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { $hook = 'edit'; } + // @todo pre hook is called from add - remove it from here CRM_Utils_Hook::pre($hook, 'Relationship', $relationshipId, $params); if (!$relationshipId) { @@ -295,33 +296,55 @@ class CRM_Contact_BAO_Relationship extends CRM_Contact_DAO_Relationship { if ($params['id']) { $hook = 'edit'; } - //@todo hook are called from create and add - remove one CRM_Utils_Hook::pre($hook, 'Relationship', $params['id'], $params); $relationshipTypes = CRM_Utils_Array::value('relationship_type_id', $params); - // explode the string with _ to get the relationship type id // and to know which contact has to be inserted in // contact_id_a and which one in contact_id_b - list($type) = explode('_', $relationshipTypes); + list($relationshipTypeID) = explode('_', $relationshipTypes); + + $relationship = new CRM_Contact_BAO_Relationship(); + if (!empty($params['id'])) { + $relationship->id = $params['id']; + // Only load the relationship if we're missing required params + $requiredParams = ['contact_id_a', 'contact_id_b', 'relationship_type_id']; + foreach ($requiredParams as $requiredKey) { + if (!isset($params[$requiredKey])) { + $relationship->find(TRUE); + break; + } + } + + } + $relationship->copyValues($params); + // @todo we could probably set $params['relationship_type_id'] above but it's unclear + // what that would do with the code below this. So for now be conservative and set it manually. + if (!empty($relationshipTypeID)) { + $relationship->relationship_type_id = $relationshipTypeID; + } + + $params['contact_id_a'] = $relationship->contact_id_a; + $params['contact_id_b'] = $relationship->contact_id_b; // check if the relationship type is Head of Household then update the // household's primary contact with this contact. - if ($type == 6) { - CRM_Contact_BAO_Household::updatePrimaryContact($params['contact_id_b'], $params['contact_id_a']); + try { + $headOfHouseHoldID = civicrm_api3('RelationshipType', 'getvalue', [ + 'return' => "id", + 'name_a_b' => "Head of Household for", + ]); + if ($relationshipTypeID == $headOfHouseHoldID) { + CRM_Contact_BAO_Household::updatePrimaryContact($relationship->contact_id_b, $relationship->contact_id_a); + } } - if (!empty($params['id']) && self::isCurrentEmployerNeedingToBeCleared($params, $params['id'], $type)) { - CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($params['contact_id_a']); + catch (Exception $e) { + // No "Head of Household" relationship found so we skip specific processing } - $relationship = new CRM_Contact_BAO_Relationship(); - //@todo this code needs to be updated for the possibility that not all fields are set - // by using $relationship->copyValues($params); - // (update) - $relationship->contact_id_b = $params['contact_id_b']; - $relationship->contact_id_a = $params['contact_id_a']; - $relationship->relationship_type_id = $type; - $relationship->id = $params['id']; + if (!empty($params['id']) && self::isCurrentEmployerNeedingToBeCleared($relationship->toArray(), $params['id'], $relationshipTypeID)) { + CRM_Contact_BAO_Contact_Utils::clearCurrentEmployer($relationship->contact_id_a); + } $dateFields = ['end_date', 'start_date']; @@ -1512,6 +1535,7 @@ LEFT JOIN civicrm_country ON (civicrm_address.country_id = civicrm_country.id) * @param bool $active * * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public static function relatedMemberships($contactId, &$params, $ids, $action = CRM_Core_Action::ADD, $active = TRUE) { // Check the end date and set the status of the relationship @@ -1668,23 +1692,17 @@ LEFT JOIN civicrm_country ON (civicrm_address.country_id = civicrm_country.id) $mainRelatedContactId = reset($relatedContacts); foreach ($details['memberships'] as $membershipId => $membershipValues) { + $membershipInherittedFromContactID = NULL; + if (!empty($membershipValues['owner_membership_id'])) { + // Use get not getsingle so that we get e-notice noise but not a fatal is the membership has already been deleted. + $inheritedFromMembership = civicrm_api3('Membership', 'get', ['id' => $membershipValues['owner_membership_id'], 'sequential' => 1])['values'][0]; + $membershipInherittedFromContactID = (int) $inheritedFromMembership['contact_id']; + } $relTypeIds = []; if ($action & CRM_Core_Action::DELETE) { - // Delete memberships of the related contacts only if relationship type exists for membership type - $query = " -SELECT relationship_type_id, relationship_direction - FROM civicrm_membership_type - WHERE id = {$membershipValues['membership_type_id']}"; - $dao = CRM_Core_DAO::executeQuery($query); - $relTypeDirs = []; - while ($dao->fetch()) { - $relTypeId = $dao->relationship_type_id; - $relDirection = $dao->relationship_direction; - } - $relTypeIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $relTypeId); - if (in_array($values[$cid]['relationshipTypeId'], $relTypeIds - //CRM-16300 check if owner membership exist for related membership - ) && !empty($membershipValues['owner_membership_id']) && !empty($values[$mainRelatedContactId]['memberships'][$membershipValues['owner_membership_id']])) { + // @todo don't return relTypeId here - but it seems to be used later in a cryptic way (hint cryptic is not a complement). + list($relTypeId, $isDeletable) = self::isInheritedMembershipInvalidated($membershipValues, $values, $cid, $mainRelatedContactId); + if ($isDeletable) { CRM_Member_BAO_Membership::deleteRelatedMemberships($membershipValues['owner_membership_id'], $membershipValues['membership_contact_id']); } continue; @@ -1758,17 +1776,10 @@ SELECT relationship_type_id, relationship_direction if (!empty($membershipValues['status_id']) && $membershipValues['status_id'] == $pendingStatusId) { $membershipValues['skipStatusCal'] = TRUE; } - - // check whether we have some related memberships still available - $query = " -SELECT count(*) - FROM civicrm_membership - LEFT JOIN civicrm_membership_status ON (civicrm_membership_status.id = civicrm_membership.status_id) - WHERE membership_type_id = {$membershipValues['membership_type_id']} AND owner_membership_id = {$membershipValues['owner_membership_id']} - AND is_current_member = 1"; - $result = CRM_Core_DAO::singleValueQuery($query); - if ($result < CRM_Utils_Array::value('max_related', $membershipValues, PHP_INT_MAX)) { - CRM_Member_BAO_Membership::create($membershipValues); + // As long as the membership itself was not created by inheritance from the same contact + // that stands to inherit the membership we add an inherited membership. + if ($membershipInherittedFromContactID !== (int) $membershipValues['contact_id']) { + $membershipValues = self::addInheritedMembership($membershipValues); } } } @@ -2324,4 +2335,50 @@ AND cc.sort_name LIKE '%$name%'"; return $isCurrentEmployerRelationshipType; } + /** + * Is the inherited relationship invalidated by this relationship change. + * + * @param $membershipValues + * @param array $values + * @param int $cid + * @param int $mainRelatedContactId + * + * @return array + * @throws \CiviCRM_API3_Exception + */ + private static function isInheritedMembershipInvalidated($membershipValues, array $values, $cid, $mainRelatedContactId): array { + $membershipType = CRM_Member_BAO_MembershipType::getMembershipType($membershipValues['membership_type_id']); + $relTypeIds = $membershipType['relationship_type_id']; + $membshipInheritedFrom = $membershipValues['owner_membership_id'] ?? NULL; + if (!$membshipInheritedFrom || !in_array($values[$cid]['relationshipTypeId'], $relTypeIds)) { + return [implode(',', $relTypeIds), FALSE]; + } + //CRM-16300 check if owner membership exist for related membership + $isDeletable = !empty($values[$mainRelatedContactId]['memberships'][$membshipInheritedFrom]); + return [implode(',', $relTypeIds), $isDeletable]; + } + + /** + * Add an inherited membership, provided max related not exceeded. + * + * @param array $membershipValues + * + * @return array + * @throws \CRM_Core_Exception + */ + protected static function addInheritedMembership($membershipValues) { + $query = " +SELECT count(*) + FROM civicrm_membership + LEFT JOIN civicrm_membership_status ON (civicrm_membership_status.id = civicrm_membership.status_id) + WHERE membership_type_id = {$membershipValues['membership_type_id']} + AND owner_membership_id = {$membershipValues['owner_membership_id']} + AND is_current_member = 1"; + $result = CRM_Core_DAO::singleValueQuery($query); + if ($result < CRM_Utils_Array::value('max_related', $membershipValues, PHP_INT_MAX)) { + CRM_Member_BAO_Membership::create($membershipValues); + } + return $membershipValues; + } + } diff --git a/civicrm/CRM/Contact/BAO/SavedSearch.php b/civicrm/CRM/Contact/BAO/SavedSearch.php index 4037b828565e08991f62fe8ce96bc3eea4248816..749a716a4938d7b3cfc6ba298d49ffd311afe2b8 100644 --- a/civicrm/CRM/Contact/BAO/SavedSearch.php +++ b/civicrm/CRM/Contact/BAO/SavedSearch.php @@ -443,13 +443,6 @@ LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_ 'case_to_relative', 'participant_relative', 'log_date_relative', - 'pledge_payment_date_relative', - 'pledge_start_date_relative', - 'pledge_end_date_relative', - 'pledge_create_date_relative', - 'member_join_date_relative', - 'member_start_date_relative', - 'member_end_date_relative', 'birth_date_relative', 'deceased_date_relative', 'mailing_date_relative', diff --git a/civicrm/CRM/Contact/DAO/Contact.php b/civicrm/CRM/Contact/DAO/Contact.php index 5bc2b38a3b2a2ec5b9aeee63d4d97e0019bbe476..a7da4e718e994db88e2fbf0bb70d0a7c9f1393c6 100644 --- a/civicrm/CRM/Contact/DAO/Contact.php +++ b/civicrm/CRM/Contact/DAO/Contact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Contact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:bd37bd31a0ac8ba4fd5f411fddef080b) + * (GenCodeChecksum:ee3bf9f2d1faed5a4de439ecf0537ac6) */ /** @@ -963,7 +963,9 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Communication Style'), 'description' => ts('Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.'), + 'import' => TRUE, 'where' => 'civicrm_contact.communication_style_id', + 'headerPattern' => '/style/i', 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', @@ -1589,6 +1591,22 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'localizable' => FALSE, 'sig' => 'civicrm_contact::0::is_deleted::sort_name::id', ], + 'index_created_date' => [ + 'name' => 'index_created_date', + 'field' => [ + 0 => 'created_date', + ], + 'localizable' => FALSE, + 'sig' => 'civicrm_contact::0::created_date', + ], + 'index_modified_date' => [ + 'name' => 'index_modified_date', + 'field' => [ + 0 => 'modified_date', + ], + 'localizable' => FALSE, + 'sig' => 'civicrm_contact::0::modified_date', + ], ]; return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables::multilingualize(__CLASS__, $indices) : $indices; } diff --git a/civicrm/CRM/Contact/Form/Contact.php b/civicrm/CRM/Contact/Form/Contact.php index f275cfa377f43641cc2fd4b88682ca8de9fa1ad5..11bef4a62927e7901ab37ba52ab0abe3a6f3ef30 100644 --- a/civicrm/CRM/Contact/Form/Contact.php +++ b/civicrm/CRM/Contact/Form/Contact.php @@ -227,7 +227,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); if ($defaults['is_deceased']) { - $displayName .= ' <span class="crm-contact-deceased">(deceased)</span>'; + $displayName .= ' <span class="crm-contact-deceased">(' . ts('deceased') . ')</span>'; } $displayName = ts('Edit %1', [1 => $displayName]); diff --git a/civicrm/CRM/Contact/Form/DedupeRules.php b/civicrm/CRM/Contact/Form/DedupeRules.php index 318138ff760792c1a1ebf924fbb73e4f6d8c1806..84dd28002b2cea382020064668db6bdf8cb7abbf 100644 --- a/civicrm/CRM/Contact/Form/DedupeRules.php +++ b/civicrm/CRM/Contact/Form/DedupeRules.php @@ -62,7 +62,7 @@ class CRM_Contact_Form_DedupeRules extends CRM_Admin_Form { // check if $contactType is valid $contactTypes = civicrm_api3('Contact', 'getOptions', ['field' => "contact_type", 'context' => "validate"]); $contactType = CRM_Utils_Request::retrieve('contact_type', 'String', $this, FALSE, 0); - if (CRM_Utils_Array::value($contactType, $contactTypes['values'])) { + if (!empty($contactTypes['values'][$contactType])) { $this->_contactType = $contactType; } elseif (!empty($contactType)) { diff --git a/civicrm/CRM/Contact/Form/Merge.php b/civicrm/CRM/Contact/Form/Merge.php index 91f282f6bb4ea9fc1cdb35c340119b0a1daa65da..da804021ea2ce1ab7eafde17ca6349518af0f62f 100644 --- a/civicrm/CRM/Contact/Form/Merge.php +++ b/civicrm/CRM/Contact/Form/Merge.php @@ -114,7 +114,7 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { CRM_Core_Session::singleton()->pushUserContext($browseUrl); } - $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $gid, json_decode($this->criteria, TRUE)); + $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $gid, json_decode($this->criteria, TRUE), TRUE, $this->limit); $join = CRM_Dedupe_Merger::getJoinOnDedupeTable(); $where = "de.id IS NULL"; @@ -331,7 +331,7 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { } if ($this->next && $this->_mergeId) { - $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $this->_gid, json_decode($this->criteria, TRUE)); + $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $this->_gid, json_decode($this->criteria, TRUE), TRUE, $this->limit); $join = CRM_Dedupe_Merger::getJoinOnDedupeTable(); $where = "de.id IS NULL"; diff --git a/civicrm/CRM/Contact/Form/Task/ProximityCommon.php b/civicrm/CRM/Contact/Form/Task/ProximityCommon.php index 6f632cb9de6e3741aa1a2dc845d05c00dac8a559..b4a0bb0ab3bf08aa5f17ab34e1c93f92818a2649 100644 --- a/civicrm/CRM/Contact/Form/Task/ProximityCommon.php +++ b/civicrm/CRM/Contact/Form/Task/ProximityCommon.php @@ -107,9 +107,7 @@ class CRM_Contact_Form_Task_ProximityCommon { if (empty($fields['prox_state_province_id']) || empty($fields['prox_country_id'])) { $errors["prox_state_province_id"] = ts("Country AND State/Province are required to search by distance."); } - if (!CRM_Utils_Array::value('prox_postal_code', $fields) and - !CRM_Utils_Array::value('prox_city', $fields) - ) { + if (empty($fields['prox_postal_code']) && empty($fields['prox_city'])) { $errors["prox_distance"] = ts("City OR Postal Code are required to search by distance."); } } diff --git a/civicrm/CRM/Contact/Import/Form/MapField.php b/civicrm/CRM/Contact/Import/Form/MapField.php index df77083cca2c33b163355ecc21cd9f26594203d2..0d2d3ce56ebe069d72a069622c2d554f5df7cf1c 100644 --- a/civicrm/CRM/Contact/Import/Form/MapField.php +++ b/civicrm/CRM/Contact/Import/Form/MapField.php @@ -36,6 +36,7 @@ */ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { + use CRM_Contact_Import_MetadataTrait; /** * An array of all contact fields with @@ -62,20 +63,19 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { * FIXME: This is essentially the same function as parent::defaultFromHeader * * @param string $columnName name of column header - * @param array $patterns pattern to match for the column * * @return string */ - public function defaultFromColumnName($columnName, $patterns) { + public function defaultFromColumnName($columnName) { if (!preg_match('/^[a-z0-9 ]$/i', $columnName)) { - if ($columnKey = array_search($columnName, $this->_mapperFields)) { + if ($columnKey = array_search($columnName, $this->getFieldTitles())) { $this->_fieldUsed[$columnKey] = TRUE; return $columnKey; } } - foreach ($patterns as $key => $re) { + foreach ($this->getHeaderPatterns() as $key => $re) { // Skip empty key/patterns if (!$key || !$re || strlen("$re") < 5) { continue; @@ -176,7 +176,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { } $showColNames = TRUE; - if ($dataSource == 'CRM_Import_DataSource_CSV' && !$skipColumnHeader) { + if ($dataSource === 'CRM_Import_DataSource_CSV' && !$skipColumnHeader) { $showColNames = FALSE; } $this->assign('showColNames', $showColNames); @@ -193,46 +193,12 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { /** * Build the form object. + * + * @throws \CiviCRM_API3_Exception */ public function buildQuickForm() { - //to save the current mappings - if (!$this->get('savedMapping')) { - $saveDetailsName = ts('Save this field mapping'); - $this->applyFilter('saveMappingName', 'trim'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - else { - $savedMapping = $this->get('savedMapping'); - - list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $mappingRelation, $mappingOperator, $mappingValue, $mappingWebsiteType) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping, TRUE); - - //get loaded Mapping Fields - $mappingName = CRM_Utils_Array::value(1, $mappingName); - $mappingLocation = CRM_Utils_Array::value(1, $mappingLocation); - $mappingPhoneType = CRM_Utils_Array::value(1, $mappingPhoneType); - $mappingImProvider = CRM_Utils_Array::value(1, $mappingImProvider); - $mappingRelation = CRM_Utils_Array::value(1, $mappingRelation); - $mappingWebsiteType = CRM_Utils_Array::value(1, $mappingWebsiteType); - - $this->assign('loadedMapping', $savedMapping); - $this->set('loadedMapping', $savedMapping); - - $params = ['id' => $savedMapping]; - $temp = []; - $mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp); - - $this->assign('savedName', $mappingDetails->name); - - $this->add('hidden', 'mappingId', $savedMapping); - - $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL); - $saveDetailsName = ts('Save as a new field mapping'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - - $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, ['onclick' => "showSaveDetails(this)"]); + $savedMappingID = (int) $this->get('savedMapping'); + $this->buildSavedMappingFields($savedMappingID); $this->addFormRule(['CRM_Contact_Import_Form_MapField', 'formRule']); @@ -241,8 +207,6 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $defaults = []; $mapperKeys = array_keys($this->_mapperFields); $hasColumnNames = !empty($this->_columnNames); - $columnPatterns = $this->get('columnPatterns'); - $dataPatterns = $this->get('dataPatterns'); $hasLocationTypes = $this->get('fieldTypes'); $this->_location_types = ['Primary' => ts('Primary')] + CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id'); @@ -301,7 +265,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { else { $id = $first = $second = NULL; } - if (($first == 'a' && $second == 'b') || ($first == 'b' && $second == 'a')) { + if (($first === 'a' && $second === 'b') || ($first === 'b' && $second === 'a')) { $cType = $contactRelationCache[$id]["contact_type_{$second}"]; //CRM-5125 for contact subtype specific relationshiptypes @@ -322,7 +286,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { if (isset($hasLocationTypes[$name])) { $sel3[$key][$name] = $this->_location_types; } - elseif ($name == 'url') { + elseif ($name === 'url') { $sel3[$key][$name] = $websiteTypes; } else { @@ -354,7 +318,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { } foreach ($highlightedFields as $k => $v) { - if ($v == $cType || $v == 'All') { + if ($v == $cType || $v === 'All') { $highlightedRelFields[$key][] = $k; } } @@ -385,7 +349,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { if (!empty($hasLocationTypes[$key])) { $options = $this->_location_types; } - elseif ($key == 'url') { + elseif ($key === 'url') { $options = $websiteTypes; } $sel2[$key] = $options; @@ -395,19 +359,26 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { $js = "<script type='text/javascript'>\n"; $formName = 'document.forms.' . $this->_name; //used to warn for mismatch column count or mismatch mapping - $warning = 0; + CRM_Core_Session::singleton()->setStatus(NULL); + $processor = new CRM_Import_ImportProcessor(); + $processor->setMappingID($savedMappingID); + $processor->setFormName($formName); + $processor->setMetadata($this->getContactImportMetadata()); + $processor->setContactTypeByConstant($this->get('contactType')); + $processor->setContactSubType($this->get('contactSubType')); + for ($i = 0; $i < $this->_columnCount; $i++) { $sel = &$this->addElement('hierselect', "mapper[$i]", ts('Mapper for Field %1', [1 => $i]), NULL); - if ($this->get('savedMapping')) { - list($mappingName, $defaults, $js) = $this->loadSavedMapping($mappingName, $i, $mappingRelation, $mappingWebsiteType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $defaults, $formName, $js, $hasColumnNames, $dataPatterns, $columnPatterns); + if ($this->get('savedMapping') && $processor->getFieldName($i)) { + $defaults["mapper[$i]"] = $processor->getSavedQuickformDefaultsForColumn($i); + $js .= $processor->getQuickFormJSForField($i); } else { $js .= "swapOptions($formName, 'mapper[$i]', 0, 3, 'hs_mapper_0_');\n"; if ($hasColumnNames) { // do array search first to see if has mapped key - $columnKey = ''; - $columnKey = array_search($this->_columnNames[$i], $this->_mapperFields); + $columnKey = array_search($this->_columnNames[$i], $this->getFieldTitles()); if (isset($this->_fieldUsed[$columnKey])) { $defaults["mapper[$i]"] = $columnKey; $this->_fieldUsed[$key] = TRUE; @@ -415,9 +386,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { else { // Infer the default from the column names if we have them $defaults["mapper[$i]"] = [ - $this->defaultFromColumnName($this->_columnNames[$i], - $columnPatterns - ), + $this->defaultFromColumnName($this->_columnNames[$i]), 0, ]; } @@ -425,7 +394,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { else { // Otherwise guess the default from the form of the data $defaults["mapper[$i]"] = [ - $this->defaultFromData($dataPatterns, $i), + $this->defaultFromData($this->getDataPatterns(), $i), // $defaultLocationType->id 0, ]; @@ -441,16 +410,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { if (isset($mappingName) && ($this->_columnCount != count($mappingName)) ) { - $warning++; - } - - if ($warning != 0 && $this->get('savedMapping')) { - $session = CRM_Core_Session::singleton(); - $session->setStatus(ts('The data columns in this import file appear to be different from the saved mapping. Please verify that you have selected the correct saved mapping before continuing.')); - } - else { - $session = CRM_Core_Session::singleton(); - $session->setStatus(NULL); + CRM_Core_Session::singleton()->setStatus(ts('The data columns in this import file appear to be different from the saved mapping. Please verify that you have selected the correct saved mapping before continuing.')); } $this->setDefaults($defaults); @@ -597,17 +557,17 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { //need to differentiate non location elements. if ($selOne && (is_numeric($selOne) || $selOne === 'Primary')) { - if ($fldName == 'url') { + if ($fldName === 'url') { $parserParameters['mapperWebsiteType'][$i] = $websiteTypes[$selOne]; } else { $locations[$i] = $locationTypes[$selOne]; $parserParameters['mapperLocType'][$i] = $selOne; if ($selTwo && is_numeric($selTwo)) { - if ($fldName == 'phone') { + if ($fldName === 'phone') { $parserParameters['mapperPhoneType'][$i] = $phoneTypes[$selTwo]; } - elseif ($fldName == 'im') { + elseif ($fldName === 'im') { $parserParameters['mapperImProvider'][$i] = $imProviders[$selTwo]; } } @@ -616,21 +576,21 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { //relationship contact mapper info. list($id, $first, $second) = CRM_Utils_System::explode('_', $fldName, 3); - if (($first == 'a' && $second == 'b') || - ($first == 'b' && $second == 'a') + if (($first === 'a' && $second === 'b') || + ($first === 'b' && $second === 'a') ) { $parserParameters['mapperRelated'][$i] = $this->_mapperFields[$fldName]; if ($selOne) { - if ($selOne == 'url') { + if ($selOne === 'url') { $parserParameters['relatedContactWebsiteType'][$i] = $websiteTypes[$selTwo]; } else { $parserParameters['relatedContactLocType'][$i] = CRM_Utils_Array::value($selTwo, $locationTypes); if ($selThree) { - if ($selOne == 'phone') { + if ($selOne === 'phone') { $parserParameters['relatedContactPhoneType'][$i] = $phoneTypes[$selThree]; } - elseif ($selOne == 'im') { + elseif ($selOne === 'im') { $parserParameters['relatedContactImProvider'][$i] = $imProviders[$selThree]; } } @@ -703,7 +663,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { elseif (CRM_Utils_Array::value('1', $mapperKeys[$i]) == 'im') { $updateMappingFields->im_provider_id = isset($mapperKeys[$i][3]) ? $mapperKeys[$i][3] : NULL; } - $updateMappingFields->location_type_id = isset($mapperKeys[$i][2]) ? $mapperKeys[$i][2] : NULL; + $updateMappingFields->location_type_id = isset($mapperKeys[$i][2]) && is_numeric($mapperKeys[$i][2]) ? $mapperKeys[$i][2] : NULL; } } else { @@ -848,160 +808,4 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField { return $saveMappingFields->mapping_id; } - /** - * @param $mappingName - * @param int $i - * @param $mappingRelation - * @param $mappingWebsiteType - * @param $mappingLocation - * @param $mappingPhoneType - * @param $mappingImProvider - * @param array $defaults - * @param string $formName - * @param string $js - * @param bool $hasColumnNames - * @param array $dataPatterns - * @param array $columnPatterns - * - * @return array - */ - protected function loadSavedMapping($mappingName, $i, $mappingRelation, $mappingWebsiteType, $mappingLocation, $mappingPhoneType, $mappingImProvider, $defaults, $formName, $js, $hasColumnNames, $dataPatterns, $columnPatterns) { - $jsSet = FALSE; - if (isset($mappingName[$i])) { - if ($mappingName[$i] != ts('- do not import -')) { - - if (isset($mappingRelation[$i])) { - // relationship mapping - switch ($this->get('contactType')) { - case CRM_Import_Parser::CONTACT_INDIVIDUAL: - $contactType = 'Individual'; - break; - - case CRM_Import_Parser::CONTACT_HOUSEHOLD: - $contactType = 'Household'; - break; - - case CRM_Import_Parser::CONTACT_ORGANIZATION: - $contactType = 'Organization'; - } - //CRM-5125 - $contactSubType = NULL; - if ($this->get('contactSubType')) { - $contactSubType = $this->get('contactSubType'); - } - - $relations = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $contactType, - FALSE, 'label', TRUE, $contactSubType - ); - - foreach ($relations as $key => $var) { - if ($key == $mappingRelation[$i]) { - $relation = $key; - break; - } - } - - $contactDetails = strtolower(str_replace(" ", "_", $mappingName[$i])); - $websiteTypeId = isset($mappingWebsiteType[$i]) ? $mappingWebsiteType[$i] : NULL; - $locationId = isset($mappingLocation[$i]) ? $mappingLocation[$i] : 0; - $phoneType = isset($mappingPhoneType[$i]) ? $mappingPhoneType[$i] : NULL; - //get provider id from saved mappings - $imProvider = isset($mappingImProvider[$i]) ? $mappingImProvider[$i] : NULL; - - if ($websiteTypeId) { - $defaults["mapper[$i]"] = [$relation, $contactDetails, $websiteTypeId]; - if (!$websiteTypeId) { - $js .= "{$formName}['mapper[$i][2]'].style.display = 'none';\n"; - } - } - else { - // default for IM/phone when mapping with relation is true - $typeId = NULL; - if (isset($phoneType)) { - $typeId = $phoneType; - } - elseif (isset($imProvider)) { - $typeId = $imProvider; - } - $defaults["mapper[$i]"] = [$relation, $contactDetails, $locationId, $typeId]; - if (!$locationId) { - $js .= "{$formName}['mapper[$i][2]'].style.display = 'none';\n"; - } - } - // fix for edge cases, CRM-4954 - if ($contactDetails == 'image_url') { - $contactDetails = str_replace('url', 'URL', $contactDetails); - } - - if (!$contactDetails) { - $js .= "{$formName}['mapper[$i][1]'].style.display = 'none';\n"; - } - - if ((!$phoneType) && (!$imProvider)) { - $js .= "{$formName}['mapper[$i][3]'].style.display = 'none';\n"; - } - //$js .= "{$formName}['mapper[$i][3]'].style.display = 'none';\n"; - $jsSet = TRUE; - } - else { - $mappingHeader = array_keys($this->_mapperFields, $mappingName[$i]); - $websiteTypeId = isset($mappingWebsiteType[$i]) ? $mappingWebsiteType[$i] : NULL; - $locationId = isset($mappingLocation[$i]) ? $mappingLocation[$i] : 0; - $phoneType = isset($mappingPhoneType[$i]) ? $mappingPhoneType[$i] : NULL; - // get IM service provider id - $imProvider = isset($mappingImProvider[$i]) ? $mappingImProvider[$i] : NULL; - - if ($websiteTypeId) { - if (!$websiteTypeId) { - $js .= "{$formName}['mapper[$i][1]'].style.display = 'none';\n"; - } - $defaults["mapper[$i]"] = [$mappingHeader[0], $websiteTypeId]; - } - else { - if (!$locationId) { - $js .= "{$formName}['mapper[$i][1]'].style.display = 'none';\n"; - } - //default for IM/phone without related contact - $typeId = NULL; - if (isset($phoneType)) { - $typeId = $phoneType; - } - elseif (isset($imProvider)) { - $typeId = $imProvider; - } - $defaults["mapper[$i]"] = [$mappingHeader[0] ?? '', $locationId, $typeId]; - } - - if ((!$phoneType) && (!$imProvider)) { - $js .= "{$formName}['mapper[$i][2]'].style.display = 'none';\n"; - } - - $js .= "{$formName}['mapper[$i][3]'].style.display = 'none';\n"; - - $jsSet = TRUE; - } - } - else { - $defaults["mapper[$i]"] = []; - } - if (!$jsSet) { - for ($k = 1; $k < 4; $k++) { - $js .= "{$formName}['mapper[$i][$k]'].style.display = 'none';\n"; - } - } - } - else { - // this load section to help mapping if we ran out of saved columns when doing Load Mapping - $js .= "swapOptions($formName, 'mapper[$i]', 0, 3, 'hs_mapper_0_');\n"; - - if ($hasColumnNames) { - $defaults["mapper[$i]"] = [$this->defaultFromColumnName($this->_columnNames[$i], $columnPatterns)]; - } - else { - $defaults["mapper[$i]"] = [$this->defaultFromData($dataPatterns, $i)]; - } - } - return [$mappingName, $defaults, $js]; - } - } diff --git a/civicrm/CRM/Contact/Import/MetadataTrait.php b/civicrm/CRM/Contact/Import/MetadataTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..ba55c45f3830a2b6f5e4a26c66e9272254f152ad --- /dev/null +++ b/civicrm/CRM/Contact/Import/MetadataTrait.php @@ -0,0 +1,122 @@ +<?php + +/** + * Trait CRM_Contact_Import_MetadataTrait + * + * Trait for handling contact import specific metadata so it + * does not need to be passed from one form to the next. + */ +trait CRM_Contact_Import_MetadataTrait { + + /** + * Get metadata for contact importable fields. + * + * @return array + */ + protected function getContactImportMetadata(): array { + $cacheKey = 'importable_contact_field_metadata' . $this->getContactType() . $this->getContactSubType(); + if (Civi::cache('fields')->has($cacheKey)) { + return Civi::cache('fields')->get($cacheKey); + } + $contactFields = CRM_Contact_BAO_Contact::importableFields($this->getContactType()); + // exclude the address options disabled in the Address Settings + $fields = CRM_Core_BAO_Address::validateAddressOptions($contactFields); + + //CRM-5125 + //supporting import for contact subtypes + $csType = NULL; + if ($this->getContactSubType()) { + //custom fields for sub type + $subTypeFields = CRM_Core_BAO_CustomField::getFieldsForImport($this->getContactSubType()); + + if (!empty($subTypeFields)) { + foreach ($subTypeFields as $customSubTypeField => $details) { + $fields[$customSubTypeField] = $details; + } + } + } + + foreach ($this->getRelationships() as $key => $var) { + list($type) = explode('_', $key); + $relationshipType[$key]['title'] = $var; + $relationshipType[$key]['headerPattern'] = '/' . preg_quote($var, '/') . '/'; + $relationshipType[$key]['import'] = TRUE; + $relationshipType[$key]['relationship_type_id'] = $type; + $relationshipType[$key]['related'] = TRUE; + } + + if (!empty($relationshipType)) { + $fields = array_merge($fields, [ + 'related' => [ + 'title' => ts('- related contact info -'), + ], + ], $relationshipType); + } + Civi::cache('fields')->set($cacheKey, $fields); + return $fields; + } + + /** + * Get sorted available relationships. + * + * @return array + */ + protected function getRelationships(): array { + $cacheKey = 'importable_contact_relationship_field_metadata' . $this->getContactType() . $this->getContactSubType(); + if (Civi::cache('fields')->has($cacheKey)) { + return Civi::cache('fields')->get($cacheKey); + } + //Relationship importables + $relations = CRM_Contact_BAO_Relationship::getContactRelationshipType( + NULL, NULL, NULL, $this->getContactType(), + FALSE, 'label', TRUE, $this->getContactSubType() + ); + asort($relations); + Civi::cache('fields')->set($cacheKey, $relations); + return $relations; + } + + /** + * Get an array of header patterns for importable keys. + * + * @return array + */ + public function getHeaderPatterns() { + return CRM_Utils_Array::collect('headerPattern', $this->getContactImportMetadata()); + } + + /** + * Get an array of header patterns for importable keys. + * + * @return array + */ + public function getDataPatterns() { + return CRM_Utils_Array::collect('dataPattern', $this->getContactImportMetadata()); + } + + /** + * Get an array of header patterns for importable keys. + * + * @return array + */ + public function getFieldTitles() { + return CRM_Utils_Array::collect('title', $this->getContactImportMetadata()); + } + + /** + * Get configured contact type. + */ + protected function getContactType() { + return $this->_contactType ?? 'Individual'; + } + + /** + * Get configured contact sub type. + * + * @return string + */ + protected function getContactSubType() { + return $this->_contactSubType ?? NULL; + } + +} diff --git a/civicrm/CRM/Contact/Import/Parser.php b/civicrm/CRM/Contact/Import/Parser.php index c0fac2ee073fdaf05268afc9d0db450b2ee3cec2..067582ace351f9a4fa53bfbcba8b57cf8b22eb96 100644 --- a/civicrm/CRM/Contact/Import/Parser.php +++ b/civicrm/CRM/Contact/Import/Parser.php @@ -578,6 +578,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { * @return array */ public function getColumnPatterns() { + CRM_Core_Error::deprecatedFunctionWarning('no longer used- use CRM_Contact_Import_MetadataTrait'); $values = []; foreach ($this->_fields as $name => $field) { $values[$name] = $field->_columnPattern; @@ -616,8 +617,6 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { $store->set('fields', $this->getSelectValues()); $store->set('fieldTypes', $this->getSelectTypes()); - $store->set('columnPatterns', $this->getColumnPatterns()); - $store->set('dataPatterns', $this->getDataPatterns()); $store->set('columnCount', $this->_activeFieldCount); $store->set('totalRowCount', $this->_totalCount); @@ -1207,6 +1206,7 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { if (!array_key_exists($blockFieldName, $values)) { continue; } + $blockIndex = $values['location_type_id'] . (!empty($values['phone_type_id']) ? '_' . $values['phone_type_id'] : ''); // block present in value array. if (!array_key_exists($blockFieldName, $params) || !is_array($params[$blockFieldName])) { @@ -1221,13 +1221,13 @@ abstract class CRM_Contact_Import_Parser extends CRM_Import_Parser { } _civicrm_api3_store_values($fields[$block], $values, - $params[$blockFieldName][$values['location_type_id']] + $params[$blockFieldName][$blockIndex] ); - $this->fillPrimary($params[$blockFieldName][$values['location_type_id']], $values, $block, CRM_Utils_Array::value('id', $params)); + $this->fillPrimary($params[$blockFieldName][$blockIndex], $values, $block, CRM_Utils_Array::value('id', $params)); if (empty($params['id']) && (count($params[$blockFieldName]) == 1)) { - $params[$blockFieldName][$values['location_type_id']]['is_primary'] = TRUE; + $params[$blockFieldName][$blockIndex]['is_primary'] = TRUE; } // we only process single block at a time. diff --git a/civicrm/CRM/Contact/Import/Parser/Contact.php b/civicrm/CRM/Contact/Import/Parser/Contact.php index a93dfc1ae4000f210e5beca1a4bb3c5abd02f15a..1002b8adcbccc9cfa2f691f876b7310489fd7acb 100644 --- a/civicrm/CRM/Contact/Import/Parser/Contact.php +++ b/civicrm/CRM/Contact/Import/Parser/Contact.php @@ -37,6 +37,9 @@ require_once 'api/v3/utils.php'; * class to parse contact csv files */ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { + + use CRM_Contact_Import_MetadataTrait; + protected $_mapperKeys = []; protected $_mapperLocType = []; protected $_mapperPhoneType; @@ -122,11 +125,11 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { * @param array $mapperRelatedContactWebsiteType */ public function __construct( - &$mapperKeys, $mapperLocType = [], $mapperPhoneType = [], $mapperImProvider = [], $mapperRelated = [], $mapperRelatedContactType = [], $mapperRelatedContactDetails = [], $mapperRelatedContactLocType = [], $mapperRelatedContactPhoneType = [], $mapperRelatedContactImProvider = [], + $mapperKeys, $mapperLocType = [], $mapperPhoneType = [], $mapperImProvider = [], $mapperRelated = [], $mapperRelatedContactType = [], $mapperRelatedContactDetails = [], $mapperRelatedContactLocType = [], $mapperRelatedContactPhoneType = [], $mapperRelatedContactImProvider = [], $mapperWebsiteType = [], $mapperRelatedContactWebsiteType = [] ) { parent::__construct(); - $this->_mapperKeys = &$mapperKeys; + $this->_mapperKeys = $mapperKeys; $this->_mapperLocType = &$mapperLocType; $this->_mapperPhoneType = &$mapperPhoneType; $this->_mapperWebsiteType = $mapperWebsiteType; @@ -2054,49 +2057,9 @@ class CRM_Contact_Import_Parser_Contact extends CRM_Contact_Import_Parser { * Set field metadata. */ protected function setFieldMetadata() { - $contactFields = CRM_Contact_BAO_Contact::importableFields($this->_contactType); - // exclude the address options disabled in the Address Settings - $fields = CRM_Core_BAO_Address::validateAddressOptions($contactFields); - - //CRM-5125 - //supporting import for contact subtypes - $csType = NULL; - if (!empty($this->_contactSubType)) { - //custom fields for sub type - $subTypeFields = CRM_Core_BAO_CustomField::getFieldsForImport($this->_contactSubType); - - if (!empty($subTypeFields)) { - foreach ($subTypeFields as $customSubTypeField => $details) { - $fields[$customSubTypeField] = $details; - } - } - } - - //Relationship importables - $this->_relationships = $relations - = CRM_Contact_BAO_Relationship::getContactRelationshipType( - NULL, NULL, NULL, $this->_contactType, - FALSE, 'label', TRUE, $this->_contactSubType - ); - asort($relations); - - foreach ($relations as $key => $var) { - list($type) = explode('_', $key); - $relationshipType[$key]['title'] = $var; - $relationshipType[$key]['headerPattern'] = '/' . preg_quote($var, '/') . '/'; - $relationshipType[$key]['import'] = TRUE; - $relationshipType[$key]['relationship_type_id'] = $type; - $relationshipType[$key]['related'] = TRUE; - } - - if (!empty($relationshipType)) { - $fields = array_merge($fields, [ - 'related' => [ - 'title' => ts('- related contact info -'), - ], - ], $relationshipType); - } - $this->setImportableFieldsMetadata($fields); + $this->setImportableFieldsMetadata($this->getContactImportMetadata()); + // Probably no longer needed but here for now. + $this->_relationships = $this->getRelationships(); } } diff --git a/civicrm/CRM/Contact/Page/AJAX.php b/civicrm/CRM/Contact/Page/AJAX.php index 7dcedcc8cd5f3439b2dafe1fb7c63d9268de56d7..3ac0326cf743eecfef9239b012f5737c38486c86 100644 --- a/civicrm/CRM/Contact/Page/AJAX.php +++ b/civicrm/CRM/Contact/Page/AJAX.php @@ -638,6 +638,7 @@ LIMIT {$offset}, {$rowCount} $gid = CRM_Utils_Request::retrieve('gid', 'Positive'); $rgid = CRM_Utils_Request::retrieve('rgid', 'Positive'); + $limit = CRM_Utils_Request::retrieveValue('limit', 'Positive', 0); $null = NULL; $criteria = CRM_Utils_Request::retrieve('criteria', 'Json', $null, FALSE, '{}'); $selected = CRM_Utils_Request::retrieveValue('selected', 'Boolean'); @@ -646,7 +647,7 @@ LIMIT {$offset}, {$rowCount} } $whereClause = $orderByClause = ''; - $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, json_decode($criteria, TRUE)); + $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, json_decode($criteria, TRUE), TRUE, $limit); $searchRows = []; diff --git a/civicrm/CRM/Contact/Page/DedupeFind.php b/civicrm/CRM/Contact/Page/DedupeFind.php index 8b22a7140d9286a084c5a455f079210133b1608a..b7a22ea66611a6c03b1a5d94b59289254333f04e 100644 --- a/civicrm/CRM/Contact/Page/DedupeFind.php +++ b/civicrm/CRM/Contact/Page/DedupeFind.php @@ -105,13 +105,13 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic { 'reset' => 1, 'rgid' => $rgid, 'gid' => $gid, - 'limit' => $limit, + 'limit' => (int) $limit, 'criteria' => $criteria, ]; $this->assign('urlQuery', CRM_Utils_System::makeQueryString($urlQry)); $this->assign('isSelected', $this->isSelected()); $criteria = json_decode($criteria, TRUE); - $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria); + $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, TRUE, $limit); $this->assign('cacheKey', $cacheKeyString); if ($context == 'search') { @@ -129,7 +129,7 @@ class CRM_Contact_Page_DedupeFind extends CRM_Core_Page_Basic { } elseif ($action & CRM_Core_Action::MAP) { // do a batch merge if requested - $result = CRM_Dedupe_Merger::batchMerge($rgid, $gid, 'safe', 75, 2, $criteria); + $result = CRM_Dedupe_Merger::batchMerge($rgid, $gid, 'safe', 75, 2, $criteria, TRUE, NULL, $limit); $skippedCount = CRM_Utils_Request::retrieve('skipped', 'Positive', $this, FALSE, 0); $skippedCount = $skippedCount + count($result['skipped']); diff --git a/civicrm/CRM/Contact/Page/DedupeMerge.php b/civicrm/CRM/Contact/Page/DedupeMerge.php index 1dddf5619470e97e645661939532c1595ecb4bbf..348f65b1d8f8a4010ad3c813f5f85aa4de8ff9e8 100644 --- a/civicrm/CRM/Contact/Page/DedupeMerge.php +++ b/civicrm/CRM/Contact/Page/DedupeMerge.php @@ -70,7 +70,7 @@ class CRM_Contact_Page_DedupeMerge extends CRM_Core_Page { ]; $criteria = json_decode($criteria, TRUE); - $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria); + $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, TRUE, $limit); if ($mode == 'aggressive' && !CRM_Core_Permission::check('force merge duplicate contacts')) { CRM_Core_Session::setStatus(ts('You do not have permission to force merge duplicate contact records'), ts('Permission Denied'), 'error'); @@ -98,7 +98,7 @@ class CRM_Contact_Page_DedupeMerge extends CRM_Core_Page { for ($i = 1; $i <= ceil($total / self::BATCHLIMIT); $i++) { $task = new CRM_Queue_Task( ['CRM_Contact_Page_DedupeMerge', 'callBatchMerge'], - [$rgid, $gid, $mode, self::BATCHLIMIT, $onlyProcessSelected, $criteria], + [$rgid, $gid, $mode, self::BATCHLIMIT, $onlyProcessSelected, $criteria, $limit], "Processed " . $i * self::BATCHLIMIT . " pair of duplicates out of " . $total ); @@ -132,11 +132,15 @@ class CRM_Contact_Page_DedupeMerge extends CRM_Core_Page { * @param int $batchLimit * @param int $isSelected * @param array $criteria + * @param int $searchLimit * * @return int + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ - public static function callBatchMerge(CRM_Queue_TaskContext $ctx, $rgid, $gid, $mode = 'safe', $batchLimit, $isSelected, $criteria) { - CRM_Dedupe_Merger::batchMerge($rgid, $gid, $mode, $batchLimit, $isSelected, $criteria, TRUE, FALSE); + public static function callBatchMerge(CRM_Queue_TaskContext $ctx, $rgid, $gid, $mode = 'safe', $batchLimit, $isSelected, $criteria, $searchLimit) { + CRM_Dedupe_Merger::batchMerge($rgid, $gid, $mode, $batchLimit, $isSelected, $criteria, TRUE, FALSE, $searchLimit); return CRM_Queue_Task::TASK_SUCCESS; } diff --git a/civicrm/CRM/Contact/Page/View.php b/civicrm/CRM/Contact/Page/View.php index 8f7a78f214a50250d1dc0d8ce2731f1c2c25653f..52fb0683bb1d5a351f118b29a94c604352aa81e7 100644 --- a/civicrm/CRM/Contact/Page/View.php +++ b/civicrm/CRM/Contact/Page/View.php @@ -323,7 +323,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { // set page title $title = "{$contactImage} {$displayName}"; if ($contactDetails[$contactId]['isDeceased']) { - $title .= ' <span class="crm-contact-deceased">(deceased)</span>'; + $title .= ' <span class="crm-contact-deceased">(' . ts('deceased') . ')</span>'; } if ($isDeleted) { $title = "<del>{$title}</del>"; diff --git a/civicrm/CRM/Contribute/BAO/Contribution.php b/civicrm/CRM/Contribute/BAO/Contribution.php index 0268840ba9b687e4c3e2e7fc30ce9cf1723fb45a..33a350ef6ae8a7cb681e0d680d8ee762975bb9f1 100644 --- a/civicrm/CRM/Contribute/BAO/Contribution.php +++ b/civicrm/CRM/Contribute/BAO/Contribution.php @@ -241,7 +241,16 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { //add Account details $params['contribution'] = $contribution; - self::recordFinancialAccounts($params); + if (empty($params['is_post_payment_create'])) { + // If this is being called from the Payment.create api/ BAO then that Entity + // takes responsibility for the financial transactions. In fact calling Payment.create + // to add payments & having it call completetransaction and / or contribution.create + // to update related entities is the preferred flow. + // Note that leveraging this parameter for any other code flow is not supported and + // is likely to break in future and / or cause serious problems in your data. + // https://github.com/civicrm/civicrm-core/pull/14673 + self::recordFinancialAccounts($params); + } if (self::isUpdateToRecurringContribution($params)) { CRM_Contribute_BAO_ContributionRecur::updateOnNewPayment( @@ -946,19 +955,10 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { * @return int */ public static function getToFinancialAccount($contribution, $params) { - $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); - CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); - $pendingStatus = [ - array_search('Pending', $contributionStatuses), - array_search('In Progress', $contributionStatuses), - ]; - if (in_array(CRM_Utils_Array::value('contribution_status_id', $contribution), $pendingStatus)) { - return CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contribution['financial_type_id'], 'Accounts Receivable Account is'); - } - elseif (!empty($params['payment_processor'])) { + if (!empty($params['payment_processor'])) { return CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($contribution['payment_processor'], NULL, 'civicrm_payment_processor'); } - elseif (!empty($params['payment_instrument_id'])) { + if (!empty($params['payment_instrument_id'])) { return CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($contribution['payment_instrument_id']); } else { @@ -1016,6 +1016,7 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { * @return array */ protected static function cancel($processContributionObject, $memberships, $contributionId, $membershipStatuses, $updateResult, $participant, $oldStatus, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId) { + // @fixme https://lab.civicrm.org/dev/core/issues/927 Cancelling membership etc is not desirable for all use-cases and we should be able to disable it $processContribution = FALSE; $participantStatuses = CRM_Event_PseudoConstant::participantStatus(); if (is_array($memberships)) { @@ -1205,6 +1206,27 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { return [TRUE, $isARefund]; } + /** + * It is possible to override the membership id that is updated from the payment processor. + * + * Historically Paypal does this & it still does if it determines data is messed up - see + * https://lab.civicrm.org/dev/membership/issues/13 + * + * Read the comment block on repeattransaction for more information + * about how things should work. + * + * @param int $contributionID + * @param array $input + * + * @throws \CiviCRM_API3_Exception + */ + protected static function handleMembershipIDOverride($contributionID, $input) { + if (!empty($input['membership_id'])) { + Civi::log()->debug('The related membership id has been overridden - this may impact data - see https://github.com/civicrm/civicrm-core/pull/15053'); + civicrm_api3('MembershipPayment', 'create', ['contribution_id' => $contributionID, 'membership_id' => $input['membership_id']]); + } + } + /** * @inheritDoc */ @@ -2400,11 +2422,35 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ /** * Repeat a transaction as part of a recurring series. * - * Only call this via the api as it is being refactored. The intention is that the repeatTransaction function - * (possibly living on the ContributionRecur BAO) would be called first to create a pending contribution with a - * subsequent call to the contribution.completetransaction api. - * - * The completeTransaction functionality has historically been overloaded to both complete and repeat payments. + * The ideal flow is + * 1) Processor calls contribution.repeattransaction with contribution_status_id = Pending + * 2) The repeattransaction loads the 'template contribution' and calls a hook to allow altering of it . + * 3) Repeat transaction calls order.create to create the pending contribution with correct line items + * and associated entities. + * 4) The calling code calls Payment.create which in turn calls CompleteOrder (if completing) + * which updates the various entities and sends appropriate emails. + * + * Gaps in the above (@todo) + * 1) many processors still call repeattransaction with contribution_status_id = Completed + * 2) repeattransaction code is current munged into completeTransaction code for historical bad coding reasons + * 3) Repeat transaction duplicates rather than calls Order.create + * 4) Use of payment.create still limited - completetransaction is more common. + * 5) the template transaction is tricky - historically we used the first contribution + * linked to a recurring contribution. More recently that was changed to be the most recent. + * Ideally it would be an actual template - not a contribution used as a template which + * would give more appropriate flexibility. Note line_items have an entity so that table + * could be used for the line item template - the difficulty is the custom fields... + * 6) the determination of the membership to be linked is tricksy. The prioritised method is + * to load the membership(s) referred to via line items in the template transactions. Any other + * method is likely to lead to incorrect line items & related entities being created (as the line_item + * link is a required part of 'correct data'). However there are 3 other methods to determine it + * - membership_payment record + * - civicrm_membership.contribution_recur_id + * - input override. + * Passing in an input override WILL ensure the membership is extended to prevent regressions + * of historical processors since this has been handled 'forever' - specifically for paypal. + * albeit by an even nastier mechanism than the current input override. + * The count is out on how correct related entities wind up in this case. * * @param CRM_Contribute_BAO_Contribution $contribution * @param array $input @@ -2468,6 +2514,7 @@ LEFT JOIN civicrm_contribution contribution ON ( componentPayment.contribution_ $createContribution = civicrm_api3('Contribution', 'create', $contributionParams); $contribution->id = $createContribution['id']; CRM_Contribute_BAO_ContributionRecur::copyCustomValues($contributionParams['contribution_recur_id'], $contribution->id); + self::handleMembershipIDOverride($contribution->id, $input); return TRUE; } } @@ -2962,7 +3009,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac if (!empty($lineItems)) { $firstLineItem = reset($lineItems); $priceSet = []; - if (CRM_Utils_Array::value('price_set_id', $firstLineItem)) { + if (!empty($firstLineItem['price_set_id'])) { $priceSet = civicrm_api3('PriceSet', 'getsingle', [ 'id' => $firstLineItem['price_set_id'], 'return' => 'is_quick_config, id', @@ -3901,40 +3948,6 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac return FALSE; } - /** - * Function to record additional payment for partial and refund contributions. - * - * @param int $contributionId - * is the invoice contribution id (got created after processing participant payment). - * @param array $trxnsData - * to take user provided input of transaction details. - * @param string $paymentType - * 'owed' for purpose of recording partial payments, 'refund' for purpose of recording refund payments. - * @param int $participantId - * @param bool $updateStatus - * - * @return int - * - * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception - */ - public static function recordAdditionalPayment($contributionId, $trxnsData, $paymentType = 'owed', $participantId = NULL, $updateStatus = TRUE) { - - if ($paymentType == 'owed') { - $financialTrxn = CRM_Financial_BAO_Payment::recordPayment($contributionId, $trxnsData, $participantId); - if (!empty($financialTrxn)) { - self::recordPaymentActivity($contributionId, $participantId, $financialTrxn->total_amount, $financialTrxn->currency, $financialTrxn->trxn_date); - return $financialTrxn->id; - } - } - elseif ($paymentType == 'refund') { - $trxnsData['total_amount'] = -$trxnsData['total_amount']; - $trxnsData['participant_id'] = $participantId; - $trxnsData['contribution_id'] = $contributionId; - return civicrm_api3('Payment', 'create', $trxnsData)['id']; - } - } - /** * @param int $targetCid * @param $activityType @@ -4013,7 +4026,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $baseTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contributionId); $baseTrxnId = $baseTrxnId['financialTrxnId']; } - if (!CRM_Utils_Array::value('total_amount', $total) || $usingLineTotal) { + if (empty($total['total_amount']) || $usingLineTotal) { $total = CRM_Price_BAO_LineItem::getLineTotal($contributionId); } else { @@ -4408,10 +4421,16 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac * @param CRM_Core_Transaction $transaction * @param int $recur * @param CRM_Contribute_BAO_Contribution $contribution + * @param bool $isPostPaymentCreate + * Is this being called from the payment.create api. If so the api has taken care of financial entities. + * Note that our goal is that this would only ever be called from payment.create and never handle financials (only + * transitioning related elements). * * @return array + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ - public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution) { + public static function completeOrder(&$input, &$ids, $objects, $transaction, $recur, $contribution, $isPostPaymentCreate = FALSE) { $primaryContributionID = isset($contribution->id) ? $contribution->id : $objects['first_contribution']->id; // The previous details are used when calculating line items so keep it before any code that 'does something' if (!empty($contribution->id)) { @@ -4531,6 +4550,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac } $contributionParams['id'] = $contribution->id; + $contributionParams['is_post_payment_create'] = $isPostPaymentCreate; // CRM-19309 - if you update the contribution here with financial_type_id it can/will mess with $lineItem // unsetting it here does NOT cause any other contribution test to fail! @@ -4538,7 +4558,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac $contributionResult = civicrm_api3('Contribution', 'create', $contributionParams); // Add new soft credit against current $contribution. - if (CRM_Utils_Array::value('contributionRecur', $objects) && $objects['contributionRecur']->id) { + if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id) { CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id); } @@ -5046,7 +5066,7 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac public static function checkContributeSettings($name = NULL, $checkInvoicing = FALSE) { $contributeSettings = Civi::settings()->get('contribution_invoice_settings'); - if ($checkInvoicing && !CRM_Utils_Array::value('invoicing', $contributeSettings)) { + if ($checkInvoicing && empty($contributeSettings['invoicing'])) { return NULL; } diff --git a/civicrm/CRM/Contribute/BAO/ContributionPage.php b/civicrm/CRM/Contribute/BAO/ContributionPage.php index 164ab946ab2e28a47329c09b60e6d9823e082f16..a108185d4291a796131b2f0cf6941c3f4b10ffaa 100644 --- a/civicrm/CRM/Contribute/BAO/ContributionPage.php +++ b/civicrm/CRM/Contribute/BAO/ContributionPage.php @@ -328,8 +328,7 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio if ($preID = CRM_Utils_Array::value('custom_pre_id', $values)) { if (!empty($values['related_contact'])) { $preProfileTypes = CRM_Core_BAO_UFGroup::profileGroups($preID); - //@todo - following line should not refer to undefined $postProfileTypes? figure out way to test - if (in_array('Individual', $preProfileTypes) || in_array('Contact', $postProfileTypes)) { + if (in_array('Individual', $preProfileTypes) || in_array('Contact', $preProfileTypes)) { //Take Individual contact ID $userID = CRM_Utils_Array::value('related_contact', $values); } diff --git a/civicrm/CRM/Contribute/BAO/ContributionRecur.php b/civicrm/CRM/Contribute/BAO/ContributionRecur.php index c6197f14cef709f1d8b9da6bcc574018e48a25f0..233377eb157f9c29984fbc23b22bf1aed276822b 100644 --- a/civicrm/CRM/Contribute/BAO/ContributionRecur.php +++ b/civicrm/CRM/Contribute/BAO/ContributionRecur.php @@ -284,6 +284,7 @@ class CRM_Contribute_BAO_ContributionRecur extends CRM_Contribute_DAO_Contributi $recur->cancel_date = date('YmdHis'); $recur->save(); + // @fixme https://lab.civicrm.org/dev/core/issues/927 Cancelling membership etc is not desirable for all use-cases and we should be able to disable it $dao = CRM_Contribute_BAO_ContributionRecur::getSubscriptionDetails($recurId); if ($dao && $dao->recur_id) { $details = CRM_Utils_Array::value('details', $activityParams); diff --git a/civicrm/CRM/Contribute/Form/AdditionalPayment.php b/civicrm/CRM/Contribute/Form/AdditionalPayment.php index f34854f597859a9c326c1dc911fb96ce9d88b2da..fdb7c478f3a9c81eb86813aa1df0568dee07aaf0 100644 --- a/civicrm/CRM/Contribute/Form/AdditionalPayment.php +++ b/civicrm/CRM/Contribute/Form/AdditionalPayment.php @@ -73,6 +73,11 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract public $_action = NULL; + /** + * Pre process form. + * + * @throws \CRM_Core_Exception + */ public function preProcess() { $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this, TRUE); @@ -118,11 +123,11 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $this->_paymentType = 'owed'; } else { - CRM_Core_Error::fatal(ts('No payment information found for this record')); + throw new CRM_Core_Exception(ts('No payment information found for this record')); } if (!empty($this->_mode) && $this->_paymentType == 'refund') { - CRM_Core_Error::fatal(ts('Credit card payment is not for Refund payments use')); + throw new CRM_Core_Exception(ts('Credit card payment is not for Refund payments use')); } list($this->_contributorDisplayName, $this->_contributorEmail) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contactID); @@ -139,6 +144,8 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract * Is this function being called from a datatable selector. * * If so we don't want to show the buttons. + * + * @throws \CRM_Core_Exception */ protected function isBeingCalledFromSelectorContext() { return CRM_Utils_Request::retrieve('selector', 'Positive'); @@ -356,19 +363,16 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract $this->processCreditCard(); } - $defaults = []; - $contribution = civicrm_api3('Contribution', 'getsingle', [ - 'return' => ["contribution_status_id"], - 'id' => $this->_contributionId, - ]); - $contributionStatusId = CRM_Utils_Array::value('contribution_status_id', $contribution); - $paymentID = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $this->_params, $this->_paymentType, $participantId); - // Fetch the contribution & do proportional line item assignment - $params = ['id' => $this->_contributionId]; - $contribution = CRM_Contribute_BAO_Contribution::retrieve($params, $defaults, $params); - // @todo - this line needs to be moved to the Payment.create api - it's not form layer appropriate. - // testing required. - CRM_Contribute_BAO_Contribution::addPayments([$contribution], $contributionStatusId); + $trxnsData = $this->_params; + if ($this->_paymentType == 'refund') { + $trxnsData['total_amount'] = -$trxnsData['total_amount']; + } + $trxnsData['participant_id'] = $participantId; + $trxnsData['contribution_id'] = $this->_contributionId; + // From the + $trxnsData['is_send_contribution_notification'] = FALSE; + $paymentID = civicrm_api3('Payment', 'create', $trxnsData)['id']; + if ($this->_contributionId && CRM_Core_Permission::access('CiviMember')) { $membershipPaymentCount = civicrm_api3('MembershipPayment', 'getCount', ['contribution_id' => $this->_contributionId]); if ($membershipPaymentCount) { diff --git a/civicrm/CRM/Contribute/Form/Contribution.php b/civicrm/CRM/Contribute/Form/Contribution.php index 23ec91d2d943ecb9e8971a40e69553e3d2a4e54f..057ba8f14247695e01fbfec7fa24ed0234197071 100644 --- a/civicrm/CRM/Contribute/Form/Contribution.php +++ b/civicrm/CRM/Contribute/Form/Contribution.php @@ -665,10 +665,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $componentDetails = []; if ($this->_id) { $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); - if (CRM_Utils_Array::value('membership', $componentDetails)) { + if (!empty($componentDetails['membership'])) { $component = 'membership'; } - elseif (CRM_Utils_Array::value('participant', $componentDetails)) { + elseif (!empty($componentDetails['participant'])) { $component = 'participant'; } } @@ -831,8 +831,8 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); $isCancelledStatus = ($this->_values['contribution_status_id'] == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Cancelled')); - if (CRM_Utils_Array::value('membership', $componentDetails) || - CRM_Utils_Array::value('participant', $componentDetails) || + if (!empty($componentDetails['membership']) || + !empty($componentDetails['participant']) || // if status is Cancelled freeze Amount, Payment Instrument, Check #, Financial Type, // Net and Fee Amounts are frozen in AdditionalInfo::buildAdditionalDetail $isCancelledStatus @@ -1710,7 +1710,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP protected function invoicingPostProcessHook($submittedValues, $action, $lineItem) { $invoiceSettings = Civi::settings()->get('contribution_invoice_settings'); - if (!CRM_Utils_Array::value('invoicing', $invoiceSettings)) { + if (empty($invoiceSettings['invoicing'])) { return; } $taxRate = []; diff --git a/civicrm/CRM/Contribute/Form/Contribution/Confirm.php b/civicrm/CRM/Contribute/Form/Contribution/Confirm.php index 601b3bf3b4d373e692b4d76934dd3f58eb035063..95fddb2ce9c5a9ae853acf673d6f96ad012590fe 100644 --- a/civicrm/CRM/Contribute/Form/Contribution/Confirm.php +++ b/civicrm/CRM/Contribute/Form/Contribution/Confirm.php @@ -117,7 +117,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $pledgeParams['frequency_day'] = 1; } $pledgeParams['create_date'] = $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date("Ymd"); - if (CRM_Utils_Array::value('start_date', $params)) { + if (!empty($params['start_date'])) { $pledgeParams['frequency_day'] = intval(date("d", strtotime(CRM_Utils_Array::value('start_date', $params)))); $pledgeParams['start_date'] = $pledgeParams['scheduled_date'] = date('Ymd', strtotime(CRM_Utils_Array::value('start_date', $params))); } @@ -1364,7 +1364,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $membershipTypeIDs = (array) $membershipParams['selectMembership']; $membershipTypes = CRM_Member_BAO_Membership::buildMembershipTypeValues($this, $membershipTypeIDs); $membershipType = empty($membershipTypes) ? [] : reset($membershipTypes); - $isPending = $this->getIsPending(); $this->assign('membership_name', CRM_Utils_Array::value('name', $membershipType)); $this->_values['membership_name'] = CRM_Utils_Array::value('name', $membershipType); @@ -1392,7 +1391,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $this->postProcessMembership($membershipParams, $contactID, $this, $premiumParams, $customFieldsFormatted, $fieldTypes, $membershipType, $membershipTypeIDs, $isPaidMembership, $this->_membershipId, $isProcessSeparateMembershipTransaction, $financialTypeID, - $membershipLineItems, $isPending); + $membershipLineItems); $this->assign('membership_assign', TRUE); $this->set('membershipTypeID', $membershipParams['selectMembership']); @@ -1424,14 +1423,15 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr * @param int $financialTypeID * @param array $unprocessedLineItems * Line items for payment options chosen on the form. - * @param bool $isPending * * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception + * @throws \Civi\Payment\Exception\PaymentProcessorException */ protected function postProcessMembership( $membershipParams, $contactID, &$form, $premiumParams, $customFieldsFormatted = NULL, $includeFieldTypes = NULL, $membershipDetails, $membershipTypeIDs, $isPaidMembership, $membershipID, - $isProcessSeparateMembershipTransaction, $financialTypeID, $unprocessedLineItems, $isPending) { + $isProcessSeparateMembershipTransaction, $financialTypeID, $unprocessedLineItems) { $membershipContribution = NULL; $isTest = CRM_Utils_Array::value('is_test', $membershipParams, FALSE); @@ -1532,13 +1532,6 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } $i++; $numTerms = CRM_Utils_Array::value($memType, $typesTerms, 1); - if (!empty($membershipContribution)) { - $pendingStatus = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending'); - $pending = ($membershipContribution->contribution_status_id == $pendingStatus) ? TRUE : FALSE; - } - else { - $pending = $isPending; - } $contributionRecurID = isset($form->_params['contributionRecurID']) ? $form->_params['contributionRecurID'] : NULL; $membershipSource = NULL; @@ -1560,6 +1553,13 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } } + // @todo Move this into CRM_Member_BAO_Membership::processMembership + if (!empty($membershipContribution)) { + $pending = ($membershipContribution->contribution_status_id == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus())) ? TRUE : FALSE; + } + else { + $pending = $this->getIsPending(); + } list($membership, $renewalMode, $dates) = CRM_Member_BAO_Membership::processMembership( $contactID, $memType, $isTest, date('YmdHis'), CRM_Utils_Array::value('cms_contactID', $membershipParams), @@ -1942,7 +1942,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr $form->_fields['billing_first_name'] = 1; $form->_fields['billing_last_name'] = 1; // CRM-18854 - Set form values to allow pledge to be created for api test. - if (CRM_Utils_Array::value('pledge_block_id', $params)) { + if (!empty($params['pledge_block_id'])) { $form->_values['pledge_id'] = CRM_Utils_Array::value('pledge_id', $params, NULL); $form->_values['pledge_block_id'] = $params['pledge_block_id']; $pledgeBlock = CRM_Pledge_BAO_PledgeBlock::getPledgeBlock($params['id']); diff --git a/civicrm/CRM/Contribute/Form/Contribution/Main.php b/civicrm/CRM/Contribute/Form/Contribution/Main.php index 44d9ffecf172364e45e4826b6cdd16e0808119d9..6b8d915b8d5d8875cc5f67b17153126c9bd42ba8 100644 --- a/civicrm/CRM/Contribute/Form/Contribution/Main.php +++ b/civicrm/CRM/Contribute/Form/Contribution/Main.php @@ -631,9 +631,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu public static function formRule($fields, $files, $self) { $errors = []; $amount = self::computeAmount($fields, $self->_values); - if (CRM_Utils_Array::value('auto_renew', $fields) && - CRM_Utils_Array::value('payment_processor_id', $fields) == 0 - ) { + if (!empty($fields['auto_renew']) && empty($fields['payment_processor_id'])) { $errors['auto_renew'] = ts('You cannot have auto-renewal on if you are paying later.'); } @@ -876,15 +874,13 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu //CRM-16285 - Function to handle validation errors on form, for recurring contribution field. CRM_Contribute_BAO_ContributionRecur::validateRecurContribution($fields, $files, $self, $errors); - if (!empty($fields['is_recur']) && - CRM_Utils_Array::value('payment_processor_id', $fields) == 0 - ) { + if (!empty($fields['is_recur']) && empty($fields['payment_processor_id'])) { $errors['_qf_default'] = ts('You cannot set up a recurring contribution if you are not paying online by credit card.'); } // validate PCP fields - if not anonymous, we need a nick name value if ($self->_pcpId && !empty($fields['pcp_display_in_roll']) && - (CRM_Utils_Array::value('pcp_is_anonymous', $fields) == 0) && + empty($fields['pcp_is_anonymous']) && CRM_Utils_Array::value('pcp_roll_nickname', $fields) == '' ) { $errors['pcp_roll_nickname'] = ts('Please enter a name to include in the Honor Roll, or select \'contribute anonymously\'.'); @@ -915,13 +911,13 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $errors['pledge_installments'] = ts('Please enter a valid number of pledge installments.'); } else { - if (CRM_Utils_Array::value('pledge_installments', $fields) == NULL) { + if (!isset($fields['pledge_installments'])) { $errors['pledge_installments'] = ts('Pledge Installments is required field.'); } elseif (CRM_Utils_Array::value('pledge_installments', $fields) == 1) { $errors['pledge_installments'] = ts('Pledges consist of multiple scheduled payments. Select one-time contribution if you want to make your gift in a single payment.'); } - elseif (CRM_Utils_Array::value('pledge_installments', $fields) == 0) { + elseif (empty($fields['pledge_installments'])) { $errors['pledge_installments'] = ts('Pledge Installments field must be > 1.'); } } @@ -931,10 +927,10 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu $errors['pledge_frequency_interval'] = ts('Please enter a valid Pledge Frequency Interval.'); } else { - if (CRM_Utils_Array::value('pledge_frequency_interval', $fields) == NULL) { + if (!isset($fields['pledge_frequency_interval'])) { $errors['pledge_frequency_interval'] = ts('Pledge Frequency Interval. is required field.'); } - elseif (CRM_Utils_Array::value('pledge_frequency_interval', $fields) == 0) { + elseif (empty($fields['pledge_frequency_interval'])) { $errors['pledge_frequency_interval'] = ts('Pledge frequency interval field must be > 0'); } } @@ -947,7 +943,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu return $errors; } - if (CRM_Utils_Array::value('payment_processor_id', $fields) === NULL) { + if (!isset($fields['payment_processor_id'])) { $errors['payment_processor_id'] = ts('Payment Method is a required field.'); } else { @@ -1192,7 +1188,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu if ($params['amount'] != 0 && (($this->_values['is_pay_later'] && empty($this->_paymentProcessor) && !array_key_exists('hidden_processor', $params)) || - (CRM_Utils_Array::value('payment_processor_id', $params) == 0)) + empty($params['payment_processor_id'])) ) { $params['is_pay_later'] = 1; } diff --git a/civicrm/CRM/Contribute/Form/ContributionPage.php b/civicrm/CRM/Contribute/Form/ContributionPage.php index f1490ee44ceefb1942d03c7d6eed51df9b2b8e00..343c11998ab07fc22afc0f7769f0c2ce356d5333 100644 --- a/civicrm/CRM/Contribute/Form/ContributionPage.php +++ b/civicrm/CRM/Contribute/Form/ContributionPage.php @@ -306,7 +306,7 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { ]; foreach ($pledgeBlock as $key) { $defaults[$key] = CRM_Utils_Array::value($key, $pledgeBlockDefaults); - if ($key == 'pledge_start_date' && CRM_Utils_Array::value($key, $pledgeBlockDefaults)) { + if ($key == 'pledge_start_date' && !empty($pledgeBlockDefaults[$key])) { $defaultPledgeDate = (array) json_decode($pledgeBlockDefaults['pledge_start_date']); $pledgeDateFields = [ 'pledge_calendar_date' => 'calendar_date', diff --git a/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php b/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php index 538569eb2cb784883ffd6f15df453d1ea00ff06e..ef3d9071c586abdb8b42be1773e1081f681e6ae3 100644 --- a/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php @@ -95,10 +95,10 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co if ($id != 0) { $paymentProcessor[$id] = $processor['name']; } - if (CRM_Utils_Array::value('is_recur', $processor)) { + if (!empty($processor['is_recur'])) { $recurringPaymentProcessor[] = $id; } - if (CRM_Utils_Array::value('object', $processor) && $processor['object']->supports('FutureRecurStartDate')) { + if (!empty($processor['object']) && $processor['object']->supports('FutureRecurStartDate')) { $futurePaymentProcessor[] = $id; } } @@ -345,7 +345,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co } // CRM-18854 Check if recurring start date is in the future. - if (CRM_Utils_Array::value('pledge_calendar_date', $fields)) { + if (!empty($fields['pledge_calendar_date'])) { if (date('Ymd') > date('Ymd', strtotime($fields['pledge_calendar_date']))) { $errors['pledge_calendar_date'] = ts('The recurring start date cannot be prior to the current date.'); } @@ -506,7 +506,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co $params['is_recur_installments'] = CRM_Utils_Array::value('is_recur_installments', $params, FALSE); } - if (CRM_Utils_Array::value('adjust_recur_start_date', $params)) { + if (!empty($params['adjust_recur_start_date'])) { $fieldValue = ''; $pledgeDateFields = [ 'calendar_date' => 'pledge_calendar_date', @@ -517,7 +517,7 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co } else { foreach ($pledgeDateFields as $key => $pledgeDateField) { - if (CRM_Utils_Array::value($pledgeDateField, $params) && $params['pledge_default_toggle'] == $key) { + if (!empty($params[$pledgeDateField]) && $params['pledge_default_toggle'] == $key) { $fieldValue = json_encode([$key => $params[$pledgeDateField]]); break; } @@ -531,10 +531,10 @@ class CRM_Contribute_Form_ContributionPage_Amount extends CRM_Contribute_Form_Co $params['is_pledge_start_date_visible'] = 0; $params['is_pledge_start_date_editable'] = 0; } - if (!CRM_Utils_Array::value('is_pledge_start_date_visible', $params)) { + if (empty($params['is_pledge_start_date_visible'])) { $params['is_pledge_start_date_visible'] = 0; } - if (!CRM_Utils_Array::value('is_pledge_start_date_editable', $params)) { + if (empty($params['is_pledge_start_date_editable'])) { $params['is_pledge_start_date_editable'] = 0; } diff --git a/civicrm/CRM/Contribute/Import/Form/MapField.php b/civicrm/CRM/Contribute/Import/Form/MapField.php index 7828bb521646a6283d6a8f6807788c582dbdd981..14d8c0805e06531807a3b18e75af41d076a14f40 100644 --- a/civicrm/CRM/Contribute/Import/Form/MapField.php +++ b/civicrm/CRM/Contribute/Import/Form/MapField.php @@ -156,31 +156,12 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { /** * Build the form object. + * + * @throws \CiviCRM_API3_Exception */ public function buildQuickForm() { - //to save the current mappings - if (!$this->get('savedMapping')) { - $saveDetailsName = ts('Save this field mapping'); - $this->applyFilter('saveMappingName', 'trim'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - else { - $savedMapping = $this->get('savedMapping'); - - $mappingName = (string) civicrm_api3('Mapping', 'getvalue', ['id' => $savedMapping, 'return' => 'name']); - $this->set('loadedMapping', $savedMapping); - $this->assign('loadedMapping', $mappingName); - $this->assign('savedName', $mappingName); - $this->add('hidden', 'mappingId', $savedMapping); - - $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL); - $saveDetailsName = ts('Save as a new field mapping'); - $this->add('text', 'saveMappingName', ts('Name')); - $this->add('text', 'saveMappingDesc', ts('Description')); - } - - $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, ['onclick' => "showSaveDetails(this)"]); + $savedMappingID = $this->get('savedMapping'); + $this->buildSavedMappingFields($savedMappingID); $this->addFormRule([ 'CRM_Contribute_Import_Form_MapField', @@ -227,7 +208,7 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { $sel = &$this->addElement('hierselect', "mapper[$i]", ts('Mapper for Field %1', [1 => $i]), NULL); $jsSet = FALSE; if ($this->get('savedMapping')) { - list($mappingName, $mappingContactType) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping); + list($mappingName, $mappingContactType) = CRM_Core_BAO_Mapping::getMappingFields($savedMappingID); $mappingName = $mappingName[1]; $mappingContactType = $mappingContactType[1]; @@ -247,8 +228,8 @@ class CRM_Contribute_Import_Form_MapField extends CRM_Import_Form_MapField { $defaults["mapper[$i]"] = [ CRM_Utils_Array::value(0, $mappingHeader), ($softField) ? $softField : "", - (isset($locationId)) ? $locationId : "", - (isset($phoneType)) ? $phoneType : "", + "", + "", ]; $jsSet = TRUE; } diff --git a/civicrm/CRM/Contribute/Import/Parser.php b/civicrm/CRM/Contribute/Import/Parser.php index 9ceac6a63d6e137dc578b0475dce005a1ad4569e..24c30758c8bac94afbae5ef49506bd4bc5cee32f 100644 --- a/civicrm/CRM/Contribute/Import/Parser.php +++ b/civicrm/CRM/Contribute/Import/Parser.php @@ -427,20 +427,34 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { } /** + * Store the soft credit field information. + * + * This was perhaps done this way on the believe that a lot of code pain + * was worth it to avoid negligible-cost array iterations. Perhaps we could prioritise + * readability & maintainability next since we can just work with functions to retrieve + * data from the metadata. + * * @param array $elements */ public function setActiveFieldSoftCredit($elements) { - for ($i = 0; $i < count($elements); $i++) { - $this->_activeFields[$i]->_softCreditField = $elements[$i]; + foreach ((array) $elements as $i => $element) { + $this->_activeFields[$i]->_softCreditField = $element; } } /** + * Store the soft credit field type information. + * + * This was perhaps done this way on the believe that a lot of code pain + * was worth it to avoid negligible-cost array iterations. Perhaps we could prioritise + * readability & maintainability next since we can just work with functions to retrieve + * data from the metadata. + * * @param array $elements */ public function setActiveFieldSoftCreditType($elements) { - for ($i = 0; $i < count($elements); $i++) { - $this->_activeFields[$i]->_softCreditType = $elements[$i]; + foreach ((array) $elements as $i => $element) { + $this->_activeFields[$i]->_softCreditType = $element; } } diff --git a/civicrm/CRM/Core/BAO/Address.php b/civicrm/CRM/Core/BAO/Address.php index 71ebf132db34c44a174ddefc3c13721604488b0c..af3dbd233da196c559995eebd657617ca50f6bdd 100644 --- a/civicrm/CRM/Core/BAO/Address.php +++ b/civicrm/CRM/Core/BAO/Address.php @@ -416,9 +416,9 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { if (substr($name, 0, 7) == 'country') { // make sure its different from the default country // iso code - $defaultCountry = $config->defaultContactCountry(); + $defaultCountry = CRM_Core_BAO_Country::defaultContactCountry(); // full name - $defaultCountryName = $config->defaultContactCountryName(); + $defaultCountryName = CRM_Core_BAO_Country::defaultContactCountryName(); if ($defaultCountry) { if ($value == $defaultCountry || @@ -663,8 +663,7 @@ ORDER BY civicrm_address.is_primary DESC, civicrm_address.location_type_id DESC, * Array of address sequence. */ public static function addressSequence() { - $config = CRM_Core_Config::singleton(); - $addressSequence = $config->addressSequence(); + $addressSequence = CRM_Utils_Address::sequence(\Civi::settings()->get('address_format')); $countryState = $cityPostal = FALSE; foreach ($addressSequence as $key => $field) { diff --git a/civicrm/CRM/Core/BAO/CustomField.php b/civicrm/CRM/Core/BAO/CustomField.php index 07530e3f5228135718df1b361cc8e8a480e0515e..26907960b8567e8038d5ef54fe9c532f1161ee4a 100644 --- a/civicrm/CRM/Core/BAO/CustomField.php +++ b/civicrm/CRM/Core/BAO/CustomField.php @@ -1261,7 +1261,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { if (!$value) { $config = CRM_Core_Config::singleton(); if ($config->defaultContactCountry) { - $value = $config->defaultContactCountry(); + $value = CRM_Core_BAO_Country::defaultContactCountry(); } } } diff --git a/civicrm/CRM/Core/BAO/Location.php b/civicrm/CRM/Core/BAO/Location.php index b0c68d1b8a932b2f1b9124cb1657af612ae8eae2..b8e7f073fea4ebe54f4bb60fd8d412bf2bbefdb1 100644 --- a/civicrm/CRM/Core/BAO/Location.php +++ b/civicrm/CRM/Core/BAO/Location.php @@ -84,7 +84,7 @@ class CRM_Core_BAO_Location extends CRM_Core_DAO { // when we come from a form which displays all the location elements (like the edit form or the inline block // elements, we can skip the below check. The below check adds quite a feq queries to an already overloaded // form - if (!CRM_Utils_Array::value('updateBlankLocInfo', $params, FALSE)) { + if (empty($params['updateBlankLocInfo'])) { // make sure contact should have only one primary block, CRM-5051 self::checkPrimaryBlocks(CRM_Utils_Array::value('contact_id', $params)); } diff --git a/civicrm/CRM/Core/BAO/PrevNextCache.php b/civicrm/CRM/Core/BAO/PrevNextCache.php index bcc8e650f8f0887d3799d95fbc3adaecf5067ae8..f217d874417f1d22551cff250d0e747f5fc039d2 100644 --- a/civicrm/CRM/Core/BAO/PrevNextCache.php +++ b/civicrm/CRM/Core/BAO/PrevNextCache.php @@ -429,7 +429,7 @@ WHERE (pn.cachekey $op %1 OR pn.cachekey $op %2) * @throws \CiviCRM_API3_Exception */ public static function refillCache($rgid, $gid, $criteria, $checkPermissions, $searchLimit = 0) { - $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions); + $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions, $searchLimit); // 1. Clear cache if any $sql = "DELETE FROM civicrm_prevnext_cache WHERE cachekey LIKE %1"; @@ -450,15 +450,24 @@ WHERE (pn.cachekey $op %1 OR pn.cachekey $op %2) // would chain to a delete. Limiting to getfields for 'get' limits us to declared fields, // although we might wish to revisit later to allow joins. $validFieldsForRetrieval = civicrm_api3('Contact', 'getfields', ['action' => 'get'])['values']; - if (!empty($criteria)) { + $filteredCriteria = isset($criteria['contact']) ? array_intersect_key($criteria['contact'], $validFieldsForRetrieval) : []; + + if (!empty($criteria) || !empty($searchLimit)) { $contacts = civicrm_api3('Contact', 'get', array_merge([ - 'options' => ['limit' => 0], + 'options' => ['limit' => $searchLimit], 'return' => 'id', 'check_permissions' => TRUE, - ], array_intersect_key($criteria['contact'], $validFieldsForRetrieval))); + 'contact_type' => civicrm_api3('RuleGroup', 'getvalue', ['id' => $rgid, 'return' => 'contact_type']), + ], $filteredCriteria)); $contactIDs = array_keys($contacts['values']); + + if (empty($contactIDs)) { + // If there is criteria but no contacts were found then we should return now + // since we have no contacts to match. + return []; + } } - $foundDupes = CRM_Dedupe_Finder::dupes($rgid, $contactIDs, $checkPermissions, $searchLimit); + $foundDupes = CRM_Dedupe_Finder::dupes($rgid, $contactIDs, $checkPermissions); } if (!empty($foundDupes)) { diff --git a/civicrm/CRM/Core/BAO/RecurringEntity.php b/civicrm/CRM/Core/BAO/RecurringEntity.php index 95ef8907ecb0b8f44ba23bbd6ee5c6fa86d7bd88..daf86a7806e71b1ae71a00c3d7adb7e7cc5b8cc1 100644 --- a/civicrm/CRM/Core/BAO/RecurringEntity.php +++ b/civicrm/CRM/Core/BAO/RecurringEntity.php @@ -917,7 +917,7 @@ class CRM_Core_BAO_RecurringEntity extends CRM_Core_DAO_RecurringEntity { } } if ($formParams['repeats_by'] == 2) { - if (CRM_Utils_Array::value('entity_status_1', $formParams) && CRM_Utils_Array::value('entity_status_2', $formParams)) { + if (!empty($formParams['entity_status_1']) && !empty($formParams['entity_status_2'])) { $dbParams['entity_status'] = $formParams['entity_status_1'] . " " . $formParams['entity_status_2']; } } diff --git a/civicrm/CRM/Core/BAO/SchemaHandler.php b/civicrm/CRM/Core/BAO/SchemaHandler.php index 004907fa127874aad356167f1ea4fbfa134a9a17..0b0ee3b5f9851af2fa2411972d93d2aeb8ff2abe 100644 --- a/civicrm/CRM/Core/BAO/SchemaHandler.php +++ b/civicrm/CRM/Core/BAO/SchemaHandler.php @@ -626,7 +626,7 @@ MODIFY {$columnName} varchar( $length ) 2 => [$table_name, 'String'], 3 => [$constraint_name, 'String'], ]; - $dao = CRM_Core_DAO::executeQuery($query, $params); + $dao = CRM_Core_DAO::executeQuery($query, $params, TRUE, NULL, FALSE, FALSE); if ($dao->fetch()) { return TRUE; @@ -644,7 +644,7 @@ MODIFY {$columnName} varchar( $length ) */ public static function safeRemoveFK($table_name, $constraint_name) { if (self::checkFKExists($table_name, $constraint_name)) { - CRM_Core_DAO::executeQuery("ALTER TABLE {$table_name} DROP FOREIGN KEY {$constraint_name}", []); + CRM_Core_DAO::executeQuery("ALTER TABLE {$table_name} DROP FOREIGN KEY {$constraint_name}", [], TRUE, NULL, FALSE, FALSE); return TRUE; } return FALSE; diff --git a/civicrm/CRM/Core/BAO/Setting.php b/civicrm/CRM/Core/BAO/Setting.php index 2c4b837bda63710a491e18086fa8d4bf18136087..41d520efef3be17e00a56da35ef58bb4d8501f38 100644 --- a/civicrm/CRM/Core/BAO/Setting.php +++ b/civicrm/CRM/Core/BAO/Setting.php @@ -496,7 +496,7 @@ class CRM_Core_BAO_Setting extends CRM_Core_DAO_Setting { public static function isAPIJobAllowedToRun($params) { $environment = CRM_Core_Config::environment(NULL, TRUE); if ($environment != 'Production') { - if (CRM_Utils_Array::value('runInNonProductionEnvironment', $params)) { + if (!empty($params['runInNonProductionEnvironment'])) { $mailing = Civi::settings()->get('mailing_backend_store'); if ($mailing) { Civi::settings()->set('mailing_backend', $mailing); diff --git a/civicrm/CRM/Core/BAO/StatusPreference.php b/civicrm/CRM/Core/BAO/StatusPreference.php index 98e9a35faa47135f09bfc30a0b38c6c21326cb3d..fbeb8528f3c4e32f7e49048eafe4bc3cf2cd7804 100644 --- a/civicrm/CRM/Core/BAO/StatusPreference.php +++ b/civicrm/CRM/Core/BAO/StatusPreference.php @@ -66,7 +66,7 @@ class CRM_Core_BAO_StatusPreference extends CRM_Core_DAO_StatusPreference { } // Check if this StatusPreference already exists. - if (empty($params['id']) && CRM_Utils_Array::value('name', $params)) { + if (empty($params['id']) && !empty($params['name'])) { $statusPreference->domain_id = CRM_Utils_Array::value('domain_id', $params, CRM_Core_Config::domainID()); $statusPreference->name = $params['name']; diff --git a/civicrm/CRM/Core/BAO/UFField.php b/civicrm/CRM/Core/BAO/UFField.php index 4549d78d3b0a1f5963dc5dcffaa611c75ed47f0e..58dd31f08f069d1090648ed9f962b2fe60fa1973 100644 --- a/civicrm/CRM/Core/BAO/UFField.php +++ b/civicrm/CRM/Core/BAO/UFField.php @@ -827,7 +827,7 @@ SELECT id if (in_array($field['field_name'], $validBillingFields)) { $validProfileFields[] = $field['field_name']; } - if (CRM_Utils_Array::value('is_required', $field)) { + if (!empty($field['is_required'])) { $requiredProfileFields[] = $field['field_name']; } } @@ -970,6 +970,7 @@ SELECT id 'membership_type_id', 'member_is_test', 'is_override', + 'member_is_override', 'status_override_end_date', 'status_id', 'member_is_pay_later' diff --git a/civicrm/CRM/Core/ClassLoader.php b/civicrm/CRM/Core/ClassLoader.php index f951e578c7a011534b28ec932f3b3e27207b0dd4..51dbcf9b1d46f1f1857b95cf7fd22a719ef883a7 100644 --- a/civicrm/CRM/Core/ClassLoader.php +++ b/civicrm/CRM/Core/ClassLoader.php @@ -205,6 +205,12 @@ class CRM_Core_ClassLoader { * @param $class */ public function loadClass($class) { + if ($class === 'CiviCRM_API3_Exception') { + //call internal error class api/Exception first + // allow api/Exception class call external error class + // CiviCRM_API3_Exception + require_once 'api/Exception.php'; + } if ( // Only load classes that clearly belong to CiviCRM. // Note: api/v3 does not use classes, but api_v3's test-suite does diff --git a/civicrm/CRM/Core/Config.php b/civicrm/CRM/Core/Config.php index 4e3679fb6d4d305d38afedff0d4e7261fda28ada..f8952cf41928c30621be8a62829c05314df4f383 100644 --- a/civicrm/CRM/Core/Config.php +++ b/civicrm/CRM/Core/Config.php @@ -471,6 +471,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { * @deprecated */ public function addressSequence() { + CRM_Core_Error::deprecatedFunctionWarning('CRM_Utils_Address::sequence(Civi::settings()->get(\'address_format\')'); return CRM_Utils_Address::sequence(Civi::settings()->get('address_format')); } @@ -478,6 +479,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { * @deprecated */ public function defaultContactCountry() { + CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultContactCountry'); return CRM_Core_BAO_Country::defaultContactCountry(); } @@ -485,6 +487,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { * @deprecated */ public function defaultContactCountryName() { + CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultContactCountryName'); return CRM_Core_BAO_Country::defaultContactCountryName(); } diff --git a/civicrm/CRM/Core/DAO.php b/civicrm/CRM/Core/DAO.php index a0d75859cbe42780af1ad7cb31f90540d7fb8fe4..83dac3f4333a8f1b76dd8b3a467f3318ce9dabfc 100644 --- a/civicrm/CRM/Core/DAO.php +++ b/civicrm/CRM/Core/DAO.php @@ -234,26 +234,22 @@ class CRM_Core_DAO extends DB_DataObject { if ($fkDAO->find(TRUE)) { $this->$dbName = $fkDAO->id; } - $fkDAO->free(); } elseif (in_array($FKClassName, CRM_Core_DAO::$_testEntitiesToSkip)) { $depObject = new $FKClassName(); $depObject->find(TRUE); $this->$dbName = $depObject->id; - $depObject->free(); } elseif ($daoName == 'CRM_Member_DAO_MembershipType' && $fieldName == 'member_of_contact_id') { // FIXME: the fields() metadata is not specific enough $depObject = CRM_Core_DAO::createTestObject($FKClassName, ['contact_type' => 'Organization']); $this->$dbName = $depObject->id; - $depObject->free(); } else { //if it is required we need to generate the dependency object first $depObject = CRM_Core_DAO::createTestObject($FKClassName, CRM_Utils_Array::value($dbName, $params, 1)); $this->$dbName = $depObject->id; - $depObject->free(); } } @@ -567,6 +563,7 @@ class CRM_Core_DAO extends DB_DataObject { $event = new \Civi\Core\DAO\Event\PostUpdate($this); \Civi::service('dispatcher')->dispatch("civi.dao.postUpdate", $event); } + $this->clearDbColumnValueCache(); } else { $this->insert(); @@ -620,6 +617,8 @@ class CRM_Core_DAO extends DB_DataObject { \Civi::service('dispatcher')->dispatch("civi.dao.postDelete", $event); $this->free(); + $this->clearDbColumnValueCache(); + return $result; } @@ -1196,12 +1195,16 @@ FROM civicrm_domain CRM_Core_Error::fatal(); } - $cacheKey = "{$daoName}:{$searchValue}:{$returnColumn}:{$searchColumn}"; - if (self::$_dbColumnValueCache === NULL) { - self::$_dbColumnValueCache = []; + self::$_dbColumnValueCache = self::$_dbColumnValueCache ?? []; + + while (strpos($daoName, '_BAO_') !== FALSE) { + $daoName = get_parent_class($daoName); } - if (!array_key_exists($cacheKey, self::$_dbColumnValueCache) || $force) { + if ($force || + empty(self::$_dbColumnValueCache[$daoName][$searchColumn][$searchValue]) || + !array_key_exists($returnColumn, self::$_dbColumnValueCache[$daoName][$searchColumn][$searchValue]) + ) { $object = new $daoName(); $object->$searchColumn = $searchValue; $object->selectAdd(); @@ -1211,11 +1214,10 @@ FROM civicrm_domain if ($object->find(TRUE)) { $result = $object->$returnColumn; } - $object->free(); - self::$_dbColumnValueCache[$cacheKey] = $result; + self::$_dbColumnValueCache[$daoName][$searchColumn][$searchValue][$returnColumn] = $result; } - return self::$_dbColumnValueCache[$cacheKey]; + return self::$_dbColumnValueCache[$daoName][$searchColumn][$searchValue][$returnColumn]; } /** @@ -2954,4 +2956,20 @@ SELECT contact_id return $fields; } + /** + * Remove item from static cache during update/delete operations + */ + private function clearDbColumnValueCache() { + $daoName = get_class($this); + while (strpos($daoName, '_BAO_') !== FALSE) { + $daoName = get_parent_class($daoName); + } + if (isset($this->id)) { + unset(self::$_dbColumnValueCache[$daoName]['id'][$this->id]); + } + if (isset($this->name)) { + unset(self::$_dbColumnValueCache[$daoName]['name'][$this->name]); + } + } + } diff --git a/civicrm/CRM/Core/DAO/Address.php b/civicrm/CRM/Core/DAO/Address.php index 4e896f5572ba6fe688d8e0c76431fa52d11756aa..96de13e2c49a09dba0e750a2061069e4018d952c 100644 --- a/civicrm/CRM/Core/DAO/Address.php +++ b/civicrm/CRM/Core/DAO/Address.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Address.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9cc91d1b8831b712698603b619aa1906) + * (GenCodeChecksum:e026e63074a6ffc2f4fda166e6ea6b5a) */ /** @@ -709,9 +709,10 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO { 'manual_geo_code' => [ 'name' => 'manual_geo_code', 'type' => CRM_Utils_Type::T_BOOLEAN, - 'title' => ts('Is manually geocoded'), + 'title' => ts('Is Manually Geocoded'), 'description' => ts('Is this a manually entered geo code'), 'where' => 'civicrm_address.manual_geo_code', + 'export' => TRUE, 'default' => '0', 'table_name' => 'civicrm_address', 'entity' => 'Address', diff --git a/civicrm/CRM/Core/DAO/AllCoreTables.data.php b/civicrm/CRM/Core/DAO/AllCoreTables.data.php index e42e08bf4eb9acc892c852ca700be1d69eae6ccc..8a366e7b077a3e59d654fcc72154048296459205 100644 --- a/civicrm/CRM/Core/DAO/AllCoreTables.data.php +++ b/civicrm/CRM/Core/DAO/AllCoreTables.data.php @@ -397,9 +397,9 @@ return [ 'class' => 'CRM_Core_DAO_StatusPreference', 'table' => 'civicrm_status_pref', ], - 'CRM_ACL_DAO_Cache' => [ - 'name' => 'Cache', - 'class' => 'CRM_ACL_DAO_Cache', + 'CRM_ACL_DAO_ACLCache' => [ + 'name' => 'ACLCache', + 'class' => 'CRM_ACL_DAO_ACLCache', 'table' => 'civicrm_acl_cache', ], 'CRM_Contact_DAO_Group' => [ diff --git a/civicrm/CRM/Core/DAO/AllCoreTables.php b/civicrm/CRM/Core/DAO/AllCoreTables.php index df253125696451457c1f99b70040d8396573d087..d38f96ba1b7b2299b5968cb49de9a1a3802e8d5b 100644 --- a/civicrm/CRM/Core/DAO/AllCoreTables.php +++ b/civicrm/CRM/Core/DAO/AllCoreTables.php @@ -300,7 +300,7 @@ class CRM_Core_DAO_AllCoreTables { $fields = $dao::fields(); foreach ($fields as $name => $field) { - if (CRM_Utils_Array::value('export', $field)) { + if (!empty($field['export'])) { if ($prefix) { $exports[$labelName] = & $fields[$name]; } @@ -340,7 +340,7 @@ class CRM_Core_DAO_AllCoreTables { $fields = $dao::fields(); foreach ($fields as $name => $field) { - if (CRM_Utils_Array::value('import', $field)) { + if (!empty($field['import'])) { if ($prefix) { $imports[$labelName] = & $fields[$name]; } diff --git a/civicrm/CRM/Core/DAO/Cache.php b/civicrm/CRM/Core/DAO/Cache.php index 01536dda8ed0c391031bdfc4ce548220362d65b9..15f2f222680cf3b16c2e93475ec07b8ac34485bc 100644 --- a/civicrm/CRM/Core/DAO/Cache.php +++ b/civicrm/CRM/Core/DAO/Cache.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Cache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:97df4edaa4829ea30a151dbb95ff754d) + * (GenCodeChecksum:4d3ccecb7d91aa67b8c78c3c39933ae8) */ /** @@ -29,6 +29,8 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO { public static $_log = FALSE; /** + * Unique table ID + * * @var int */ public $id; @@ -109,6 +111,8 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO { 'id' => [ 'name' => 'id', 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Cache ID'), + 'description' => ts('Unique table ID'), 'required' => TRUE, 'where' => 'civicrm_cache.id', 'table_name' => 'civicrm_cache', @@ -157,6 +161,7 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO { 'component_id' => [ 'name' => 'component_id', 'type' => CRM_Utils_Type::T_INT, + 'title' => ts('Component ID'), 'description' => ts('Component that this menu item belongs to'), 'where' => 'civicrm_cache.component_id', 'table_name' => 'civicrm_cache', diff --git a/civicrm/CRM/Core/DAO/Dashboard.php b/civicrm/CRM/Core/DAO/Dashboard.php index 026937454c374d971e8aa6aeaefafe0fac900362..f772fef1082d4b9b4fd98c2368b02700ada75e68 100644 --- a/civicrm/CRM/Core/DAO/Dashboard.php +++ b/civicrm/CRM/Core/DAO/Dashboard.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Dashboard.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:2b085baa3414de05ee5c52a4d7d4f81f) + * (GenCodeChecksum:6fd1bfbecace855a159025ad31e37fb0) */ /** diff --git a/civicrm/CRM/Core/Error.php b/civicrm/CRM/Core/Error.php index 16ac8caf4dd8f7b518a6026b4ad7e9cd868ecdf1..e52e51515a22e94705dbb695b9903043718fb47d 100644 --- a/civicrm/CRM/Core/Error.php +++ b/civicrm/CRM/Core/Error.php @@ -232,7 +232,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { $errorDetails = CRM_Core_Error::debug('', $error, FALSE); $template->assign_by_ref('errorDetails', $errorDetails); - CRM_Core_Error::debug_var('Fatal Error Details', $error); + CRM_Core_Error::debug_var('Fatal Error Details', $error, TRUE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); if ($config->initialized) { @@ -339,7 +339,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { if (self::$modeException) { // CRM-11043 - CRM_Core_Error::debug_var('Fatal Error Details', $vars); + CRM_Core_Error::debug_var('Fatal Error Details', $vars, TRUE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); $details = 'A fatal error was triggered'; @@ -381,7 +381,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { self::backtrace(); } - CRM_Core_Error::debug_var('Fatal Error Details', $vars); + CRM_Core_Error::debug_var('Fatal Error Details', $vars, TRUE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); // If we are in an ajax callback, format output appropriately @@ -421,7 +421,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { } catch (Exception $other) { // if the exception-handler generates an exception, then that sucks! oh, well. carry on. - CRM_Core_Error::debug_var('handleUnhandledException_nestedException', self::formatTextException($other)); + CRM_Core_Error::debug_var('handleUnhandledException_nestedException', self::formatTextException($other), TRUE, TRUE, '', PEAR_LOG_ERR); } $config = CRM_Core_Config::singleton(); $vars = [ @@ -459,24 +459,19 @@ class CRM_Core_Error extends PEAR_ErrorStack { // Case C: Default error handler // log to file - CRM_Core_Error::debug_var('Fatal Error Details', $vars, FALSE); + CRM_Core_Error::debug_var('Fatal Error Details', $vars, FALSE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); // print to screen $template = CRM_Core_Smarty::singleton(); $template->assign($vars); $content = $template->fetch('CRM/common/fatal.tpl'); + if ($config->backtrace) { $content = self::formatHtmlException($exception) . $content; } - if ($config->userFramework == 'Joomla' && - class_exists('JError') - ) { - JError::raiseError('CiviCRM-001', $content); - } - else { - echo CRM_Utils_System::theme($content); - } + + echo CRM_Utils_System::theme($content); // fin self::abend(CRM_Core_Error::FATAL_ERROR); @@ -544,6 +539,8 @@ class CRM_Core_Error extends PEAR_ErrorStack { * Log or return the output? * @param string $prefix * Prefix for output logfile. + * @param int $priority + * The log priority level. * * @return string * The generated output @@ -551,7 +548,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { * @see CRM_Core_Error::debug() * @see CRM_Core_Error::debug_log_message() */ - public static function debug_var($variable_name, $variable, $print = TRUE, $log = TRUE, $prefix = '') { + public static function debug_var($variable_name, $variable, $print = TRUE, $log = TRUE, $prefix = '', $priority = NULL) { // check if variable is set if (!isset($variable)) { $out = "\$$variable_name is not set"; @@ -574,7 +571,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { reset($variable); } } - return self::debug_log_message($out, FALSE, $prefix); + return self::debug_log_message($out, FALSE, $prefix, $priority); } /** @@ -635,7 +632,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { CRM_Core_Error::backtrace($string, TRUE); } elseif (CIVICRM_DEBUG_LOG_QUERY) { - CRM_Core_Error::debug_var('Query', $string, TRUE, TRUE, 'sql_log'); + CRM_Core_Error::debug_var('Query', $string, TRUE, TRUE, 'sql_log', PEAR_LOG_DEBUG); } } } @@ -647,7 +644,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { */ public static function debug_query_result($query) { $results = CRM_Core_DAO::executeQuery($query)->fetchAll(); - CRM_Core_Error::debug_var('dao result', ['query' => $query, 'results' => $results]); + CRM_Core_Error::debug_var('dao result', ['query' => $query, 'results' => $results], TRUE, TRUE, '', PEAR_LOG_DEBUG); } /** @@ -731,7 +728,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { CRM_Core_Error::debug($msg, $message); } else { - CRM_Core_Error::debug_var($msg, $message); + CRM_Core_Error::debug_var($msg, $message, TRUE, TRUE, '', PEAR_LOG_DEBUG); } } @@ -948,7 +945,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { * @throws PEAR_Exception */ public static function exceptionHandler($pearError) { - CRM_Core_Error::debug_var('Fatal Error Details', self::getErrorDetails($pearError)); + CRM_Core_Error::debug_var('Fatal Error Details', self::getErrorDetails($pearError), TRUE, TRUE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); throw new PEAR_Exception($pearError->getMessage(), $pearError); } @@ -962,7 +959,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { * $obj */ public static function nullHandler($obj) { - CRM_Core_Error::debug_log_message("Ignoring exception thrown by nullHandler: {$obj->code}, {$obj->message}"); + CRM_Core_Error::debug_log_message("Ignoring exception thrown by nullHandler: {$obj->code}, {$obj->message}", FALSE, '', PEAR_LOG_ERR); CRM_Core_Error::backtrace('backTrace', TRUE); return $obj; } diff --git a/civicrm/CRM/Core/Form/RecurringEntity.php b/civicrm/CRM/Core/Form/RecurringEntity.php index 85f53b22e23dbac4220d64f6d26aa34db286bf47..4e44aa0d09d3fcb2b59f30c01d62989248666a13 100644 --- a/civicrm/CRM/Core/Form/RecurringEntity.php +++ b/civicrm/CRM/Core/Form/RecurringEntity.php @@ -343,7 +343,7 @@ class CRM_Core_Form_RecurringEntity { $params['entity_id'] = self::$_entityId; } //Process this function only when you get this variable - if ($params['allowRepeatConfigToSubmit'] == 1) { + if (CRM_Utils_Array::value('allowRepeatConfigToSubmit', $params) == 1) { if (!empty($params['entity_table']) && !empty($params['entity_id']) && $type) { $params['used_for'] = $type; if (empty($params['parent_entity_id'])) { @@ -369,7 +369,7 @@ class CRM_Core_Form_RecurringEntity { //exclude dates $excludeDateList = []; - if (CRM_Utils_Array::value('exclude_date_list', $params) && CRM_Utils_Array::value('parent_entity_id', $params) && $actionScheduleObj->entity_value) { + if (!empty($params['exclude_date_list']) && !empty($params['parent_entity_id']) && $actionScheduleObj->entity_value) { //Since we get comma separated values lets get them in array $excludeDates = explode(",", $params['exclude_date_list']); diff --git a/civicrm/CRM/Core/Form/Search.php b/civicrm/CRM/Core/Form/Search.php index c4711b7d52389fabee815d3770f040c34defbef0..7fab1da759fb27a1949f9767420c11dfa9982948 100644 --- a/civicrm/CRM/Core/Form/Search.php +++ b/civicrm/CRM/Core/Form/Search.php @@ -337,7 +337,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form { $this->addElement('checkbox', 'toggleSelect', NULL, NULL, ['class' => 'select-rows']); if (!empty($rows)) { foreach ($rows as $row) { - if (CRM_Utils_Array::value('checkbox', $row)) { + if (!empty($row['checkbox'])) { $this->addElement('checkbox', $row['checkbox'], NULL, NULL, ['class' => 'select-row']); } } diff --git a/civicrm/CRM/Core/Page/AJAX.php b/civicrm/CRM/Core/Page/AJAX.php index 7c2d1a00b743e4995a184c2ac1cc687ef2361803..0569c7ee86c484486942b0323dc8e597b51cb0b4 100644 --- a/civicrm/CRM/Core/Page/AJAX.php +++ b/civicrm/CRM/Core/Page/AJAX.php @@ -269,7 +269,7 @@ class CRM_Core_Page_AJAX { } foreach ($optionalParams as $param => $type) { - if (CRM_Utils_Array::value($param, $_GET)) { + if (!empty($_GET[$param])) { if (!is_array($_GET[$param])) { $params[$param] = CRM_Utils_Type::validate(CRM_Utils_Array::value($param, $_GET), $type); } diff --git a/civicrm/CRM/Core/Page/AJAX/Location.php b/civicrm/CRM/Core/Page/AJAX/Location.php index 7a998fe2a523caa951764e81bd2b2c3808b8e6e3..f54c05d2c47345d4342ed2cd4548be0dc88ee60a 100644 --- a/civicrm/CRM/Core/Page/AJAX/Location.php +++ b/civicrm/CRM/Core/Page/AJAX/Location.php @@ -67,8 +67,7 @@ class CRM_Core_Page_AJAX_Location { $entityBlock = ['contact_id' => $cid]; $location = CRM_Core_BAO_Location::getValues($entityBlock); - $config = CRM_Core_Config::singleton(); - $addressSequence = array_flip($config->addressSequence()); + $addressSequence = array_flip(CRM_Utils_Address::sequence(\Civi::settings()->get('address_format'))); $profileFields = CRM_Core_BAO_UFGroup::getFields($ufId, FALSE, CRM_Core_Action::VIEW, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL diff --git a/civicrm/CRM/Core/Page/AJAX/RecurringEntity.php b/civicrm/CRM/Core/Page/AJAX/RecurringEntity.php index 198b22c33ed0bf6c7c3857b7572dc5862577613b..15706f62cc49066a78df4c7124c047f4abec997f 100644 --- a/civicrm/CRM/Core/Page/AJAX/RecurringEntity.php +++ b/civicrm/CRM/Core/Page/AJAX/RecurringEntity.php @@ -14,7 +14,7 @@ class CRM_Core_Page_AJAX_RecurringEntity { public static function updateMode() { $finalResult = []; - if (CRM_Utils_Array::value('mode', $_REQUEST) && CRM_Utils_Array::value('entityId', $_REQUEST) && CRM_Utils_Array::value('entityTable', $_REQUEST)) { + if (!empty($_REQUEST['mode']) && !empty($_REQUEST['entityId']) && !empty($_REQUEST['entityTable'])) { $mode = CRM_Utils_Type::escape($_REQUEST['mode'], 'Integer'); $entityId = CRM_Utils_Type::escape($_REQUEST['entityId'], 'Integer'); $entityTable = CRM_Utils_Type::escape($_REQUEST['entityTable'], 'String'); diff --git a/civicrm/CRM/Core/Payment/BaseIPN.php b/civicrm/CRM/Core/Payment/BaseIPN.php index 35af834bd575c67dc51e899a6223ab7b2b569d97..9e7ed420ba3c9330dd5a2255e866684838df229b 100644 --- a/civicrm/CRM/Core/Payment/BaseIPN.php +++ b/civicrm/CRM/Core/Payment/BaseIPN.php @@ -213,6 +213,7 @@ class CRM_Core_Payment_BaseIPN { * @param array $input * * @return bool + * @throws \CiviCRM_API3_Exception */ public function failed(&$objects, &$transaction, $input = []) { $contribution = &$objects['contribution']; @@ -235,10 +236,10 @@ class CRM_Core_Payment_BaseIPN { 'labelColumn' => 'name', 'flip' => 1, ]); + $contribution->contribution_status_id = $contributionStatuses['Failed']; $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date); $contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date); $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date); - $contribution->contribution_status_id = $contributionStatuses['Failed']; $contribution->save(); // Add line items for recurring payments. @@ -255,33 +256,19 @@ class CRM_Core_Payment_BaseIPN { if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) { if (!empty($memberships)) { - // if transaction is failed then set "Cancelled" as membership status - $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', [ - 'labelColumn' => 'name', - 'flip' => 1, - ]); foreach ($memberships as $membership) { - if ($membership) { - $membership->status_id = $membershipStatuses['Cancelled']; - $membership->save(); - - //update related Memberships. - $params = ['status_id' => $membershipStatuses['Cancelled']]; - CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $params); - } + // @fixme Should we cancel only Pending memberships? per cancelled() + $this->cancelMembership($membership, $membership->status_id, FALSE); } } if ($participant) { - $participantParams['id'] = $participant->id; - $participantParams['status_id'] = 'Cancelled'; - civicrm_api3('Participant', 'create', $participantParams); + $this->cancelParticipant($participant->id); } } $transaction->commit(); - CRM_Core_Error::debug_log_message("Setting contribution status to failed"); - //echo "Success: Setting contribution status to failed<p>"; + Civi::log()->debug("Setting contribution status to Failed"); return TRUE; } @@ -295,7 +282,7 @@ class CRM_Core_Payment_BaseIPN { */ public function pending(&$objects, &$transaction) { $transaction->commit(); - CRM_Core_Error::debug_log_message("returning since contribution status is pending"); + Civi::log()->debug("Returning since contribution status is Pending"); echo "Success: Returning since contribution status is pending<p>"; return TRUE; } @@ -308,32 +295,38 @@ class CRM_Core_Payment_BaseIPN { * @param array $input * * @return bool + * @throws \CiviCRM_API3_Exception */ public function cancelled(&$objects, &$transaction, $input = []) { $contribution = &$objects['contribution']; - $memberships = &$objects['membership']; - if (is_numeric($memberships)) { - $memberships = [$objects['membership']]; + $memberships = []; + if (!empty($objects['membership'])) { + $memberships = &$objects['membership']; + if (is_numeric($memberships)) { + $memberships = [$objects['membership']]; + } } - $participant = &$objects['participant']; $addLineItems = FALSE; if (empty($contribution->id)) { $addLineItems = TRUE; } + $participant = &$objects['participant']; + + // CRM-15546 $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', [ 'labelColumn' => 'name', 'flip' => 1, ]); $contribution->contribution_status_id = $contributionStatuses['Cancelled']; - $contribution->cancel_date = self::$_now; - $contribution->cancel_reason = CRM_Utils_Array::value('reasonCode', $input); $contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date); $contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date); $contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date); + $contribution->cancel_date = self::$_now; + $contribution->cancel_reason = CRM_Utils_Array::value('reasonCode', $input); $contribution->save(); - //add lineitems for recurring payments + // Add line items for recurring payments. if (!empty($objects['contributionRecur']) && $objects['contributionRecur']->id && $addLineItems) { CRM_Contribute_BAO_ContributionRecur::addRecurLineItems($objects['contributionRecur']->id, $contribution); } @@ -347,34 +340,19 @@ class CRM_Core_Payment_BaseIPN { if (empty($input['IAmAHorribleNastyBeyondExcusableHackInTheCRMEventFORMTaskClassThatNeedsToBERemoved'])) { if (!empty($memberships)) { - $membershipStatuses = CRM_Core_PseudoConstant::get('CRM_Member_DAO_Membership', 'status_id', [ - 'labelColumn' => 'name', - 'flip' => 1, - ]); - // Cancel only Pending memberships - // CRM-18688 - $pendingStatusId = $membershipStatuses['Pending']; foreach ($memberships as $membership) { - if ($membership && ($membership->status_id == $pendingStatusId)) { - $membership->status_id = $membershipStatuses['Cancelled']; - $membership->save(); - - //update related Memberships. - $params = ['status_id' => $membershipStatuses['Cancelled']]; - CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $params); + if ($membership) { + $this->cancelMembership($membership, $membership->status_id); } } } if ($participant) { - $participantParams['id'] = $participant->id; - $participantParams['status_id'] = 'Cancelled'; - civicrm_api3('Participant', 'create', $participantParams); + $this->cancelParticipant($participant->id); } } $transaction->commit(); - CRM_Core_Error::debug_log_message("Setting contribution status to cancelled"); - //echo "Success: Setting contribution status to cancelled<p>"; + Civi::log()->debug("Setting contribution status to Cancelled"); return TRUE; } @@ -388,11 +366,60 @@ class CRM_Core_Payment_BaseIPN { */ public function unhandled(&$objects, &$transaction) { $transaction->rollback(); - CRM_Core_Error::debug_log_message("returning since contribution status: is not handled"); + Civi::log()->debug("Returning since contribution status is not handled"); echo "Failure: contribution status is not handled<p>"; return FALSE; } + /** + * Logic to cancel a participant record when the related contribution changes to failed/cancelled. + * @todo This is part of a bigger refactor for dev/core/issues/927 - "duplicate" functionality exists in CRM_Contribute_BAO_Contribution::cancel() + * + * @param $participantID + * + * @throws \CiviCRM_API3_Exception + */ + private function cancelParticipant($participantID) { + // @fixme https://lab.civicrm.org/dev/core/issues/927 Cancelling membership etc is not desirable for all use-cases and we should be able to disable it + $participantParams['id'] = $participantID; + $participantParams['status_id'] = 'Cancelled'; + civicrm_api3('Participant', 'create', $participantParams); + } + + /** + * Logic to cancel a membership record when the related contribution changes to failed/cancelled. + * @todo This is part of a bigger refactor for dev/core/issues/927 - "duplicate" functionality exists in CRM_Contribute_BAO_Contribution::cancel() + * @param \CRM_Member_BAO_Membership $membership + * @param int $membershipStatusID + * @param boolean $onlyCancelPendingMembership + * Do we only cancel pending memberships? OR memberships in any status? (see CRM-18688) + * @fixme Historically failed() cancelled membership in any status, cancelled() cancelled only pending memberships so we retain that behaviour for now. + * + */ + private function cancelMembership($membership, $membershipStatusID, $onlyCancelPendingMembership = TRUE) { + // @fixme https://lab.civicrm.org/dev/core/issues/927 Cancelling membership etc is not desirable for all use-cases and we should be able to disable it + // Cancel only Pending memberships + $pendingMembershipStatusId = CRM_Core_PseudoConstant::getKey('CRM_Member_BAO_Membership', 'status_id', 'Pending'); + if (($membershipStatusID == $pendingMembershipStatusId) || ($onlyCancelPendingMembership == FALSE)) { + $cancelledMembershipStatusId = CRM_Core_PseudoConstant::getKey('CRM_Member_BAO_Membership', 'status_id', 'Cancelled'); + + $membership->status_id = $cancelledMembershipStatusId; + $membership->save(); + + $params = ['status_id' => $cancelledMembershipStatusId]; + CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $params); + + // @todo Convert the above to API + // $membershipParams = [ + // 'id' => $membership->id, + // 'status_id' => $cancelledMembershipStatusId, + // ]; + // civicrm_api3('Membership', 'create', $membershipParams); + // CRM_Member_BAO_Membership::updateRelatedMemberships($membershipParams['id'], ['status_id' => $cancelledMembershipStatusId]); + } + + } + /** * @deprecated * @@ -447,6 +474,9 @@ class CRM_Core_Payment_BaseIPN { * @param array $objects * @param CRM_Core_Transaction $transaction * @param bool $recur + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public function completeTransaction(&$input, &$ids, &$objects, &$transaction, $recur = FALSE) { $contribution = &$objects['contribution']; @@ -493,6 +523,8 @@ class CRM_Core_Payment_BaseIPN { * is because the function is also used to generate pdfs * * @return array + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public function sendMail(&$input, &$ids, &$objects, &$values, $recur = FALSE, $returnMessageText = FALSE) { return CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $objects['contribution']->id, $values, diff --git a/civicrm/CRM/Core/Payment/PayPalIPN.php b/civicrm/CRM/Core/Payment/PayPalIPN.php index 3ad4c74d27597804fffa4dc7c95db0f2dc055270..d7a13692b65f29a8d05c2d5cc21780c9467f2c2c 100644 --- a/civicrm/CRM/Core/Payment/PayPalIPN.php +++ b/civicrm/CRM/Core/Payment/PayPalIPN.php @@ -313,7 +313,9 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { $input['component'] = $component; $ids['contact'] = $this->retrieve('contactID', 'Integer', TRUE); - $ids['contribution'] = $this->retrieve('contributionID', 'Integer', TRUE); + $contributionID = $ids['contribution'] = $this->retrieve('contributionID', 'Integer', TRUE); + $membershipID = $this->retrieve('membershipID', 'Integer', FALSE); + $contributionRecurID = $this->retrieve('contributionRecurID', 'Integer', FALSE); $this->getInput($input, $ids); @@ -323,17 +325,48 @@ class CRM_Core_Payment_PayPalIPN extends CRM_Core_Payment_BaseIPN { } else { // get the optional ids - $ids['membership'] = $this->retrieve('membershipID', 'Integer', FALSE); - $ids['contributionRecur'] = $this->retrieve('contributionRecurID', 'Integer', FALSE); + $ids['membership'] = $membershipID; + $ids['contributionRecur'] = $contributionRecurID; $ids['contributionPage'] = $this->retrieve('contributionPageID', 'Integer', FALSE); $ids['related_contact'] = $this->retrieve('relatedContactID', 'Integer', FALSE); $ids['onbehalf_dupe_alert'] = $this->retrieve('onBehalfDupeAlert', 'Integer', FALSE); } - $paymentProcessorID = self::getPayPalPaymentProcessorID($input, $ids); + $paymentProcessorID = $this->getPayPalPaymentProcessorID($input, $ids); Civi::log()->debug('PayPalIPN: Received (ContactID: ' . $ids['contact'] . '; trxn_id: ' . $input['trxn_id'] . ').'); + if ($this->retrieve('membershipID', 'Integer', FALSE)) { + $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($contributionRecurID); + $membershipPayment = civicrm_api3('MembershipPayment', 'get', [ + 'contribution_id' => $templateContribution['id'], + 'membership_id' => $membershipID, + ]); + $lineItems = civicrm_api3('LineItem', 'get', [ + 'contribution_id' => $templateContribution['id'], + 'entity_id' => $membershipID, + 'entity_table' => 'civicrm_membership', + ]); + Civi::log()->debug('PayPalIPN: Received payment for membership ' . (int) $membershipID + . '. Original contribution was ' . (int) $contributionID . '. The template for this contribution is ' + . $templateContribution['id'] . ' it is linked to ' . $membershipPayment['count'] + . 'payments for this membership. It has ' . $lineItems['count'] . ' line items linked to this membership.' + . ' it is expected the original contribution will be linked by both entities to the membership.' + ); + if (empty($membershipPayment['count']) && empty($lineItems['count'])) { + Civi::log()->debug('PayPalIPN: Will attempt to compensate'); + $input['membership_id'] = $this->retrieve('membershipID', 'Integer', FALSE); + } + if ($contributionRecurID) { + $recurLinks = civicrm_api3('ContributionRecur', 'get', [ + 'membership_id' => $membershipID, + 'contribution_recur_id' => $contributionRecurID, + ]); + Civi::log()->debug('PayPalIPN: Membership should be linked to contribution recur record ' . $contributionRecurID + . ' ' . $recurLinks['count'] . 'links found' + ); + } + } if (!$this->validateData($input, $ids, $objects, TRUE, $paymentProcessorID)) { return; } diff --git a/civicrm/CRM/Core/Payment/PayPalImpl.php b/civicrm/CRM/Core/Payment/PayPalImpl.php index 5b4a109802e07e5ace1ce6df9d114b741d029a0d..905e369a61b71dc2e4f2e5656df2416b57579118 100644 --- a/civicrm/CRM/Core/Payment/PayPalImpl.php +++ b/civicrm/CRM/Core/Payment/PayPalImpl.php @@ -352,7 +352,6 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { * @throws \Civi\Payment\Exception\PaymentProcessorException */ public function doExpressCheckout(&$params) { - $statuses = CRM_Contribute_BAO_Contribution::buildOptions('contribution_status_id'); if (!empty($params['is_recur'])) { return $this->createRecurringPayments($params); } @@ -379,7 +378,6 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { } /* Success */ - $params['trxn_id'] = $result['transactionid']; $params['gross_amount'] = $result['amt']; $params['fee_amount'] = $result['feeamt']; @@ -391,10 +389,10 @@ class CRM_Core_Payment_PayPalImpl extends CRM_Core_Payment { $params['pending_reason'] = $result['pendingreason']; if (!empty($params['is_recur'])) { // See comment block. - $params['payment_status_id'] = array_search('Pending', $statuses); + $params['payment_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Pending'); } else { - $params['payment_status_id'] = array_search('Completed', $statuses); + $params['payment_status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'); } return $params; } diff --git a/civicrm/CRM/Core/Permission.php b/civicrm/CRM/Core/Permission.php index 57d58ec7471762797882f9392fe05c4255a428f1..6623bfd1f38e03024addabe21dd79a836ab8a999 100644 --- a/civicrm/CRM/Core/Permission.php +++ b/civicrm/CRM/Core/Permission.php @@ -81,48 +81,43 @@ class CRM_Core_Permission { /** * Given a permission string or array, check for access requirements - * @param string|array $permissions - * The permission to check as an array or string -see examples. - * - * @param int $contactId - * Contact id to check permissions for. Defaults to current logged-in user. * - * Ex 1 + * Ex 1: Must have 'access CiviCRM' + * (string) 'access CiviCRM' * - * Must have 'access CiviCRM' - * (string) 'access CiviCRM' + * Ex 2: Must have 'access CiviCRM' and 'access Ajax API' + * ['access CiviCRM', 'access Ajax API'] * + * Ex 3: Must have 'access CiviCRM' or 'access Ajax API' + * [ + * ['access CiviCRM', 'access Ajax API'], + * ], * - * Ex 2 Must have 'access CiviCRM' and 'access Ajax API' - * array('access CiviCRM', 'access Ajax API') + * Ex 4: Must have 'access CiviCRM' or 'access Ajax API' AND 'access CiviEvent' + * [ + * ['access CiviCRM', 'access Ajax API'], + * 'access CiviEvent', + * ], * - * Ex 3 Must have 'access CiviCRM' or 'access Ajax API' - * array( - * array('access CiviCRM', 'access Ajax API'), - * ), + * Note that in permissions.php this is keyed by the action eg. + * (access Civi || access AJAX) && (access CiviEvent || access CiviContribute) + * 'myaction' => [ + * ['access CiviCRM', 'access Ajax API'], + * ['access CiviEvent', 'access CiviContribute'] + * ], * - * Ex 4 Must have 'access CiviCRM' or 'access Ajax API' AND 'access CiviEvent' - * array( - * array('access CiviCRM', 'access Ajax API'), - * 'access CiviEvent', - * ), + * @param string|array $permissions + * The permission to check as an array or string -see examples. * - * Note that in permissions.php this is keyed by the action eg. - * (access Civi || access AJAX) && (access CiviEvent || access CiviContribute) - * 'myaction' => array( - * array('access CiviCRM', 'access Ajax API'), - * array('access CiviEvent', 'access CiviContribute') - * ), + * @param int $contactId + * Contact id to check permissions for. Defaults to current logged-in user. * * @return bool - * true if yes, else false + * true if contact has permission(s), else false */ public static function check($permissions, $contactId = NULL) { $permissions = (array) $permissions; - $userId = NULL; - if ($contactId) { - $userId = CRM_Core_BAO_UFMatch::getUFId($contactId); - } + $userId = CRM_Core_BAO_UFMatch::getUFId($contactId); /** @var CRM_Core_Permission_Temp $tempPerm */ $tempPerm = CRM_Core_Config::singleton()->userPermissionTemp; @@ -976,6 +971,12 @@ class CRM_Core_Permission { 'duplicatecheck' => [ 'access CiviCRM', ], + 'merge' => ['merge duplicate contacts'], + ]; + + $permissions['dedupe'] = [ + 'getduplicates' => ['access CiviCRM'], + 'getstatistics' => ['access CiviCRM'], ]; // CRM-16963 - Permissions for country. @@ -1179,6 +1180,15 @@ class CRM_Core_Permission { 'edit all events', ], ]; + // Exception refers to dedupe_exception. + $permissions['exception'] = [ + 'default' => ['merge duplicate contacts'], + ]; + + $permissions['job'] = [ + 'process_batch_merge' => ['merge duplicate contacts'], + ]; + $permissions['rule_group']['get'] = [['merge duplicate contacts', 'administer CiviCRM']]; // Loc block is only used for events $permissions['loc_block'] = $permissions['event']; diff --git a/civicrm/CRM/Core/PseudoConstant.php b/civicrm/CRM/Core/PseudoConstant.php index c53c451d2d3785b9a9739fae6605ccbbed2b1972..14e2e7fcf220d826e9af4d437329f7fc442bc5cf 100644 --- a/civicrm/CRM/Core/PseudoConstant.php +++ b/civicrm/CRM/Core/PseudoConstant.php @@ -836,9 +836,9 @@ WHERE id = %1"; self::populate(self::$country, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active', $whereClause); // if default country is set, percolate it to the top - if ($config->defaultContactCountry()) { + if (CRM_Core_BAO_Country::defaultContactCountry()) { $countryIsoCodes = self::countryIsoCode(); - $defaultID = array_search($config->defaultContactCountry(), $countryIsoCodes); + $defaultID = array_search(CRM_Core_BAO_Country::defaultContactCountry(), $countryIsoCodes); if ($defaultID !== FALSE) { $default[$defaultID] = CRM_Utils_Array::value($defaultID, self::$country); self::$country = $default + self::$country; diff --git a/civicrm/CRM/Custom/Form/CustomData.php b/civicrm/CRM/Custom/Form/CustomData.php index 42d6a5372aed37dadecccd22b0b734965cc192fc..f508e14138666dea66b238c1079cf7c4fcbd0308 100644 --- a/civicrm/CRM/Custom/Form/CustomData.php +++ b/civicrm/CRM/Custom/Form/CustomData.php @@ -49,10 +49,11 @@ class CRM_Custom_Form_CustomData { * e.g Student for contact type * @param null|string $subName value in civicrm_custom_group.extends_entity_column_id * @param null|int $groupCount number of entities that could have custom data + * @param null|int $contact_id contact ID associated with the custom data. * * @throws \CRM_Core_Exception */ - public static function addToForm(&$form, $subType = NULL, $subName = NULL, $groupCount = 1) { + public static function addToForm(&$form, $subType = NULL, $subName = NULL, $groupCount = 1, $contact_id = NULL) { $entityName = $form->getDefaultEntity(); $entityID = $form->getEntityId(); // FIXME: If the form has been converted to use entityFormTrait then getEntitySubTypeId() will exist. @@ -80,6 +81,7 @@ class CRM_Custom_Form_CustomData { $form->assign('customDataType', $entityName); $form->assign('customDataSubType', $entitySubType); $form->assign('entityID', $entityID); + $form->assign('cid', $contact_id); } /** diff --git a/civicrm/CRM/Custom/Form/CustomDataByType.php b/civicrm/CRM/Custom/Form/CustomDataByType.php index c88a29fb16226d79cdb50309ff28f661c6a1ba79..a2f162d972f28971fa34df6dc8944c59e6f1224b 100644 --- a/civicrm/CRM/Custom/Form/CustomDataByType.php +++ b/civicrm/CRM/Custom/Form/CustomDataByType.php @@ -36,6 +36,13 @@ */ class CRM_Custom_Form_CustomDataByType extends CRM_Core_Form { + /** + * Contact ID associated with the Custom Data + * + * @var int + */ + public $_contactID = NULL; + /** * Preprocess function. */ @@ -46,6 +53,7 @@ class CRM_Custom_Form_CustomDataByType extends CRM_Core_Form { $this->_subName = CRM_Utils_Request::retrieve('subName', 'String'); $this->_groupCount = CRM_Utils_Request::retrieve('cgcount', 'Positive'); $this->_entityId = CRM_Utils_Request::retrieve('entityID', 'Positive'); + $this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive'); $this->_groupID = CRM_Utils_Request::retrieve('groupID', 'Positive'); $this->_onlySubtype = CRM_Utils_Request::retrieve('onlySubtype', 'Boolean'); $this->_action = CRM_Utils_Request::retrieve('action', 'Alphanumeric'); diff --git a/civicrm/CRM/Custom/Form/Preview.php b/civicrm/CRM/Custom/Form/Preview.php index 9f7c9e06a73838c88fe0daa0fa0b89f70411f8db..149049992dcfa2276526ca3d3c127828c76400b1 100644 --- a/civicrm/CRM/Custom/Form/Preview.php +++ b/civicrm/CRM/Custom/Form/Preview.php @@ -71,7 +71,7 @@ class CRM_Custom_Form_Preview extends CRM_Core_Form { if (!empty($defaults['is_view'])) { CRM_Core_Error::statusBounce(ts('This field is view only so it will not display on edit form.')); } - elseif (CRM_Utils_Array::value('is_active', $defaults) == 0) { + elseif (empty($defaults['is_active'])) { CRM_Core_Error::statusBounce(ts('This field is inactive so it will not display on edit form.')); } diff --git a/civicrm/CRM/Dedupe/Finder.php b/civicrm/CRM/Dedupe/Finder.php index f3fa9a01b75ed8bd753d266f5cd57954648456d9..63725439a91682537e8bbe6a607bcfffb67bbb2c 100644 --- a/civicrm/CRM/Dedupe/Finder.php +++ b/civicrm/CRM/Dedupe/Finder.php @@ -51,31 +51,17 @@ class CRM_Dedupe_Finder { * @param bool $checkPermissions * Respect logged in user permissions. * - * @param int $searchLimit - * Limit for the number of contacts to be used for comparison. - * The search methodology finds all matches for the searchedContacts so this limits - * the number of searched contacts, not the matches found. - * * @return array * Array of (cid1, cid2, weight) dupe triples * - * @throws CiviCRM_API3_Exception * @throws Exception */ - public static function dupes($rgid, $cids = [], $checkPermissions = TRUE, $searchLimit = 0) { + public static function dupes($rgid, $cids = [], $checkPermissions = TRUE) { $rgBao = new CRM_Dedupe_BAO_RuleGroup(); $rgBao->id = $rgid; $rgBao->contactIds = $cids; if (!$rgBao->find(TRUE)) { - CRM_Core_Error::fatal("Dedupe rule not found for selected contacts"); - } - if (empty($rgBao->contactIds) && !empty($searchLimit)) { - $limitedContacts = civicrm_api3('Contact', 'get', [ - 'return' => 'id', - 'contact_type' => $rgBao->contact_type, - 'options' => ['limit' => $searchLimit], - ]); - $rgBao->contactIds = array_keys($limitedContacts['values']); + throw new CRM_Core_Exception('Dedupe rule not found for selected contacts'); } $rgBao->fillTable(); @@ -113,6 +99,7 @@ class CRM_Dedupe_Finder { * * @return array * matching contact ids + * @throws \CRM_Core_Exception */ public static function dupesByParams( $params, @@ -144,7 +131,7 @@ class CRM_Dedupe_Finder { $rgBao->contact_type = $ctype; $rgBao->used = $used; if (!$rgBao->find(TRUE)) { - CRM_Core_Error::fatal("$used rule for $ctype does not exist"); + throw new CRM_Core_Exception("$used rule for $ctype does not exist"); } } @@ -181,6 +168,7 @@ class CRM_Dedupe_Finder { * * @return array * array of (cid1, cid2, weight) dupe triples + * @throws \CiviCRM_API3_Exception */ public static function dupesInGroup($rgid, $gid, $searchLimit = 0) { $cids = array_keys(CRM_Contact_BAO_Group::getMember($gid, TRUE, $searchLimit)); @@ -201,6 +189,7 @@ class CRM_Dedupe_Finder { * * @return array * valid $params array for dedupe + * @throws \CRM_Core_Exception */ public static function formatParams($fields, $ctype) { $flat = []; @@ -306,7 +295,7 @@ class CRM_Dedupe_Finder { } } } - if ($table == 'civicrm_phone') { + if ($table === 'civicrm_phone') { $fixes = [ 'phone' => 'phone_numeric', ]; @@ -340,8 +329,6 @@ class CRM_Dedupe_Finder { * -dstName * -weight * -canMerge - * - * @throws CRM_Core_Exception */ public static function parseAndStoreDupePairs($foundDupes, $cacheKeyString) { $cids = []; diff --git a/civicrm/CRM/Dedupe/Merger.php b/civicrm/CRM/Dedupe/Merger.php index 9e501f35f60c2a07f11f11f03d049543429ea0f0..b943027d8f0966d98c3c0d6fcd216030f418a604 100644 --- a/civicrm/CRM/Dedupe/Merger.php +++ b/civicrm/CRM/Dedupe/Merger.php @@ -691,11 +691,21 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m * If not set explicitly this is calculated but it is preferred that it be set * per comments on isSelected above. * + * @param int $searchLimit + * Limit on number of contacts to search for duplicates for. + * This means that if the limit is 1000 then only duplicates for the first 1000 contacts + * matching criteria will be found and batchMerged (the number of merges could be less than or greater than 100) + * * @return array|bool + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ - public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $batchLimit = 1, $isSelected = 2, $criteria = [], $checkPermissions = TRUE, $reloadCacheIfEmpty = NULL) { + public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $batchLimit = 1, $isSelected = 2, $criteria = [], $checkPermissions = TRUE, $reloadCacheIfEmpty = NULL, $searchLimit = 0) { $redirectForPerformance = ($batchLimit > 1) ? TRUE : FALSE; - + if ($mode === 'aggressive' && $checkPermissions && !CRM_Core_Permission::check('force merge duplicate contacts')) { + throw new CRM_Core_Exception(ts('Insufficient permissions for aggressive mode batch merge')); + } if (!isset($reloadCacheIfEmpty)) { $reloadCacheIfEmpty = (!$redirectForPerformance && $isSelected == 2); } @@ -703,10 +713,10 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m // explicitly set to NULL if not 1 or 0 as part of grandfathering out the mystical '2' value. $isSelected = NULL; } - $dupePairs = self::getDuplicatePairs($rgid, $gid, $reloadCacheIfEmpty, $batchLimit, $isSelected, ($mode == 'aggressive'), $criteria, $checkPermissions); + $dupePairs = self::getDuplicatePairs($rgid, $gid, $reloadCacheIfEmpty, $batchLimit, $isSelected, ($mode == 'aggressive'), $criteria, $checkPermissions, $searchLimit); $cacheParams = [ - 'cache_key_string' => self::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions), + 'cache_key_string' => self::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions, $searchLimit), // @todo stop passing these parameters in & instead calculate them in the merge function based // on the 'real' params like $isRespectExclusions $batchLimit and $isSelected. 'join' => self::getJoinOnDedupeTable(), @@ -1181,7 +1191,11 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $locations[$moniker][$blockName][$cnt] = $value; // Fix address display if ($blockName == 'address') { + // For performance avoid geocoding while merging https://issues.civicrm.org/jira/browse/CRM-21786 + // we can expect existing geocode values to be retained. + $value['skip_geocode'] = TRUE; CRM_Core_BAO_Address::fixAddress($value); + unset($value['skip_geocode']); $locations[$moniker][$blockName][$cnt]['display'] = CRM_Utils_Address::format($value); } // Fix email display @@ -1833,20 +1847,23 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m * @param int $searchLimit * Limit to searching for matches against this many contacts. * + * @param int $isForceNewSearch + * Should a new search be forced, bypassing any cache retrieval. + * * @return array * Array of matches meeting the criteria. * * @throws \CRM_Core_Exception * @throws \CiviCRM_API3_Exception */ - public static function getDuplicatePairs($rule_group_id, $group_id, $reloadCacheIfEmpty, $batchLimit, $isSelected, $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0) { - $dupePairs = self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions); + public static function getDuplicatePairs($rule_group_id, $group_id, $reloadCacheIfEmpty, $batchLimit, $isSelected, $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0, $isForceNewSearch = 0) { + $dupePairs = $isForceNewSearch ? [] : self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions, $searchLimit); if (empty($dupePairs) && $reloadCacheIfEmpty) { // If we haven't found any dupes, probably cache is empty. // Try filling cache and give another try. We don't need to specify include conflicts here are there will not be any // until we have done some processing. CRM_Core_BAO_PrevNextCache::refillCache($rule_group_id, $group_id, $criteria, $checkPermissions, $searchLimit); - return self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, FALSE, $criteria, $checkPermissions); + return self::getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, FALSE, $criteria, $checkPermissions, $searchLimit); } return $dupePairs; } @@ -1859,17 +1876,21 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m * @param array $criteria * Additional criteria to narrow down the merge group. * Currently we are only supporting the key 'contact' within it. - * * @param bool $checkPermissions * Respect the users permissions. + * @param int $searchLimit + * Number of contacts to seek dupes for (we need this because if + * we change it the results won't be refreshed otherwise. Changing the limit + * from 100 to 1000 SHOULD result in a new dedupe search). * * @return string */ - public static function getMergeCacheKeyString($rule_group_id, $group_id, $criteria = [], $checkPermissions = TRUE) { + public static function getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions, $searchLimit) { $contactType = CRM_Dedupe_BAO_RuleGroup::getContactTypeForRuleGroup($rule_group_id); $cacheKeyString = "merge_{$contactType}"; $cacheKeyString .= $rule_group_id ? "_{$rule_group_id}" : '_0'; $cacheKeyString .= $group_id ? "_{$group_id}" : '_0'; + $cacheKeyString .= '_' . (int) $searchLimit; $cacheKeyString .= !empty($criteria) ? md5(serialize($criteria)) : '_0'; if ($checkPermissions) { $contactID = CRM_Core_Session::getLoggedInContactID(); @@ -2487,12 +2508,13 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m * @param bool $includeConflicts * @param array $criteria * @param int $checkPermissions + * @param int $searchLimit * * @return array */ - protected static function getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions) { + protected static function getCachedDuplicateMatches($rule_group_id, $group_id, $batchLimit, $isSelected, $includeConflicts, $criteria, $checkPermissions, $searchLimit = 0) { return CRM_Core_BAO_PrevNextCache::retrieve( - self::getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions), + self::getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions, $searchLimit), self::getJoinOnDedupeTable(), self::getWhereString($isSelected), 0, $batchLimit, diff --git a/civicrm/CRM/Event/BAO/Event.php b/civicrm/CRM/Event/BAO/Event.php index 1faee2327961fb2fb61793c13a097a0cc8dc8034..ec9d0e6b485d8c07500926d0ba1a8cf3dde2ba40 100644 --- a/civicrm/CRM/Event/BAO/Event.php +++ b/civicrm/CRM/Event/BAO/Event.php @@ -83,7 +83,6 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { * @return CRM_Event_DAO_Event */ public static function add(&$params) { - CRM_Utils_System::flushCache(); $financialTypeId = NULL; if (!empty($params['id'])) { CRM_Utils_Hook::pre('edit', 'Event', $params['id'], $params); @@ -133,6 +132,13 @@ class CRM_Event_BAO_Event extends CRM_Event_DAO_Event { $params['created_id'] = $session->get('userID'); } $params['created_date'] = date('YmdHis'); + + // Clone from template + if (!empty($params['template_id'])) { + $copy = self::copy($params['template_id']); + $params['id'] = $copy->id; + unset($params['template_id']); + } } $event = self::add($params); @@ -1055,7 +1061,7 @@ WHERE civicrm_event.is_active = 1 * @return array|null * @throws \CiviCRM_API3_Exception */ - public static function sendMail($contactID, &$values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) { + public static function sendMail($contactID, $values, $participantId, $isTest = FALSE, $returnMessageText = FALSE) { $template = CRM_Core_Smarty::singleton(); $gIds = [ @@ -1137,6 +1143,15 @@ WHERE civicrm_event.is_active = 1 // @todo - the goal is that all params available to the message template are explicitly defined here rather than // 'in a smattering of places'. Note that leakage can happen between mailings when not explicitly defined. + if ($postProfileID) { + $customPostTitles = empty($profilePost[1]) ? NULL : []; + foreach ($postProfileID as $offset => $id) { + $customPostTitles[$offset] = CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $id); + } + } + else { + $customPostTitles = NULL; + } $tplParams = array_merge($values, $participantParams, [ 'email' => $email, 'confirm_email_text' => CRM_Utils_Array::value('confirm_email_text', $values['event']), @@ -1146,7 +1161,7 @@ WHERE civicrm_event.is_active = 1 'customPre' => $profilePre[0], 'customPre_grouptitle' => empty($profilePre[1]) ? NULL : [CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $preProfileID)], 'customPost' => $profilePost[0], - 'customPost_grouptitle' => empty($profilePost[1]) ? NULL : [CRM_Core_BAO_UFGroup::getFrontEndTitle((int) $postProfileID)], + 'customPost_grouptitle' => $customPostTitles, 'participantID' => $participantId, 'conference_sessions' => $sessions, 'credit_card_number' => CRM_Utils_System::mungeCreditCard(CRM_Utils_Array::value('credit_card_number', $participantParams)), @@ -1359,6 +1374,15 @@ WHERE civicrm_event.is_active = 1 CRM_Core_BAO_UFGroup::getValues($cid, $fields, $values, FALSE, $params); + //dev/event#10 + //If the event profile includes a note field and the submitted value of + //that field is "", then remove the old note returned by getValues. + if (isset($participantParams['note']) && empty($participantParams['note'])) { + $noteKeyPos = array_search('note', array_keys($fields)); + $valuesKeys = array_keys($values); + $values[$valuesKeys[$noteKeyPos]] = ""; + } + if (isset($fields['participant_status_id']['title']) && isset($values[$fields['participant_status_id']['title']]) && is_numeric($values[$fields['participant_status_id']['title']]) diff --git a/civicrm/CRM/Event/BAO/Query.php b/civicrm/CRM/Event/BAO/Query.php index beb5f96e33c590d96514c465dcb7b018b709dfc6..03d83044cb10a789dc7d595ae84291588fb7d344 100644 --- a/civicrm/CRM/Event/BAO/Query.php +++ b/civicrm/CRM/Event/BAO/Query.php @@ -339,16 +339,13 @@ class CRM_Event_BAO_Query extends CRM_Core_BAO_Query { return; case 'participant_fee_id': - $val_regexp = []; - foreach ($value as $k => &$val) { - $val = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label'); - $val_regexp[$k] = CRM_Core_DAO::escapeString(preg_quote(trim($val))); - $val = CRM_Core_DAO::escapeString(trim($val)); + $labels = []; + foreach ($value as $val) { + $labels[] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label'); } - $feeLabel = implode('|', $val_regexp); - $query->_where[$grouping][] = "civicrm_participant.fee_level REGEXP '{$feeLabel}'"; - $query->_qill[$grouping][] = ts("Fee level") . " IN " . implode(', ', $value); - $query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1; + $query->_where[$grouping][] = "civicrm_line_item.price_field_value_id IN (" . implode(', ', $value) . ")"; + $query->_qill[$grouping][] = ts("Fee level") . " IN " . implode(', ', $labels); + $query->_tables['civicrm_participant'] = $query->_tables['civicrm_line_item'] = $query->_whereTables['civicrm_line_item'] = 1; return; case 'participant_fee_amount_high': @@ -516,6 +513,10 @@ class CRM_Event_BAO_Query extends CRM_Core_BAO_Query { $from = " $side JOIN civicrm_discount discount ON ( civicrm_participant.discount_id = discount.id )"; $from .= " $side JOIN civicrm_option_group discount_name ON ( discount_name.id = discount.price_set_id ) "; break; + + case 'civicrm_line_item': + $from .= " $side JOIN civicrm_line_item ON civicrm_line_item.entity_id = civicrm_participant.id AND civicrm_line_item.entity_table = 'civicrm_participant'"; + break; } return $from; } diff --git a/civicrm/CRM/Event/Cart/Form/Checkout/Payment.php b/civicrm/CRM/Event/Cart/Form/Checkout/Payment.php index 143096e3525826f0ec24af0a33f7bcf5b880c73a..ece09d61d1eabb66abccaac915b109f6ba226189 100644 --- a/civicrm/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/civicrm/CRM/Event/Cart/Form/Checkout/Payment.php @@ -47,7 +47,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { if ($participant->must_wait) { $participant_status = 'On waitlist'; } - elseif (CRM_Utils_Array::value('is_pay_later', $params, FALSE)) { + elseif (!empty($params['is_pay_later'])) { $participant_status = 'Pending from pay later'; } else { @@ -714,7 +714,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $config = CRM_Core_Config::singleton(); $default_country = new CRM_Core_DAO_Country(); - $default_country->iso_code = $config->defaultContactCountry(); + $default_country->iso_code = CRM_Core_BAO_Country::defaultContactCountry(); $default_country->find(TRUE); $defaults["billing_country_id-{$this->_bltID}"] = $default_country->id; diff --git a/civicrm/CRM/Event/Form/ManageEvent/Repeat.php b/civicrm/CRM/Event/Form/ManageEvent/Repeat.php index 9aad1cd161c099a6f28fe5c057e27c72a9578bdb..c7fb5591e1a2678c05ecf6d7564ed42c11a4206a 100644 --- a/civicrm/CRM/Event/Form/ManageEvent/Repeat.php +++ b/civicrm/CRM/Event/Form/ManageEvent/Repeat.php @@ -207,7 +207,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { $participantDetails = CRM_Event_Form_ManageEvent_Repeat::getParticipantCountforEvent($getRelatedEntities); //Check if participants exists for events foreach ($getRelatedEntities as $key => $value) { - if (!CRM_Utils_Array::value($value['id'], $participantDetails['countByID']) && $value['id'] != $eventID) { + if (empty($participantDetails['countByID'][$value['id']]) && $value['id'] != $eventID) { //CRM_Event_BAO_Event::del($value['id']); $eventIdsWithNoRegistration[] = $value['id']; } diff --git a/civicrm/CRM/Event/Form/Registration.php b/civicrm/CRM/Event/Form/Registration.php index d9a1825e149ade4153d5ce4d396d68802ee6695e..2ac411173084408c1538eda1749c9c219b116bc4 100644 --- a/civicrm/CRM/Event/Form/Registration.php +++ b/civicrm/CRM/Event/Form/Registration.php @@ -476,7 +476,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $this->assign($v, $params[$v]); } } - elseif (CRM_Utils_Array::value('amount', $params) == 0) { + elseif (empty($params['amount'])) { $this->assign($v, CRM_Utils_Array::value($v, $params)); } } diff --git a/civicrm/CRM/Event/Form/Registration/Confirm.php b/civicrm/CRM/Event/Form/Registration/Confirm.php index db2829ef08e5983114fb58bcd90addca79dc396c..18e9ca607c533fb2f38e473123fc21d9f6126106 100644 --- a/civicrm/CRM/Event/Form/Registration/Confirm.php +++ b/civicrm/CRM/Event/Form/Registration/Confirm.php @@ -457,7 +457,7 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $participantCount[$participantNum] = 'participant'; } $totalTaxAmount += CRM_Utils_Array::value('tax_amount', $record, 0); - if (CRM_Utils_Array::value('is_primary', $record)) { + if (!empty($record['is_primary'])) { $taxAmount = &$params[$participantNum]['tax_amount']; } //lets get additional participant id to cancel. @@ -928,7 +928,6 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { //send mail to primary as well as additional participants. $this->assign('contactID', $contactId); - $this->assign('participantID', $participantID); CRM_Event_BAO_Event::sendMail($contactId, $this->_values, $participantID, $isTest); } } @@ -1302,8 +1301,8 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { // This happens in buildQuickForm so emulate here. $form->_amount = $form->_totalAmount = CRM_Utils_Rule::cleanMoney(CRM_Utils_Array::value('totalAmount', $params)); $form->set('params', $params['params']); - $form->_values['custom_pre_id'] = []; - $form->_values['custom_post_id'] = []; + $form->_values['custom_pre_id'] = CRM_Utils_Array::value('custom_pre_id', $params); + $form->_values['custom_post_id'] = CRM_Utils_Array::value('custom_post_id', $params); $form->_values['event'] = CRM_Utils_Array::value('event', $params); $form->_contributeMode = $params['contributeMode']; $eventParams = ['id' => $params['id']]; diff --git a/civicrm/CRM/Event/Form/Registration/Register.php b/civicrm/CRM/Event/Form/Registration/Register.php index 12ff73031d93a75b50b094bbe874316590d19565..77297e325afd4d2eaba861e8438882e8eb3c5877 100644 --- a/civicrm/CRM/Event/Form/Registration/Register.php +++ b/civicrm/CRM/Event/Form/Registration/Register.php @@ -103,7 +103,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { protected static function isZeroAmount($fields, $form): bool { $isZeroAmount = FALSE; if (!empty($fields['priceSetId'])) { - if (CRM_Utils_Array::value('amount', $fields) == 0) { + if (empty($fields['amount'])) { $isZeroAmount = TRUE; } } @@ -1155,7 +1155,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { "_qf_Register_display=1&qfKey={$this->controller->_key}", TRUE, NULL, FALSE ); - if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) { + if (!empty($params['additional_participants'])) { $urlArgs = "_qf_Participant_1_display=1&rfp=1&qfKey={$this->controller->_key}"; } else { @@ -1194,7 +1194,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } // If registering > 1 participant, give status message - if (CRM_Utils_Array::value('additional_participants', $params, FALSE)) { + if (!empty($params['additional_participants'])) { $statusMsg = ts('Registration information for participant 1 has been saved.'); CRM_Core_Session::setStatus($statusMsg, ts('Saved'), 'success'); } diff --git a/civicrm/CRM/Export/BAO/Export.php b/civicrm/CRM/Export/BAO/Export.php index 2be84a1d8f4677298bb3fc19a84c9618d77e7184..a95df716d8f73142bfe454d3668ead18e346a5e0 100644 --- a/civicrm/CRM/Export/BAO/Export.php +++ b/civicrm/CRM/Export/BAO/Export.php @@ -70,9 +70,6 @@ class CRM_Export_BAO_Export { * @param array $exportParams * @param string $queryOperator * - * @return array|null - * An array can be requested from within a unit test. - * * @throws \CRM_Core_Exception */ public static function exportComponents( @@ -206,15 +203,7 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c $processor->mergeSameAddress(); } - // In order to be able to write a unit test against this function we need to suppress - // the csv writing. In future hopefully the csv writing & the main processing will be in separate functions. - if (empty($exportParams['suppress_csv_for_testing'])) { - $processor->writeCSVFromTable(); - } - else { - // return tableName sqlColumns headerRows in test context - return [$processor->getTemporaryTable(), $sqlColumns, $processor->getHeaderRows(), $processor]; - } + $processor->writeCSVFromTable(); // delete the export temp table and component table $sql = "DROP TABLE IF EXISTS " . $processor->getTemporaryTable(); diff --git a/civicrm/CRM/Export/BAO/ExportProcessor.php b/civicrm/CRM/Export/BAO/ExportProcessor.php index 86ac5057df0b8068e2c4139f562167d0ea7e3085..6fae79fac17873f45d5b32ff2c74c89a4db5354d 100644 --- a/civicrm/CRM/Export/BAO/ExportProcessor.php +++ b/civicrm/CRM/Export/BAO/ExportProcessor.php @@ -623,6 +623,7 @@ class CRM_Export_BAO_ExportProcessor { $queryFields['country']['context'] = 'country'; $queryFields['world_region']['context'] = 'country'; $queryFields['state_province']['context'] = 'province'; + $queryFields['contact_id'] = ['title' => ts('Contact ID'), 'type' => CRM_Utils_Type::T_INT]; $this->queryFields = $queryFields; } diff --git a/civicrm/CRM/Financial/BAO/ExportFormat.php b/civicrm/CRM/Financial/BAO/ExportFormat.php index b352f9bb84e092c4d5805e5f35acd695ffeb26dd..cf4111509608bbf7f49c647f3c5b84983b00905d 100644 --- a/civicrm/CRM/Financial/BAO/ExportFormat.php +++ b/civicrm/CRM/Financial/BAO/ExportFormat.php @@ -209,11 +209,10 @@ abstract class CRM_Financial_BAO_ExportFormat { // create activity. $subject .= ' ' . ts('Batch') . '[' . $values['title'] . ']'; - $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, FALSE, FALSE, 'name'); $activityParams = [ - 'activity_type_id' => array_search('Export Accounting Batch', $activityTypes), + 'activity_type_id' => 'Export Accounting Batch', 'subject' => $subject, - 'status_id' => 2, + 'status_id' => 'Completed', 'activity_date_time' => date('YmdHis'), 'source_contact_id' => $session->get('userID'), 'source_record_id' => $values['id'], @@ -226,8 +225,7 @@ abstract class CRM_Financial_BAO_ExportFormat { 'upload_date' => date('YmdHis'), ], ]; - - CRM_Activity_BAO_Activity::create($activityParams); + civicrm_api3('Activity', 'create', $activityParams); } /** diff --git a/civicrm/CRM/Financial/BAO/FinancialType.php b/civicrm/CRM/Financial/BAO/FinancialType.php index b9154b1d6d98335997ce0ad340a492b32c581f0d..618bec0d194180bcee0c7f27e06dcf9958d91f6a 100644 --- a/civicrm/CRM/Financial/BAO/FinancialType.php +++ b/civicrm/CRM/Financial/BAO/FinancialType.php @@ -487,7 +487,7 @@ class CRM_Financial_BAO_FinancialType extends CRM_Financial_DAO_FinancialType { $realSetting = \Civi::$statics[__CLASS__]['is_acl_enabled'] = Civi::settings()->get('acl_financial_type'); if (!$realSetting) { $contributeSettings = Civi::settings()->get('contribution_invoice_settings'); - if (CRM_Utils_Array::value('acl_financial_type', $contributeSettings)) { + if (!empty($contributeSettings['acl_financial_type'])) { \Civi::$statics[__CLASS__]['is_acl_enabled'] = TRUE; } } diff --git a/civicrm/CRM/Financial/BAO/Payment.php b/civicrm/CRM/Financial/BAO/Payment.php index a4de716b08c26cfedca4f3ef54337e0097dc6fbb..0854915d035a2abf7f148ee1aa631c60aff5e558 100644 --- a/civicrm/CRM/Financial/BAO/Payment.php +++ b/civicrm/CRM/Financial/BAO/Payment.php @@ -59,12 +59,7 @@ class CRM_Financial_BAO_Payment { $isPaymentCompletesContribution = self::isPaymentCompletesContribution($params['contribution_id'], $params['total_amount']); - // For legacy reasons Pending payments are completed through completetransaction. - // @todo completetransaction should transition components but financial transactions - // should be handled through Payment.create. - $isSkipRecordingPaymentHereForLegacyHandlingReasons = ($contributionStatus == 'Pending' && $isPaymentCompletesContribution); - - if (!$isSkipRecordingPaymentHereForLegacyHandlingReasons && $params['total_amount'] > 0) { + if ($params['total_amount'] > 0) { $balanceTrxnParams['to_financial_account_id'] = CRM_Contribute_BAO_Contribution::getToFinancialAccount($contribution, $params); $balanceTrxnParams['from_financial_account_id'] = CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship($contribution['financial_type_id'], 'Accounts Receivable Account is'); $balanceTrxnParams['total_amount'] = $params['total_amount']; @@ -88,7 +83,7 @@ class CRM_Financial_BAO_Payment { $trxn = CRM_Core_BAO_FinancialTrxn::create($balanceTrxnParams); // @todo - this is just weird & historical & inconsistent - why 2 tracks? - if (CRM_Utils_Array::value('line_item', $params) && !empty($trxn)) { + if (!empty($params['line_item']) && !empty($trxn)) { foreach ($params['line_item'] as $values) { foreach ($values as $id => $amount) { $p = ['id' => $id]; @@ -164,7 +159,11 @@ class CRM_Financial_BAO_Payment { ); } else { - civicrm_api3('Contribution', 'completetransaction', ['id' => $contribution['id']]); + civicrm_api3('Contribution', 'completetransaction', [ + 'id' => $contribution['id'], + 'is_post_payment_create' => TRUE, + 'is_email_receipt' => $params['is_send_contribution_notification'], + ]); // Get the trxn $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution['id'], 'DESC'); $ftParams = ['id' => $trxnId['financialTrxnId']]; @@ -362,8 +361,6 @@ class CRM_Financial_BAO_Payment { * @param $updateStatus * - deprecate this param * - * @todo - make this protected once recordAdditionalPayment no longer calls it. - * * @return CRM_Financial_DAO_FinancialTrxn */ protected static function recordRefundPayment($contributionId, $trxnData, $updateStatus) { @@ -388,31 +385,6 @@ class CRM_Financial_BAO_Payment { if ($updateStatus) { CRM_Core_DAO::setFieldValue('CRM_Contribute_BAO_Contribution', $contributionId, 'contribution_status_id', $completedStatusId); } - // add financial item entry - $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contributionDAO->id); - if (!empty($lineItems)) { - foreach ($lineItems as $lineItemId => $lineItemValue) { - // don't record financial item for cancelled line-item - if ($lineItemValue['qty'] == 0) { - continue; - } - $paid = $financialTrxn->total_amount; - if (!empty(floatval($contributionDAO->total_amount))) { - $paid = $lineItemValue['line_total'] * ($financialTrxn->total_amount / $contributionDAO->total_amount); - } - $addFinancialEntry = [ - 'transaction_date' => $financialTrxn->trxn_date, - 'contact_id' => $contributionDAO->contact_id, - 'amount' => round($paid, 2), - 'currency' => $contributionDAO->currency, - 'status_id' => $paidStatus, - 'entity_id' => $lineItemId, - 'entity_table' => 'civicrm_line_item', - ]; - $trxnIds = ['id' => $financialTrxn->id]; - CRM_Financial_BAO_FinancialItem::create($addFinancialEntry, NULL, $trxnIds); - } - } return $financialTrxn; } diff --git a/civicrm/CRM/Financial/Form/FinancialAccount.php b/civicrm/CRM/Financial/Form/FinancialAccount.php index 227e6d01432b63ea59bb9bc61b5e7942fc72b363..724059888435b786647d486bd64771415267e97a 100644 --- a/civicrm/CRM/Financial/Form/FinancialAccount.php +++ b/civicrm/CRM/Financial/Form/FinancialAccount.php @@ -143,7 +143,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form { if ($values['financial_account_type_id'] != $financialAccountTypeId) { $errorMsg['financial_account_type_id'] = ts('Taxable accounts should have Financial Account Type set to Liability.'); } - if (CRM_Utils_Array::value('tax_rate', $values) == NULL) { + if (!isset($values['tax_rate'])) { $errorMsg['tax_rate'] = ts('Please enter value for tax rate'); } } diff --git a/civicrm/CRM/Grant/Form/Grant.php b/civicrm/CRM/Grant/Form/Grant.php index 36d7afa24fe8cc6b5e3cee3106d823a7fddad431..de05a0c7cb8d8da08e5c9aa4fdd33c2666a12a20 100644 --- a/civicrm/CRM/Grant/Form/Grant.php +++ b/civicrm/CRM/Grant/Form/Grant.php @@ -142,6 +142,11 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { $defaults['amount_granted'] = CRM_Utils_Money::format($defaults['amount_granted'], NULL, '%a'); } } + else { + if ($this->_contactID) { + $defaults['contact_id'] = $this->_contactID; + } + } return $defaults; } @@ -224,8 +229,9 @@ class CRM_Grant_Form_Grant extends CRM_Core_Form { ], ]); - if ($this->_context == 'standalone') { - $this->addEntityRef('contact_id', ts('Applicant'), ['create' => TRUE], TRUE); + $contactField = $this->addEntityRef('contact_id', ts('Applicant'), ['create' => TRUE], TRUE); + if ($this->_context != 'standalone') { + $contactField->freeze(); } } diff --git a/civicrm/CRM/Grant/Form/Task.php b/civicrm/CRM/Grant/Form/Task.php index e868f4d646651dc8e518d7952860b60010c73deb..1cc6fddb24b6bccfb9b0f96ed0c9821c2ddae925 100644 --- a/civicrm/CRM/Grant/Form/Task.php +++ b/civicrm/CRM/Grant/Form/Task.php @@ -63,7 +63,7 @@ class CRM_Grant_Form_Task extends CRM_Core_Form_Task { public static function preProcessCommon(&$form) { $form->_grantIds = []; - $values = $form->controller->exportValues('Search'); + $values = $form->controller->exportValues($form->get('searchFormName')); $form->_task = $values['task']; $tasks = CRM_Grant_Task::tasks(); diff --git a/civicrm/CRM/Import/Form/MapField.php b/civicrm/CRM/Import/Form/MapField.php index 654f2732686a311c2a0d1f7f56867a74399dd558..9a5a309a23bb8ca4335c906848808c58304d2e2e 100644 --- a/civicrm/CRM/Import/Form/MapField.php +++ b/civicrm/CRM/Import/Form/MapField.php @@ -153,4 +153,37 @@ abstract class CRM_Import_Form_MapField extends CRM_Core_Form { return $best; } + /** + * Add the saved mapping fields to the form. + * + * @param int|null $savedMappingID + * + * @throws \CiviCRM_API3_Exception + */ + protected function buildSavedMappingFields($savedMappingID) { + //to save the current mappings + if (!$savedMappingID) { + $saveDetailsName = ts('Save this field mapping'); + $this->applyFilter('saveMappingName', 'trim'); + $this->add('text', 'saveMappingName', ts('Name')); + $this->add('text', 'saveMappingDesc', ts('Description')); + } + else { + $savedMapping = $this->get('savedMapping'); + + $mappingName = (string) civicrm_api3('Mapping', 'getvalue', ['id' => $savedMappingID, 'return' => 'name']); + $this->set('loadedMapping', $savedMapping); + $this->assign('loadedMapping', $mappingName); + $this->assign('savedName', $mappingName); + $this->add('hidden', 'mappingId', $savedMappingID); + + $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL); + $saveDetailsName = ts('Save as a new field mapping'); + $this->add('text', 'saveMappingName', ts('Name')); + $this->add('text', 'saveMappingDesc', ts('Description')); + } + + $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, ['onclick' => "showSaveDetails(this)"]); + } + } diff --git a/civicrm/CRM/Import/ImportProcessor.php b/civicrm/CRM/Import/ImportProcessor.php new file mode 100644 index 0000000000000000000000000000000000000000..79ddc3b640e357b5a8974f71f6a861ca61792a3c --- /dev/null +++ b/civicrm/CRM/Import/ImportProcessor.php @@ -0,0 +1,570 @@ +<?php + +/** + * Class CRM_Import_ImportProcessor. + * + * Import processor class. This is intended to provide a sanitising wrapper around + * the form-oriented import classes. In particular it is intended to provide a clear translation + * between the saved mapping field format and the quick form & parser formats. + * + * In the first instance this is only being used in unit tests but the intent is to migrate + * to it on a trajectory similar to the ExportProcessor so it is not in the tests. + */ +class CRM_Import_ImportProcessor { + + /** + * An array of fields in the format used in the table civicrm_mapping_field. + * + * @var array + */ + protected $mappingFields = []; + + /** + * @var array + */ + protected $metadata = []; + + /** + * Metadata keyed by field title. + * + * @var array + */ + protected $metadataByTitle = []; + + /** + * Get contact type being imported. + * + * @var string + */ + protected $contactType; + + /** + * Get contact sub type being imported. + * + * @var string + */ + protected $contactSubType; + + /** + * Array of valid relationships for the contact type & subtype. + * + * @var array + */ + protected $validRelationships = []; + + /** + * Name of the form. + * + * Used for js for quick form. + * + * @var string + */ + protected $formName; + + /** + * @return string + */ + public function getFormName(): string { + return $this->formName; + } + + /** + * @param string $formName + */ + public function setFormName(string $formName) { + $this->formName = $formName; + } + + /** + * @return array + */ + public function getValidRelationships(): array { + if (!isset($this->validRelationships[$this->getContactType() . '_' . $this->getContactSubType()])) { + //Relationship importables + $relations = CRM_Contact_BAO_Relationship::getContactRelationshipType( + NULL, NULL, NULL, $this->getContactType(), + FALSE, 'label', TRUE, $this->getContactSubType() + ); + asort($relations); + $this->setValidRelationships($relations); + } + return $this->validRelationships[$this->getContactType() . '_' . $this->getContactSubType()]; + } + + /** + * @param array $validRelationships + */ + public function setValidRelationships(array $validRelationships) { + $this->validRelationships[$this->getContactType() . '_' . $this->getContactSubType()] = $validRelationships; + } + + /** + * Get contact subtype for import. + * + * @return string + */ + public function getContactSubType(): string { + return $this->contactSubType ?? ''; + } + + /** + * Set contact subtype for import. + * + * @param string $contactSubType + */ + public function setContactSubType($contactSubType) { + $this->contactSubType = (string) $contactSubType; + } + + /** + * Saved Mapping ID. + * + * @var int + */ + protected $mappingID; + + /** + * @return array + */ + public function getMetadata(): array { + return $this->metadata; + } + + /** + * Setting for metadata. + * + * We wrangle the label for custom fields to include the label since the + * metadata trait presents it in a more 'pure' form but the label is appended for importing. + * + * @param array $metadata + * + * @throws \CiviCRM_API3_Exception + */ + public function setMetadata(array $metadata) { + $fieldDetails = civicrm_api3('CustomField', 'get', [ + 'return' => ['custom_group_id.title'], + 'options' => ['limit' => 0], + ])['values']; + foreach ($metadata as $index => $field) { + if (!empty($field['custom_field_id'])) { + // The 'label' format for import is custom group title :: custom name title + $metadata[$index]['name'] = $index; + $metadata[$index]['title'] .= ' :: ' . $fieldDetails[$field['custom_field_id']]['custom_group_id.title']; + } + } + $this->metadata = $metadata; + } + + /** + * @return int + */ + public function getMappingID(): int { + return $this->mappingID; + } + + /** + * @param int $mappingID + */ + public function setMappingID(int $mappingID) { + $this->mappingID = $mappingID; + } + + /** + * Get the contact type for the import. + * + * @return string + */ + public function getContactType(): string { + return $this->contactType; + } + + /** + * @param string $contactType + */ + public function setContactType(string $contactType) { + $this->contactType = $contactType; + } + + /** + * Set the contact type according to the constant. + * + * @param int $contactTypeKey + */ + public function setContactTypeByConstant($contactTypeKey) { + $constantTypeMap = [ + CRM_Import_Parser::CONTACT_INDIVIDUAL => 'Individual', + CRM_Import_Parser::CONTACT_HOUSEHOLD => 'Household', + CRM_Import_Parser::CONTACT_ORGANIZATION => 'Organization', + ]; + $this->contactType = $constantTypeMap[$contactTypeKey]; + } + + /** + * Get Mapping Fields. + * + * @return array + * + * @throws \CiviCRM_API3_Exception + */ + public function getMappingFields(): array { + if (empty($this->mappingFields) && !empty($this->getMappingID())) { + $this->loadSavedMapping(); + } + return $this->mappingFields; + } + + /** + * Set mapping fields. + * + * We do a little cleanup here too. + * + * We ensure that column numbers are set and that the fields are ordered by them. + * + * This would mean the fields could be loaded unsorted. + * + * @param array $mappingFields + */ + public function setMappingFields(array $mappingFields) { + $i = 0; + foreach ($mappingFields as &$mappingField) { + if (!isset($mappingField['column_number'])) { + $mappingField['column_number'] = $i; + } + if ($mappingField['column_number'] > $i) { + $i = $mappingField['column_number']; + } + $i++; + } + $this->mappingFields = $this->rekeyBySortedColumnNumbers($mappingFields); + } + + /** + * Get the names of the mapped fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldNames() { + return CRM_Utils_Array::collect('name', $this->getMappingFields()); + } + + /** + * Get the field name for the given column. + * + * @param int $columnNumber + * + * @return string + * @throws \CiviCRM_API3_Exception + */ + public function getFieldName($columnNumber) { + return $this->getFieldNames()[$columnNumber]; + } + + /** + * Get the field name for the given column. + * + * @param int $columnNumber + * + * @return string + * @throws \CiviCRM_API3_Exception + */ + public function getRelationshipKey($columnNumber) { + $field = $this->getMappingFields()[$columnNumber]; + return empty($field['relationship_type_id']) ? NULL : $field['relationship_type_id'] . '_' . $field['relationship_direction']; + } + + /** + * Get relationship key only if it is valid. + * + * @param int $columnNumber + * + * @return string|null + * + * @throws \CiviCRM_API3_Exception + */ + public function getValidRelationshipKey($columnNumber) { + $key = $this->getRelationshipKey($columnNumber); + return $this->isValidRelationshipKey($key) ? $key : NULL; + } + + /** + * Get the IM Provider ID. + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getIMProviderID($columnNumber) { + return $this->getMappingFields()[$columnNumber]['im_provider_id'] ?? NULL; + } + + /** + * Get the Phone Type + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getPhoneTypeID($columnNumber) { + return $this->getMappingFields()[$columnNumber]['phone_type_id'] ?? NULL; + } + + /** + * Get the Website Type + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getWebsiteTypeID($columnNumber) { + return $this->getMappingFields()[$columnNumber]['website_type_id'] ?? NULL; + } + + /** + * Get the Location Type + * + * Returning 0 rather than null is historical. + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getLocationTypeID($columnNumber) { + return $this->getMappingFields()[$columnNumber]['location_type_id'] ?? 0; + } + + /** + * Get the IM or Phone type. + * + * We have a field that would be the 'relevant' type - which could be either. + * + * @param int $columnNumber + * + * @return int + * + * @throws \CiviCRM_API3_Exception + */ + public function getPhoneOrIMTypeID($columnNumber) { + return $this->getIMProviderID($columnNumber) ?? $this->getPhoneTypeID($columnNumber); + } + + /** + * Get the location types of the mapped fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldLocationTypes() { + return CRM_Utils_Array::collect('location_type_id', $this->getMappingFields()); + } + + /** + * Get the phone types of the mapped fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldPhoneTypes() { + return CRM_Utils_Array::collect('phone_type_id', $this->getMappingFields()); + } + + /** + * Get the names of the im_provider fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldIMProviderTypes() { + return CRM_Utils_Array::collect('im_provider_id', $this->getMappingFields()); + } + + /** + * Get the names of the website fields. + * + * @throws \CiviCRM_API3_Exception + */ + public function getFieldWebsiteTypes() { + return CRM_Utils_Array::collect('im_provider_id', $this->getMappingFields()); + } + + /** + * Get an instance of the importer object. + * + * @return CRM_Contact_Import_Parser_Contact + * + * @throws \CiviCRM_API3_Exception + */ + public function getImporterObject() { + $importer = new CRM_Contact_Import_Parser_Contact( + $this->getFieldNames(), + $this->getFieldLocationTypes(), + $this->getFieldPhoneTypes(), + $this->getFieldIMProviderTypes(), + // @todo - figure out related mappings. + // $mapperRelated = [], $mapperRelatedContactType = [], $mapperRelatedContactDetails = [], $mapperRelatedContactLocType = [], $mapperRelatedContactPhoneType = [], $mapperRelatedContactImProvider = [], + [], + [], + [], + [], + [], + [], + $this->getFieldWebsiteTypes() + // $mapperRelatedContactWebsiteType = [] + ); + $importer->init(); + $importer->_contactType = $this->getContactType(); + return $importer; + } + + /** + * Load the mapping from the datbase into the format that would be received from the UI. + * + * @throws \CiviCRM_API3_Exception + */ + protected function loadSavedMapping() { + $fields = civicrm_api3('MappingField', 'get', [ + 'mapping_id' => $this->getMappingID(), + 'options' => ['limit' => 0], + ])['values']; + foreach ($fields as $index => $field) { + // Fix up the fact that for lost reasons we save by label not name. + $fields[$index]['label'] = $field['name']; + if (empty($field['relationship_type_id'])) { + $fields[$index]['name'] = $this->getNameFromLabel($field['name']); + } + else { + // Honour legacy chaos factor. + if ($field['name'] === ts('- do not import -')) { + // This is why we save names not labels people.... + $field['name'] = 'do_not_import'; + } + $fields[$index]['name'] = strtolower(str_replace(" ", "_", $field['name'])); + // fix for edge cases, CRM-4954 + if ($fields[$index]['name'] === 'image_url') { + $fields[$index]['name'] = str_replace('url', 'URL', $fields[$index]['name']); + } + } + $fieldSpec = $this->getMetadata()[$fields[$index]['name']]; + if (empty($field['location_type_id']) && !empty($fieldSpec['hasLocationType'])) { + $fields[$index]['location_type_id'] = 'Primary'; + } + } + $this->mappingFields = $this->rekeyBySortedColumnNumbers($fields); + } + + /** + * Get the titles from metadata. + */ + public function getMetadataTitles() { + if (empty($this->metadataByTitle)) { + $this->metadataByTitle = CRM_Utils_Array::collect('title', $this->getMetadata()); + } + return $this->metadataByTitle; + } + + /** + * Rekey the array by the column_number. + * + * @param array $mappingFields + * + * @return array + */ + protected function rekeyBySortedColumnNumbers(array $mappingFields) { + $this->mappingFields = CRM_Utils_Array::rekey($mappingFields, 'column_number'); + ksort($this->mappingFields); + return $this->mappingFields; + } + + /** + * Get the field name from the label. + * + * @param string $label + * + * @return string + */ + protected function getNameFromLabel($label) { + $titleMap = array_flip($this->getMetadataTitles()); + return $titleMap[$label] ?? ''; + } + + /** + * Validate the key against the relationships available for the contatct type & subtype. + * + * @param string $key + * + * @return bool + */ + protected function isValidRelationshipKey($key) { + return !empty($this->getValidRelationships()[$key]) ? TRUE : FALSE; + } + + /** + * Get the relevant js for quickform. + * + * @param int $column + * + * @return string + * @throws \CiviCRM_API3_Exception + */ + public function getQuickFormJSForField($column) { + $columnNumbersToHide = []; + if ($this->getFieldName($column) === 'do_not_import') { + $columnNumbersToHide = [1, 2, 3]; + } + elseif ($this->getRelationshipKey($column)) { + if (!$this->getWebsiteTypeID($column) && !$this->getLocationTypeID($column)) { + $columnNumbersToHide[] = 2; + } + if (!$this->getFieldName($column)) { + $columnNumbersToHide[] = 1; + } + if (!$this->getPhoneOrIMTypeID($column)) { + $columnNumbersToHide[] = 3; + } + } + else { + if (!$this->getLocationTypeID($column) && !$this->getWebsiteTypeID($column)) { + $columnNumbersToHide[] = 1; + } + if (!$this->getPhoneOrIMTypeID($column)) { + $columnNumbersToHide[] = 2; + } + $columnNumbersToHide[] = 3; + } + + $jsClauses = []; + foreach ($columnNumbersToHide as $columnNumber) { + $jsClauses[] = $this->getFormName() . "['mapper[$column][" . $columnNumber . "]'].style.display = 'none';"; + } + return empty($jsClauses) ? '' : implode("\n", $jsClauses) . "\n"; + } + + /** + * Get the defaults for the column from the saved mapping. + * + * @param int $column + * + * @return array + * @throws \CiviCRM_API3_Exception + */ + public function getSavedQuickformDefaultsForColumn($column) { + if ($this->getFieldName($column) === 'do_not_import') { + return []; + } + if ($this->getValidRelationshipKey($column)) { + if ($this->getWebsiteTypeID($column)) { + return [$this->getValidRelationshipKey($column), $this->getFieldName($column), $this->getWebsiteTypeID($column)]; + } + return [$this->getValidRelationshipKey($column), $this->getFieldName($column), $this->getLocationTypeID($column), $this->getPhoneOrIMTypeID($column)]; + } + if ($this->getWebsiteTypeID($column)) { + return [$this->getFieldName($column), $this->getWebsiteTypeID($column)]; + } + return [(string) $this->getFieldName($column), $this->getLocationTypeID($column), $this->getPhoneOrIMTypeID($column)]; + } + +} diff --git a/civicrm/CRM/Mailing/Form/Search.php b/civicrm/CRM/Mailing/Form/Search.php index d2d6af941ea9a9480943a371ef514369c4ed67b0..6c03b4e9ef0de4dc460b9e6e6bf86d9aeadd561d 100644 --- a/civicrm/CRM/Mailing/Form/Search.php +++ b/civicrm/CRM/Mailing/Form/Search.php @@ -44,7 +44,8 @@ class CRM_Mailing_Form_Search extends CRM_Core_Form { CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'title') ); - CRM_Core_Form_Date::buildDateRange($this, 'mailing', 1, '_from', '_to', ts('From'), FALSE); + $dateFieldLabel = ($parent->_sms) ? ts('SMS Date') : ts('Mailing Date'); + $this->addDatePickerRange('mailing', $dateFieldLabel); $this->add('text', 'sort_name', ts('Created or Sent by'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name') @@ -111,14 +112,20 @@ class CRM_Mailing_Form_Search extends CRM_Core_Form { public function postProcess() { $params = $this->controller->exportValues($this->_name); - CRM_Contact_BAO_Query::fixDateValues($params["mailing_relative"], $params['mailing_from'], $params['mailing_to']); + if (!empty($params['mailing_relative'])) { + list($params['mailing_low'], $params['mailing_high']) = CRM_Utils_Date::getFromTo($params['mailing_relative'], $params['mailing_low'], $params['mailing_high']); + unset($params['mailing_relative']); + } + elseif (!empty($params['mailing_high'])) { + $params['mailing_high'] .= ' ' . '23:59:59'; + } $parent = $this->controller->getParent(); if (!empty($params)) { $fields = [ 'mailing_name', - 'mailing_from', - 'mailing_to', + 'mailing_low', + 'mailing_high', 'sort_name', 'campaign_id', 'mailing_status', @@ -132,16 +139,7 @@ class CRM_Mailing_Form_Search extends CRM_Core_Form { if (isset($params[$field]) && !CRM_Utils_System::isNull($params[$field]) ) { - if (in_array($field, [ - 'mailing_from', - 'mailing_to', - ]) && !$params["mailing_relative"]) { - $time = ($field == 'mailing_to') ? '235959' : NULL; - $parent->set($field, CRM_Utils_Date::processDate($params[$field], $time)); - } - else { - $parent->set($field, $params[$field]); - } + $parent->set($field, $params[$field]); } else { $parent->set($field, NULL); diff --git a/civicrm/CRM/Mailing/Selector/Browse.php b/civicrm/CRM/Mailing/Selector/Browse.php index a0ae8f5b656ecd48e891a260e3de5921e7fd0676..9440a77bb18419d66abef44bd41a43dc5bb15c94 100644 --- a/civicrm/CRM/Mailing/Selector/Browse.php +++ b/civicrm/CRM/Mailing/Selector/Browse.php @@ -522,7 +522,7 @@ LEFT JOIN civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul } $dateClause1 = $dateClause2 = []; - $from = $this->_parent->get('mailing_from'); + $from = $this->_parent->get('mailing_low'); if (!CRM_Utils_System::isNull($from)) { if ($this->_parent->get('unscheduled')) { $dateClause1[] = 'civicrm_mailing.created_date >= %2'; @@ -534,7 +534,7 @@ LEFT JOIN civicrm_contact scheduledContact ON ( $mailing.scheduled_id = schedul $params[2] = [$from, 'String']; } - $to = $this->_parent->get('mailing_to'); + $to = $this->_parent->get('mailing_high'); if (!CRM_Utils_System::isNull($to)) { if ($this->_parent->get('unscheduled')) { $dateClause1[] = ' civicrm_mailing.created_date <= %3 '; diff --git a/civicrm/CRM/Member/BAO/Membership.php b/civicrm/CRM/Member/BAO/Membership.php index 2b0dbc751260b2f1724b5bb3ce20a7848b412925..bbd24740df693ddc6f4bb57e6afe13896b9b9b5c 100644 --- a/civicrm/CRM/Member/BAO/Membership.php +++ b/civicrm/CRM/Member/BAO/Membership.php @@ -255,13 +255,13 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { * (reference ) an assoc array of name/value pairs. * @param array $ids * Deprecated parameter The array that holds all the db ids. - * @param bool $skipRedirect - * - * @throws CRM_Core_Exception * * @return CRM_Member_BAO_Membership|CRM_Core_Error + * @throws \CiviCRM_API3_Exception + * + * @throws CRM_Core_Exception */ - public static function create(&$params, &$ids = [], $skipRedirect = FALSE) { + public static function create(&$params, &$ids = []) { // always calculate status if is_override/skipStatusCal is not true. // giving respect to is_override during import. CRM-4012 @@ -381,14 +381,14 @@ class CRM_Member_BAO_Membership extends CRM_Member_DAO_Membership { foreach ($params['line_item'] as $priceSetId => $lineItems) { foreach ($lineItems as $lineIndex => $lineItem) { $lineMembershipType = CRM_Utils_Array::value('membership_type_id', $lineItem); - if (CRM_Utils_Array::value('contribution', $params)) { + if (!empty($params['contribution'])) { $params['line_item'][$priceSetId][$lineIndex]['contribution_id'] = $params['contribution']->id; } if ($lineMembershipType && $lineMembershipType == CRM_Utils_Array::value('membership_type_id', $params)) { $params['line_item'][$priceSetId][$lineIndex]['entity_id'] = $membership->id; $params['line_item'][$priceSetId][$lineIndex]['entity_table'] = 'civicrm_membership'; } - elseif (!$lineMembershipType && CRM_Utils_Array::value('contribution', $params)) { + elseif (!$lineMembershipType && !empty($params['contribution'])) { $params['line_item'][$priceSetId][$lineIndex]['entity_id'] = $params['contribution']->id; $params['line_item'][$priceSetId][$lineIndex]['entity_table'] = 'civicrm_contribution'; } @@ -1874,7 +1874,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND $memParams['contribution_recur_id'] = $contributionRecurID; } // @todo stop passing $ids - it is empty - $membership = self::create($memParams, $ids, FALSE); + $membership = self::create($memParams, $ids); return array($membership, $renewalMode, $dates); } @@ -2048,7 +2048,7 @@ INNER JOIN civicrm_contact contact ON ( contact.id = membership.contact_id AND // Relevant tests in api_v3_ContributionPageTest. $memParams['line_item'] = $lineItems; // @todo stop passing $ids (membership and userId may be set by this point) - $membership = self::create($memParams, $ids, FALSE); + $membership = self::create($memParams, $ids); // not sure why this statement is here, seems quite odd :( - Lobo: 12/26/2010 // related to: http://forum.civicrm.org/index.php/topic,11416.msg49072.html#msg49072 diff --git a/civicrm/CRM/Member/BAO/MembershipType.php b/civicrm/CRM/Member/BAO/MembershipType.php index 745294615101569dd39afebc50663db225b22515..f6e98d7a3a33ae4f1fdf1ebe164d93914369ff7f 100644 --- a/civicrm/CRM/Member/BAO/MembershipType.php +++ b/civicrm/CRM/Member/BAO/MembershipType.php @@ -156,6 +156,7 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { CRM_Member_PseudoConstant::membershipType(NULL, TRUE); civicrm_api3('membership', 'getfields', ['cache_clear' => 1, 'fieldname' => 'membership_type_id']); civicrm_api3('profile', 'getfields', ['action' => 'submit', 'cache_clear' => 1]); + Civi::cache('metadata')->clear(); } /** @@ -266,6 +267,8 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { /** * Get membership Types. * + * @deprecated use getAllMembershipTypes. + * * @param bool $public * * @return array @@ -288,6 +291,8 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { /** * Get membership Type Details. * + * @deprecated use getMembershipType. + * * @param int $membershipTypeId * * @return array|null @@ -625,27 +630,6 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { return $membershipDates; } - /** - * @deprecated Please use the Membership API - * Retrieve all Membership Types associated with an Organization - * - * @param int $orgID - * Id of Organization. - * - * @return array - * array of the details of membership types - */ - public static function getMembershipTypesByOrg($orgID) { - CRM_Core_Error::deprecatedFunctionWarning('membership_type api'); - $memberTypesSameParentOrg = civicrm_api3('MembershipType', 'get', [ - 'member_of_contact_id' => $orgID, - 'options' => [ - 'limit' => 0, - ], - ]); - return CRM_Utils_Array::value('values', $memberTypesSameParentOrg, []); - } - /** * Retrieve all Membership Types with Member of Contact id. * @@ -841,4 +825,30 @@ class CRM_Member_BAO_MembershipType extends CRM_Member_DAO_MembershipType { } } + /** + * Cached wrapper for membership types. + * + * Since this is used from the batched script caching helps. + * + * @throws \CiviCRM_API3_Exception + */ + public static function getAllMembershipTypes() { + if (!Civi::cache('metadata')->has(__CLASS__ . __FUNCTION__)) { + Civi::cache('metadata')->set(__CLASS__ . __FUNCTION__, civicrm_api3('MembershipType', 'get', ['options' => ['limit' => 0, 'sort' => 'weight']])['values']); + } + return Civi::cache('metadata')->get(__CLASS__ . __FUNCTION__); + } + + /** + * Get a specific membership type (leveraging the cache). + * + * @param int $id + * + * @return mixed + * @throws \CiviCRM_API3_Exception + */ + public static function getMembershipType($id) { + return self::getAllMembershipTypes()[$id]; + } + } diff --git a/civicrm/CRM/Member/BAO/Query.php b/civicrm/CRM/Member/BAO/Query.php index 9edfe64693e7f31f15b798094175bc710668d654..d8e0d9b9ea4211ed61f45c617cd84af0a0e5dfd3 100644 --- a/civicrm/CRM/Member/BAO/Query.php +++ b/civicrm/CRM/Member/BAO/Query.php @@ -67,9 +67,9 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { } //add join date - if (!empty($query->_returnProperties['join_date'])) { - $query->_select['join_date'] = "civicrm_membership.join_date as join_date"; - $query->_element['join_date'] = 1; + if (!empty($query->_returnProperties['membership_join_date'])) { + $query->_select['membership_join_date'] = "civicrm_membership.join_date as membership_join_date"; + $query->_element['membership_join_date'] = 1; } //add source @@ -161,12 +161,22 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { * @param CRM_Contact_BAO_Query $query */ public static function whereClauseSingle(&$values, &$query) { + if ($query->buildDateRangeQuery($values)) { + // @todo - move this to Contact_Query in or near the call to + // $this->buildRelativeDateQuery($values); + return; + } list($name, $op, $value, $grouping) = $values; switch ($name) { case 'member_join_date_low': case 'member_join_date_high': + Civi::log()->warning( + 'member_join_date field is deprecated please use membership_join_date field instead', + ['civi.tag' => 'deprecated'] + ); + $fldName = str_replace(['_low', '_high'], '', $name); $query->dateQueryBuilder($values, - 'civicrm_membership', 'member_join_date', 'join_date', + 'civicrm_membership', $fldName, 'join_date', 'Member Since' ); return; @@ -174,6 +184,10 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { case 'membership_start_date': case 'member_start_date_low': case 'member_start_date_high': + Civi::log()->warning( + 'member_start_date field is deprecated please use membership_start_date field instead', + ['civi.tag' => 'deprecated'] + ); $fldName = str_replace(['_low', '_high'], '', $name); $query->dateQueryBuilder($values, 'civicrm_membership', $fldName, 'start_date', @@ -184,6 +198,10 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { case 'membership_end_date': case 'member_end_date_low': case 'member_end_date_high': + Civi::log()->warning( + 'member_end_date field is deprecated please use membership_end_date field instead', + ['civi.tag' => 'deprecated'] + ); $fldName = str_replace(['_low', '_high'], '', $name); $query->dateQueryBuilder($values, 'civicrm_membership', $fldName, 'end_date', @@ -376,6 +394,7 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { $query->_qill[$grouping][] = $value ? ts("Membership Status Is Overriden") : ts("Membership Status Is NOT Overriden"); $query->_tables['civicrm_membership'] = $query->_whereTables['civicrm_membership'] = 1; return; + } } @@ -443,7 +462,7 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { 'membership_type' => 1, 'member_is_test' => 1, 'member_is_pay_later' => 1, - 'join_date' => 1, + 'membership_join_date' => 1, 'membership_start_date' => 1, 'membership_end_date' => 1, 'membership_source' => 1, @@ -454,7 +473,6 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { 'membership_recur_id' => 1, 'member_campaign_id' => 1, 'member_is_override' => 1, - 'member_auto_renew' => 1, ]; if ($includeCustomFields) { @@ -471,12 +489,29 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { return $properties; } + /** + * Get the metadata for fields to be included on the grant search form. + * + * @throws \CiviCRM_API3_Exception + */ + public static function getSearchFieldMetadata() { + $fields = [ + 'membership_join_date', + 'membership_start_date', + 'membership_end_date', + ]; + $metadata = civicrm_api3('Membership', 'getfields', [])['values']; + return array_intersect_key($metadata, array_flip($fields)); + } + /** * Build the search form. * * @param CRM_Core_Form $form */ public static function buildSearchForm(&$form) { + $form->addSearchFieldMetadata(['Membership' => self::getSearchFieldMetadata()]); + $form->addFormFieldsFromMetadata(); $membershipStatus = CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label', FALSE, FALSE); $form->add('select', 'membership_status_id', ts('Membership Status'), $membershipStatus, FALSE, [ 'id' => 'membership_status_id', @@ -494,17 +529,6 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { $form->addElement('text', 'member_source', ts('Source')); $form->add('number', 'membership_id', ts('Membership ID'), ['class' => 'four', 'min' => 1]); - CRM_Core_Form_Date::buildDateRange($form, 'member_join_date', 1, '_low', '_high', ts('From'), FALSE); - $form->addElement('hidden', 'member_join_date_range_error'); - - CRM_Core_Form_Date::buildDateRange($form, 'member_start_date', 1, '_low', '_high', ts('From'), FALSE); - $form->addElement('hidden', 'member_start_date_range_error'); - - CRM_Core_Form_Date::buildDateRange($form, 'member_end_date', 1, '_low', '_high', ts('From'), FALSE); - $form->addElement('hidden', 'member_end_date_range_error'); - - $form->addFormRule(['CRM_Member_BAO_Query', 'formRule'], $form); - $form->addYesNo('membership_is_current_member', ts('Current Member?'), TRUE); $form->addYesNo('member_is_primary', ts('Primary Member?'), TRUE); $form->addYesNo('member_pay_later', ts('Pay Later?'), TRUE); @@ -544,27 +568,4 @@ class CRM_Member_BAO_Query extends CRM_Core_BAO_Query { } } - /** - * Custom form rules. - * - * @param array $fields - * @param array $files - * @param CRM_Core_Form $form - * - * @return bool|array - */ - public static function formRule($fields, $files, $form) { - $errors = []; - - if ((empty($fields['member_join_date_low']) || empty($fields['member_join_date_high'])) && (empty($fields['member_start_date_low']) || empty($fields['member_start_date_high'])) && (empty($fields['member_end_date_low']) || empty($fields['member_end_date_high']))) { - return TRUE; - } - - CRM_Utils_Rule::validDateRange($fields, 'member_join_date', $errors, ts('Member Since')); - CRM_Utils_Rule::validDateRange($fields, 'member_start_date', $errors, ts('Start Date')); - CRM_Utils_Rule::validDateRange($fields, 'member_end_date', $errors, ts('End Date')); - - return empty($errors) ? TRUE : $errors; - } - } diff --git a/civicrm/CRM/Member/DAO/Membership.php b/civicrm/CRM/Member/DAO/Membership.php index 3fa1ead53912a70eb40d55c46e24b39b69a56c83..d9948efa77c02183ffc035747993dd4fa11b5e8a 100644 --- a/civicrm/CRM/Member/DAO/Membership.php +++ b/civicrm/CRM/Member/DAO/Membership.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Member/Membership.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:64ef044391b9dee565e8e2a9d893f4cf) + * (GenCodeChecksum:97d01bc13256a1dd315a86fb5faea1dc) */ /** @@ -229,7 +229,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { 'labelColumn' => 'name', ], ], - 'join_date' => [ + 'membership_join_date' => [ 'name' => 'join_date', 'type' => CRM_Utils_Type::T_DATE, 'title' => ts('Member Since'), @@ -328,7 +328,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { 'labelColumn' => 'label', ], ], - 'is_override' => [ + 'member_is_override' => [ 'name' => 'is_override', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Status Override'), @@ -381,6 +381,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { 'title' => ts('Max Related'), 'description' => ts('Maximum number of related memberships (membership_type override).'), 'where' => 'civicrm_membership.max_related', + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', @@ -423,12 +424,13 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { 'type' => 'CheckBox', ], ], - 'contribution_recur_id' => [ + 'membership_recur_id' => [ 'name' => 'contribution_recur_id', 'type' => CRM_Utils_Type::T_INT, 'title' => ts('Membership Recurring Contribution'), 'description' => ts('Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.'), 'where' => 'civicrm_membership.contribution_recur_id', + 'export' => TRUE, 'table_name' => 'civicrm_membership', 'entity' => 'Membership', 'bao' => 'CRM_Member_BAO_Membership', diff --git a/civicrm/CRM/Member/Form/Membership.php b/civicrm/CRM/Member/Form/Membership.php index 3169844fdc0bd2e722eec0f8235fe05eed9027bf..bdc9c861101e8bcdd05d732aed3365902efd38a6 100644 --- a/civicrm/CRM/Member/Form/Membership.php +++ b/civicrm/CRM/Member/Form/Membership.php @@ -1162,10 +1162,16 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $lineItem = [$this->_priceSetId => []]; + // BEGIN Fix for dev/core/issues/860 + // Prepare fee block and call buildAmount hook - based on CRM_Price_BAO_PriceSet::buildPriceSet(). + CRM_Price_BAO_PriceSet::applyACLFinancialTypeStatusToFeeBlock($this->_priceSet['fields']); + CRM_Utils_Hook::buildAmount('membership', $this, $this->_priceSet['fields']); + // END Fix for dev/core/issues/860 + CRM_Price_BAO_PriceSet::processAmount($this->_priceSet['fields'], $formValues, $lineItem[$this->_priceSetId], NULL, $this->_priceSetId); - if (CRM_Utils_Array::value('tax_amount', $formValues)) { + if (!empty($formValues['tax_amount'])) { $params['tax_amount'] = $formValues['tax_amount']; } $params['total_amount'] = CRM_Utils_Array::value('amount', $formValues); @@ -1739,7 +1745,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { // if selected membership doesn't match with earlier membership !in_array($this->_memType, $this->_memTypeSelected) ) { - if (CRM_Utils_Array::value('is_recur', $inputParams)) { + if (!empty($inputParams['is_recur'])) { CRM_Core_Session::setStatus(ts('Associated recurring contribution cannot be updated on membership type change.', ts('Error'), 'error')); return; } diff --git a/civicrm/CRM/Member/Form/MembershipRenewal.php b/civicrm/CRM/Member/Form/MembershipRenewal.php index 4c984618d31f36826e161e14fbd22493a08fca58..2553d1f1fb2af84f67369f7b1d7443bb1675d4c0 100644 --- a/civicrm/CRM/Member/Form/MembershipRenewal.php +++ b/civicrm/CRM/Member/Form/MembershipRenewal.php @@ -488,6 +488,8 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { * Process form submission. * * This function is also accessed by a unit test. + * + * @throws \CRM_Core_Exception */ protected function submit() { $this->storeContactFields($this->_params); @@ -585,12 +587,12 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { $membershipSource = $this->_params['membership_source']; } - $isPending = ($this->_params['contribution_status_id'] == 2) ? TRUE : FALSE; - + // @todo Move this into CRM_Member_BAO_Membership::processMembership + $pending = ($this->_params['contribution_status_id'] == array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus())) ? TRUE : FALSE; list($membership) = CRM_Member_BAO_Membership::processMembership( $this->_contactID, $this->_params['membership_type_id'][1], $isTestMembership, $renewalDate, NULL, $customFieldsFormatted, $numRenewTerms, $this->_membershipId, - $isPending, + $pending, $contributionRecurID, $membershipSource, $this->_params['is_pay_later'], CRM_Utils_Array::value('campaign_id', $this->_params) ); @@ -651,72 +653,82 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { } if (!empty($this->_params['send_receipt'])) { + $this->sendReceipt($membership); + } + } - $receiptFrom = $this->_params['from_email_address']; - - if (!empty($this->_params['payment_instrument_id'])) { - $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); - $this->_params['paidBy'] = $paymentInstrument[$this->_params['payment_instrument_id']]; - } - //get the group Tree - $this->_groupTree = CRM_Core_BAO_CustomGroup::getTree('Membership', NULL, $this->_id, FALSE, $this->_memType); + /** + * Send a receipt. + * + * @param array $membership + * + * @throws \CRM_Core_Exception + */ + protected function sendReceipt($membership) { + $receiptFrom = $this->_params['from_email_address']; - // retrieve custom data - $customFields = $customValues = $fo = []; - foreach ($this->_groupTree as $groupID => $group) { - if ($groupID == 'info') { - continue; - } - foreach ($group['fields'] as $k => $field) { - $field['title'] = $field['label']; - $customFields["custom_{$k}"] = $field; - } + if (!empty($this->_params['payment_instrument_id'])) { + $paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument(); + $this->_params['paidBy'] = $paymentInstrument[$this->_params['payment_instrument_id']]; + } + //get the group Tree + $this->_groupTree = CRM_Core_BAO_CustomGroup::getTree('Membership', NULL, $this->_id, FALSE, $this->_memType); + + // retrieve custom data + $customFields = $customValues = $fo = []; + foreach ($this->_groupTree as $groupID => $group) { + if ($groupID == 'info') { + continue; } - $members = [['member_id', '=', $this->_membershipId, 0, 0]]; - // check whether its a test drive - if ($this->_mode == 'test') { - $members[] = ['member_test', '=', 1, 0, 0]; + foreach ($group['fields'] as $k => $field) { + $field['title'] = $field['label']; + $customFields["custom_{$k}"] = $field; } - CRM_Core_BAO_UFGroup::getValues($this->_contactID, $customFields, $customValues, FALSE, $members); + } + $members = [['member_id', '=', $this->_membershipId, 0, 0]]; + // check whether its a test drive + if ($this->_mode == 'test') { + $members[] = ['member_test', '=', 1, 0, 0]; + } + CRM_Core_BAO_UFGroup::getValues($this->_contactID, $customFields, $customValues, FALSE, $members); - $this->assign_by_ref('formValues', $this->_params); - if (!empty($this->_params['contribution_id'])) { - $this->assign('contributionID', $this->_params['contribution_id']); - } + $this->assign_by_ref('formValues', $this->_params); + if (!empty($this->_params['contribution_id'])) { + $this->assign('contributionID', $this->_params['contribution_id']); + } - $this->assign('membership_name', CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', - $membership->membership_type_id + $this->assign('membership_name', CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', + $membership->membership_type_id + )); + $this->assign('customValues', $customValues); + $this->assign('mem_start_date', CRM_Utils_Date::customFormat($membership->start_date)); + $this->assign('mem_end_date', CRM_Utils_Date::customFormat($membership->end_date)); + if ($this->_mode) { + $this->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters( + $this->_params, + $this->_bltID )); - $this->assign('customValues', $customValues); - $this->assign('mem_start_date', CRM_Utils_Date::customFormat($membership->start_date)); - $this->assign('mem_end_date', CRM_Utils_Date::customFormat($membership->end_date)); - if ($this->_mode) { - $this->assign('address', CRM_Utils_Address::getFormattedBillingAddressFieldsFromParameters( - $this->_params, - $this->_bltID - )); - $this->assign('contributeMode', 'direct'); - $this->assign('isAmountzero', 0); - $this->assign('is_pay_later', 0); - $this->assign('isPrimary', 1); - $this->assign('receipt_text_renewal', $this->_params['receipt_text']); - if ($this->_mode == 'test') { - $this->assign('action', '1024'); - } + $this->assign('contributeMode', 'direct'); + $this->assign('isAmountzero', 0); + $this->assign('is_pay_later', 0); + $this->assign('isPrimary', 1); + $this->assign('receipt_text_renewal', $this->_params['receipt_text']); + if ($this->_mode == 'test') { + $this->assign('action', '1024'); } - - list($this->isMailSent) = CRM_Core_BAO_MessageTemplate::sendTemplate( - [ - 'groupName' => 'msg_tpl_workflow_membership', - 'valueName' => 'membership_offline_receipt', - 'contactId' => $this->_receiptContactId, - 'from' => $receiptFrom, - 'toName' => $this->_contributorDisplayName, - 'toEmail' => $this->_contributorEmail, - 'isTest' => $this->_mode == 'test', - ] - ); } + + list($this->isMailSent) = CRM_Core_BAO_MessageTemplate::sendTemplate( + [ + 'groupName' => 'msg_tpl_workflow_membership', + 'valueName' => 'membership_offline_receipt', + 'contactId' => $this->_receiptContactId, + 'from' => $receiptFrom, + 'toName' => $this->_contributorDisplayName, + 'toEmail' => $this->_contributorEmail, + 'isTest' => $this->_mode == 'test', + ] + ); } } diff --git a/civicrm/CRM/Member/Form/Search.php b/civicrm/CRM/Member/Form/Search.php index 8eba67bfa9c7d76d365568febfe240dd125a6696..3d7afe8ffcd6d50cd2a82621249ff62d51be8d7c 100644 --- a/civicrm/CRM/Member/Form/Search.php +++ b/civicrm/CRM/Member/Form/Search.php @@ -95,6 +95,8 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { } if ($this->_force) { + $this->addSearchFieldMetadata(['Membership' => CRM_Member_BAO_Query::getSearchFieldMetadata()]); + $this->addFormFieldsFromMetadata(); $this->postProcess(); $this->set('force', 0); } @@ -227,8 +229,7 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { } $this->_done = TRUE; - - $this->_formValues = $this->controller->exportValues($this->_name); + $this->setFormValues(); $this->fixFormValues(); @@ -292,17 +293,6 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { $controller->run(); } - /** - * Set default values. - * - * @todo - can this function override be removed? - * - * @return array - */ - public function setDefaultValues() { - return $this->_defaults; - } - /** * If this search has been forced then see if there are any get values, and if so over-ride the post values. * diff --git a/civicrm/CRM/Member/Form/Task/Batch.php b/civicrm/CRM/Member/Form/Task/Batch.php index 99d6af35a4e6f8585288ed65a9a9989195eb3508..35cc5a6b0988f78f15a6152c5b89085bb4d64ffe 100644 --- a/civicrm/CRM/Member/Form/Task/Batch.php +++ b/civicrm/CRM/Member/Form/Task/Batch.php @@ -212,7 +212,7 @@ class CRM_Member_Form_Task_Batch extends CRM_Member_Form_Task { // extend CRM_Event_Form_Task_BatchTest::testSubmit with a data provider to test // handling of custom data, specifically checkbox fields. $dates = [ - 'join_date', + 'membership_join_date', 'membership_start_date', 'membership_end_date', ]; diff --git a/civicrm/CRM/Member/Import/Parser/Membership.php b/civicrm/CRM/Member/Import/Parser/Membership.php index 2cea95d33e141499a52f37f4019e7e2355343ce2..224261207bfc6b81d74ac18ebb9b1edff2551655 100644 --- a/civicrm/CRM/Member/Import/Parser/Membership.php +++ b/civicrm/CRM/Member/Import/Parser/Membership.php @@ -29,13 +29,8 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2019 - * $Id$ - * */ - -require_once 'api/api.php'; - /** * class to parse membership csv files */ @@ -43,8 +38,6 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { protected $_mapperKeys; - private $_contactIdIndex; - private $_totalAmountIndex; private $_membershipTypeIndex; private $_membershipStatusIndex; @@ -93,16 +86,12 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $this->setActiveFields($this->_mapperKeys); // FIXME: we should do this in one place together with Form/MapField.php - $this->_contactIdIndex = -1; $this->_membershipTypeIndex = -1; $this->_membershipStatusIndex = -1; $index = 0; foreach ($this->_mapperKeys as $key) { switch ($key) { - case 'membership_contact_id': - $this->_contactIdIndex = $index; - break; case 'membership_type_id': $this->_membershipTypeIndex = $index; @@ -335,7 +324,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $params[$key] = $this->parsePseudoConstantField($val, $this->fieldMetadata[$key]); break; - case 'is_override': + case 'member_is_override': $params[$key] = CRM_Utils_String::strtobool($val); break; } @@ -374,7 +363,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { else { //fix for CRM-2219 Update Membership // onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE - if (!empty($formatted['is_override']) && empty($formatted['status_id'])) { + if (!empty($formatted['member_is_override']) && empty($formatted['status_id'])) { array_unshift($values, 'Required parameter missing: Status'); return CRM_Import_Parser::ERROR; } @@ -425,7 +414,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { $endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('end_date', $formatted), '%Y-%m-%d'); $joinDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('join_date', $formatted), '%Y-%m-%d'); - if ($this->_contactIdIndex < 0) { + if (!$this->isContactIDColumnPresent()) { $error = $this->checkContactDuplicate($formatValues); if (CRM_Core_Error::isAPIError($error, CRM_Core_ERROR::DUPLICATE_CONTACT)) { @@ -449,7 +438,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { //fix for CRM-3570, exclude the statuses those having is_admin = 1 //now user can import is_admin if is override is true. $excludeIsAdmin = FALSE; - if (empty($formatted['is_override'])) { + if (empty($formatted['member_is_override'])) { $formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE; } $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate, @@ -464,7 +453,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { if (empty($formatted['status_id'])) { $formatted['status_id'] = $calcStatus['id']; } - elseif (empty($formatted['is_override'])) { + elseif (empty($formatted['member_is_override'])) { if (empty($calcStatus)) { array_unshift($values, 'Status in import row (' . $formatValues['status_id'] . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.'); return CRM_Import_Parser::ERROR; @@ -539,7 +528,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { //fix for CRM-3570, exclude the statuses those having is_admin = 1 //now user can import is_admin if is override is true. $excludeIsAdmin = FALSE; - if (empty($formatted['is_override'])) { + if (empty($formatted['member_is_override'])) { $formatted['exclude_is_admin'] = $excludeIsAdmin = TRUE; } $calcStatus = CRM_Member_BAO_MembershipStatus::getMembershipStatusByDate($startDate, @@ -553,7 +542,7 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { if (empty($formatted['status_id'])) { $formatted['status_id'] = CRM_Utils_Array::value('id', $calcStatus); } - elseif (empty($formatted['is_override'])) { + elseif (empty($formatted['member_is_override'])) { if (empty($calcStatus)) { array_unshift($values, 'Status in import row (' . CRM_Utils_Array::value('status_id', $formatValues) . ') does not match calculated status based on your configured Membership Status Rules. Record was not imported.'); return CRM_Import_Parser::ERROR; @@ -749,4 +738,13 @@ class CRM_Member_Import_Parser_Membership extends CRM_Member_Import_Parser { return NULL; } + /** + * Is the contact ID mapped. + * + * @return bool + */ + protected function isContactIDColumnPresent(): bool { + return in_array('membership_contact_id', $this->_mapperKeys, TRUE); + } + } diff --git a/civicrm/CRM/Member/Selector/Search.php b/civicrm/CRM/Member/Selector/Search.php index 7c94dafc070edad45397e4335390ca87776a8885..0189535ece080ffb749dc5c7a7355e1599697125 100644 --- a/civicrm/CRM/Member/Selector/Search.php +++ b/civicrm/CRM/Member/Selector/Search.php @@ -62,7 +62,7 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C 'contact_type', 'sort_name', 'membership_type', - 'join_date', + 'membership_join_date', 'membership_start_date', 'membership_end_date', 'membership_source', @@ -493,7 +493,7 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C ], [ 'name' => ts('Member Since'), - 'sort' => 'join_date', + 'sort' => 'membership_join_date', 'direction' => CRM_Utils_Sort::DESCENDING, ], [ diff --git a/civicrm/CRM/Member/Tokens.php b/civicrm/CRM/Member/Tokens.php index 44100317acadb61f41b6e539fb972c17dd64b56b..455ba74ffa72e4c0fc52dcd4d6a88f39b6dd28d8 100644 --- a/civicrm/CRM/Member/Tokens.php +++ b/civicrm/CRM/Member/Tokens.php @@ -94,6 +94,9 @@ class CRM_Member_Tokens extends \Civi\Token\AbstractTokenSubscriber { if (in_array($field, ['start_date', 'end_date', 'join_date'])) { $row->tokens($entity, $field, \CRM_Utils_Date::customFormat($actionSearchResult->$field)); } + elseif ($field == 'fee') { + $row->tokens($entity, $field, \CRM_Utils_Money::format($actionSearchResult->$field, NULL, NULL, TRUE)); + } elseif (isset($actionSearchResult->$field)) { $row->tokens($entity, $field, $actionSearchResult->$field); } diff --git a/civicrm/CRM/Pledge/BAO/Pledge.php b/civicrm/CRM/Pledge/BAO/Pledge.php index 4e24c3e4e04ff3e126559d8096b864974b451d9b..0026d4a9ff0f6c4c987e09e9dcbf01a2c7dacbbb 100644 --- a/civicrm/CRM/Pledge/BAO/Pledge.php +++ b/civicrm/CRM/Pledge/BAO/Pledge.php @@ -1200,7 +1200,7 @@ SELECT pledge.contact_id as contact_id, public static function getPledgeStartDate($date, $pledgeBlock) { $startDate = (array) json_decode($pledgeBlock['pledge_start_date']); foreach ($startDate as $field => $value) { - if (!empty($date) && !CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) { + if (!empty($date) && empty($pledgeBlock['is_pledge_start_date_editable'])) { return $date; } if (empty($date)) { diff --git a/civicrm/CRM/Pledge/BAO/PledgeBlock.php b/civicrm/CRM/Pledge/BAO/PledgeBlock.php index 732a61a450e53b1923f7dea4edc7261805cd5c44..9d63fd5db409089eac16fc328e73a2e4694007c9 100644 --- a/civicrm/CRM/Pledge/BAO/PledgeBlock.php +++ b/civicrm/CRM/Pledge/BAO/PledgeBlock.php @@ -301,8 +301,8 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { } $form->addElement('select', 'pledge_frequency_unit', NULL, $freqUnits, ['aria-label' => ts('Frequency Units')]); // CRM-18854 - if (CRM_Utils_Array::value('is_pledge_start_date_visible', $pledgeBlock)) { - if (CRM_Utils_Array::value('pledge_start_date', $pledgeBlock)) { + if (!empty($pledgeBlock['is_pledge_start_date_visible'])) { + if (!empty($pledgeBlock['pledge_start_date'])) { $defaults = array(); $date = (array) json_decode($pledgeBlock['pledge_start_date']); foreach ($date as $field => $value) { @@ -335,7 +335,7 @@ class CRM_Pledge_BAO_PledgeBlock extends CRM_Pledge_DAO_PledgeBlock { $form->setDefaults($defaults); $form->assign('start_date_display', $paymentDate); $form->assign('start_date_editable', FALSE); - if (CRM_Utils_Array::value('is_pledge_start_date_editable', $pledgeBlock)) { + if (!empty($pledgeBlock['is_pledge_start_date_editable'])) { $form->assign('start_date_editable', TRUE); if ($field == 'calendar_month') { $form->assign('is_date', FALSE); diff --git a/civicrm/CRM/Pledge/BAO/Query.php b/civicrm/CRM/Pledge/BAO/Query.php index 1b3779060efd029774b8d3ff0df36b2f2467cc7b..1859eb7e06f3e26a1a4782720331fe6199d98975 100644 --- a/civicrm/CRM/Pledge/BAO/Query.php +++ b/civicrm/CRM/Pledge/BAO/Query.php @@ -82,6 +82,12 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; } + if (!empty($query->_returnProperties['pledge_end_date'])) { + $query->_select['pledge_end_date'] = 'civicrm_pledge.end_date as pledge_end_date'; + $query->_element['pledge_end_date'] = 1; + $query->_tables['civicrm_pledge'] = $query->_whereTables['civicrm_pledge'] = 1; + } + if (!empty($query->_returnProperties['pledge_start_date'])) { $query->_select['pledge_start_date'] = 'civicrm_pledge.start_date as pledge_start_date'; $query->_element['pledge_start_date'] = 1; @@ -239,43 +245,24 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { } /** - * @param $values - * @param $query + * Get where clause for field. + * + * @todo most of this could be replaced by using metadata. + * + * @param array $values + * @param \CRM_Contact_BAO_Query $query + * + * @throws \CRM_Core_Exception */ public static function whereClauseSingle(&$values, &$query) { + if ($query->buildDateRangeQuery($values)) { + // @todo - move this to Contact_Query in or near the call to + // $this->buildRelativeDateQuery($values); + return; + } list($name, $op, $value, $grouping, $wildcard) = $values; switch ($name) { - case 'pledge_create_date_low': - case 'pledge_create_date_high': - // process to / from date - $query->dateQueryBuilder($values, - 'civicrm_pledge', 'pledge_create_date', 'create_date', 'Pledge Made' - ); - case 'pledge_start_date_low': - case 'pledge_start_date_high': - // process to / from date - $query->dateQueryBuilder($values, - 'civicrm_pledge', 'pledge_start_date', 'start_date', 'Pledge Start Date' - ); - return; - - case 'pledge_end_date_low': - case 'pledge_end_date_high': - // process to / from date - $query->dateQueryBuilder($values, - 'civicrm_pledge', 'pledge_end_date', 'end_date', 'Pledge End Date' - ); - return; - - case 'pledge_payment_date_low': - case 'pledge_payment_date_high': - // process to / from date - $query->dateQueryBuilder($values, - 'civicrm_pledge_payment', 'pledge_payment_date', 'scheduled_date', 'Payment Scheduled' - ); - return; - case 'pledge_amount': case 'pledge_amount_low': case 'pledge_amount_high': @@ -531,11 +518,27 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { public static function getSearchFieldMetadata() { $fields = [ 'pledge_status_id', + 'pledge_start_date', + 'pledge_end_date', + 'pledge_create_date', ]; $metadata = civicrm_api3('Pledge', 'getfields', [])['values']; return array_intersect_key($metadata, array_flip($fields)); } + /** + * Get the metadata for fields to be included on the grant search form. + * + * @throws \CiviCRM_API3_Exception + */ + public static function getPledgePaymentSearchFieldMetadata() { + $fields = [ + 'pledge_payment_scheduled_date', + ]; + $metadata = civicrm_api3('PledgePayment', 'getfields', [])['values']; + return array_intersect_key($metadata, array_flip($fields)); + } + /** * Build the search for for pledges. * @@ -547,13 +550,8 @@ class CRM_Pledge_BAO_Query extends CRM_Core_BAO_Query { public static function buildSearchForm(&$form) { // pledge related dates $form->addSearchFieldMetadata(['Pledge' => self::getSearchFieldMetadata()]); + $form->addSearchFieldMetadata(['PledgePayment' => self::getPledgePaymentSearchFieldMetadata()]); $form->addFormFieldsFromMetadata(); - CRM_Core_Form_Date::buildDateRange($form, 'pledge_start_date', 1, '_low', '_high', ts('From'), FALSE); - CRM_Core_Form_Date::buildDateRange($form, 'pledge_end_date', 1, '_low', '_high', ts('From'), FALSE); - CRM_Core_Form_Date::buildDateRange($form, 'pledge_create_date', 1, '_low', '_high', ts('From'), FALSE); - - // pledge payment related dates - CRM_Core_Form_Date::buildDateRange($form, 'pledge_payment_date', 1, '_low', '_high', ts('From'), FALSE); $form->addYesNo('pledge_test', ts('Pledge is a Test?'), TRUE); $form->add('text', 'pledge_amount_low', ts('From'), ['size' => 8, 'maxlength' => 8]); diff --git a/civicrm/CRM/Pledge/DAO/Pledge.php b/civicrm/CRM/Pledge/DAO/Pledge.php index fe6abc9014b7a22588b9981699c21be87d56fc3f..76d0e11dd292c4cd7cc87d086ab06d9984de46a0 100644 --- a/civicrm/CRM/Pledge/DAO/Pledge.php +++ b/civicrm/CRM/Pledge/DAO/Pledge.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Pledge/Pledge.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:5e5bb725caa46ae10f0c5d039a03c675) + * (GenCodeChecksum:a25cc68d8392b1d60d7179ca484b604a) */ /** @@ -420,17 +420,19 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO { 'type' => 'Text', ], ], - 'start_date' => [ + 'pledge_start_date' => [ 'name' => 'start_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, 'title' => ts('Pledge Start Date'), 'description' => ts('The date the first scheduled pledge occurs.'), 'required' => TRUE, 'where' => 'civicrm_pledge.start_date', + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, + 'unique_title' => ts('Payments Start Date'), 'html' => [ 'type' => 'Select Date', ], @@ -491,16 +493,18 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO { 'type' => 'Select Date', ], ], - 'end_date' => [ + 'pledge_end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, 'title' => ts('Pledge End Date'), 'description' => ts('Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).'), 'where' => 'civicrm_pledge.end_date', + 'export' => TRUE, 'table_name' => 'civicrm_pledge', 'entity' => 'Pledge', 'bao' => 'CRM_Pledge_BAO_Pledge', 'localizable' => 0, + 'unique_title' => ts('Payments Ended Date'), 'html' => [ 'type' => 'Select Date', ], diff --git a/civicrm/CRM/Pledge/DAO/PledgePayment.php b/civicrm/CRM/Pledge/DAO/PledgePayment.php index 5e1da56ae5f8280d2f433f6ee5e54658b55d5978..879a6fa973d2fb0cd1fd738d36e63ed983995bcc 100644 --- a/civicrm/CRM/Pledge/DAO/PledgePayment.php +++ b/civicrm/CRM/Pledge/DAO/PledgePayment.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Pledge/PledgePayment.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:7dfb4f8000b79fa8b1abab1de3712fc1) + * (GenCodeChecksum:563e2926d00b9fe0c4919bfd9a0a05e7) */ /** @@ -236,6 +236,7 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO { 'entity' => 'PledgePayment', 'bao' => 'CRM_Pledge_BAO_PledgePayment', 'localizable' => 0, + 'unique_title' => ts('Payment Scheduled'), 'html' => [ 'type' => 'Select Date', 'formatType' => 'activityDate', diff --git a/civicrm/CRM/Pledge/Form/Search.php b/civicrm/CRM/Pledge/Form/Search.php index ecf8f503e4645e2a62320be59b044a6265667ded..1f735e48af4f46b8b505dffc6d47b97fd9c663ed 100644 --- a/civicrm/CRM/Pledge/Form/Search.php +++ b/civicrm/CRM/Pledge/Form/Search.php @@ -98,6 +98,10 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { } if ($this->_force) { + // pledge related dates + $this->addSearchFieldMetadata(['Pledge' => CRM_Pledge_BAO_Query::getSearchFieldMetadata()]); + $this->addSearchFieldMetadata(['PledgePayment' => CRM_Pledge_BAO_Query::getPledgePaymentSearchFieldMetadata()]); + $this->addFormFieldsFromMetadata(); $this->postProcess(); $this->set('force', 0); } @@ -230,7 +234,7 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { $this->_done = TRUE; - $this->_formValues = $this->controller->exportValues($this->_name); + $this->setFormValues(); $this->fixFormValues(); @@ -321,19 +325,6 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { $this->addFormRule(['CRM_Pledge_Form_Search', 'formRule']); } - /** - * Set the default form values. - * - * - * @return array - * the default array reference - */ - public function setDefaultValues() { - $defaults = []; - $defaults = $this->_formValues; - return $defaults; - } - public function fixFormValues() { if (!$this->_force) { return; diff --git a/civicrm/CRM/Price/BAO/LineItem.php b/civicrm/CRM/Price/BAO/LineItem.php index a64651d67019ff323bd2dbd607074297a4840d3f..0c88ab14d9bb459f2eeb3c77879e43548052cb85 100644 --- a/civicrm/CRM/Price/BAO/LineItem.php +++ b/civicrm/CRM/Price/BAO/LineItem.php @@ -70,7 +70,7 @@ class CRM_Price_BAO_LineItem extends CRM_Price_DAO_LineItem { $params['unit_price'] = 0; } } - if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) { + if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) { if (empty($params['financial_type_id'])) { throw new Exception('Mandatory key(s) missing from params array: financial_type_id'); } @@ -769,21 +769,18 @@ WHERE li.contribution_id = %1"; ]); unset($updateFinancialItemInfoValues['financialTrxn']); } - elseif (!empty($updateFinancialItemInfoValues['link-financial-trxn']) && $newFinancialItem->amount != 0) { + elseif ($trxn && $newFinancialItem->amount != 0) { civicrm_api3('EntityFinancialTrxn', 'create', [ 'entity_id' => $newFinancialItem->id, 'entity_table' => 'civicrm_financial_item', 'financial_trxn_id' => $trxn->id, 'amount' => $newFinancialItem->amount, ]); - unset($updateFinancialItemInfoValues['link-financial-trxn']); } } } - // @todo - it may be that trxn_id is always empty - flush out scenarios. Add tests. - $trxnId = !empty($trxn->id) ? ['id' => $trxn->id] : []; - $lineItemObj->addFinancialItemsOnLineItemsChange(array_merge($requiredChanges['line_items_to_add'], $requiredChanges['line_items_to_resurrect']), $entityID, $entityTable, $contributionId, $trxnId); + $lineItemObj->addFinancialItemsOnLineItemsChange(array_merge($requiredChanges['line_items_to_add'], $requiredChanges['line_items_to_resurrect']), $entityID, $entityTable, $contributionId, $trxn->id ?? NULL); // update participant fee_amount column $lineItemObj->updateEntityRecordOnChangeFeeSelection($params, $entityID, $entity); @@ -842,8 +839,6 @@ WHERE li.contribution_id = %1"; if ($amountChangeOnTextLineItem !== (float) 0) { // calculate the amount difference, considered as financial item amount $updateFinancialItemInfoValues['amount'] = $amountChangeOnTextLineItem; - // add a flag, later used to link financial trxn and this new financial item - $updateFinancialItemInfoValues['link-financial-trxn'] = TRUE; if ($previousLineItems[$updateFinancialItemInfoValues['entity_id']]['tax_amount']) { $updateFinancialItemInfoValues['tax']['amount'] = $lineItemsToUpdate[$updateFinancialItemInfoValues['entity_id']]['tax_amount'] - $previousLineItems[$updateFinancialItemInfoValues['entity_id']]['tax_amount']; $updateFinancialItemInfoValues['tax']['description'] = $this->getSalesTaxTerm(); @@ -1033,13 +1028,14 @@ WHERE li.contribution_id = %1"; * @param int $entityID * @param string $entityTable * @param int $contributionID - * @param bool $isCreateAdditionalFinancialTrxn + * @param bool $trxnID * Is there a change to the total balance requiring additional transactions to be created. */ - protected function addFinancialItemsOnLineItemsChange($lineItemsToAdd, $entityID, $entityTable, $contributionID, $isCreateAdditionalFinancialTrxn) { + protected function addFinancialItemsOnLineItemsChange($lineItemsToAdd, $entityID, $entityTable, $contributionID, $trxnID) { $updatedContribution = new CRM_Contribute_BAO_Contribution(); $updatedContribution->id = $contributionID; $updatedContribution->find(TRUE); + $trxnArray = $trxnID ? ['id' => $trxnID] : NULL; foreach ($lineItemsToAdd as $priceFieldValueID => $lineParams) { $lineParams = array_merge($lineParams, [ @@ -1047,7 +1043,14 @@ WHERE li.contribution_id = %1"; 'entity_id' => $entityID, 'contribution_id' => $contributionID, ]); - $this->addFinancialItemsOnLineItemChange($isCreateAdditionalFinancialTrxn, $lineParams, $updatedContribution); + $financialTypeChangeTrxnID = $this->addFinancialItemsOnLineItemChange($trxnID, $lineParams, $updatedContribution); + $lineObj = CRM_Price_BAO_LineItem::retrieve($lineParams); + // insert financial items + // ensure entity_financial_trxn table has a linking of it. + CRM_Financial_BAO_FinancialItem::add($lineObj, $updatedContribution, NULL, $trxnArray); + if (isset($lineObj->tax_amount)) { + CRM_Financial_BAO_FinancialItem::add($lineObj, $updatedContribution, TRUE, $trxnArray); + } } } @@ -1253,15 +1256,13 @@ WHERE li.contribution_id = %1"; $tempFinancialTrxnID = NULL; // don't add financial item for cancelled line item if ($lineParams['qty'] == 0) { - return; + return NULL; } elseif ($isCreateAdditionalFinancialTrxn) { // This routine & the return below is super uncomfortable. - // I have refactored to here but don't understand how this would be hit - // and it is how it would be a good thing, given the odd return below which - // does not seem consistent with what is going on. - // I'm tempted to add an e-deprecated into it to confirm my suspicion it only exists to - // cause mental anguish. + // I have refactored to here and it is hit from + // testSubmitUnpaidPriceChangeWhileStillPending + // but I'm still skeptical it's not covered elsewhere. // original comment : add financial item if ONLY financial type is changed if ($lineParams['financial_type_id'] != $updatedContribution->financial_type_id) { $changedFinancialTypeID = (int) $lineParams['financial_type_id']; @@ -1279,16 +1280,9 @@ WHERE li.contribution_id = %1"; 'currency' => $updatedContribution->currency, ]; $adjustedTrxn = CRM_Core_BAO_FinancialTrxn::create($adjustedTrxnValues); - $tempFinancialTrxnID = ['id' => $adjustedTrxn->id]; + return $adjustedTrxn->id; } } - $lineObj = CRM_Price_BAO_LineItem::retrieve($lineParams); - // insert financial items - // ensure entity_financial_trxn table has a linking of it. - CRM_Financial_BAO_FinancialItem::add($lineObj, $updatedContribution, NULL, $tempFinancialTrxnID); - if (isset($lineObj->tax_amount)) { - CRM_Financial_BAO_FinancialItem::add($lineObj, $updatedContribution, TRUE, $tempFinancialTrxnID); - } } /** diff --git a/civicrm/CRM/Price/BAO/PriceField.php b/civicrm/CRM/Price/BAO/PriceField.php index 67bcd99b65c0a47b27e49f94f38b98f777e0d621..1020c6009a563536d9f40d928891d996a3cfdf42 100644 --- a/civicrm/CRM/Price/BAO/PriceField.php +++ b/civicrm/CRM/Price/BAO/PriceField.php @@ -61,6 +61,9 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { * @return CRM_Price_BAO_PriceField */ public static function add(&$params) { + $hook = empty($params['id']) ? 'create' : 'edit'; + CRM_Utils_Hook::pre($hook, 'PriceField', CRM_Utils_Array::value('id', $params), $params); + $priceFieldBAO = new CRM_Price_BAO_PriceField(); $priceFieldBAO->copyValues($params); @@ -70,6 +73,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { } $priceFieldBAO->save(); + CRM_Utils_Hook::post($hook, 'PriceField', $priceFieldBAO->id, $priceFieldBAO); return $priceFieldBAO; } @@ -112,6 +116,7 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { ]); foreach ($fieldOptions['values'] as $option) { $optionsIds['id'] = $option['id']; + $params['option_id'] = [1 => $option['id']]; // CRM-19741 If we are dealing with price fields that are Text only set the field value label to match if (!empty($params['id']) && $priceField->label != $option['label']) { $fieldValue = new CRM_Price_DAO_PriceFieldValue(); @@ -173,10 +178,10 @@ class CRM_Price_BAO_PriceField extends CRM_Price_DAO_PriceField { } if ($opIds = CRM_Utils_Array::value('option_id', $params)) { if ($opId = CRM_Utils_Array::value($index, $opIds)) { - $optionsIds['id'] = $opId; + $options['id'] = $opId; } else { - $optionsIds['id'] = NULL; + $options['id'] = NULL; } } try { diff --git a/civicrm/CRM/Price/BAO/PriceFieldValue.php b/civicrm/CRM/Price/BAO/PriceFieldValue.php index dd590ca82f9e011cb09c5c9bc785dab59ff0e130..57a78fc07119e3aa473e360697d2007c928a453e 100644 --- a/civicrm/CRM/Price/BAO/PriceFieldValue.php +++ b/civicrm/CRM/Price/BAO/PriceFieldValue.php @@ -48,19 +48,17 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue { * @return CRM_Price_DAO_PriceFieldValue */ public static function add(&$params, $ids = []) { + $hook = empty($params['id']) ? 'create' : 'edit'; + CRM_Utils_Hook::pre($hook, 'PriceFieldValue', CRM_Utils_Array::value('id', $params), $params); $fieldValueBAO = new CRM_Price_BAO_PriceFieldValue(); $fieldValueBAO->copyValues($params); - if ($id = CRM_Utils_Array::value('id', $ids)) { - $fieldValueBAO->id = $id; - $prevLabel = self::getOptionLabel($id); - if (!empty($params['label']) && $prevLabel != $params['label']) { - self::updateAmountAndFeeLevel($id, $prevLabel, $params['label']); - } - } // CRM-16189 $priceFieldID = CRM_Utils_Array::value('price_field_id', $params); + + $id = CRM_Utils_Array::value('id', $ids, CRM_Utils_Array::value('id', $params)); + if (!$priceFieldID) { $priceFieldID = CRM_Core_DAO::getFieldValue('CRM_Price_BAO_PriceFieldValue', $id, 'price_field_id'); } @@ -71,6 +69,8 @@ class CRM_Price_BAO_PriceFieldValue extends CRM_Price_DAO_PriceFieldValue { } $fieldValueBAO->save(); + CRM_Utils_Hook::post($hook, 'PriceFieldValue', $fieldValueBAO->id, $fieldValueBAO); + // Reset the cached values in this function. CRM_Price_BAO_PriceField::getOptions(CRM_Utils_Array::value('price_field_id', $params), FALSE, TRUE); return $fieldValueBAO; @@ -312,39 +312,4 @@ WHERE cpse.id IS NOT NULL {$where}"; CRM_Core_DAO::executeQuery($sql, $params); } - /** - * Update price option label in line_item, civicrm_contribution and civicrm_participant. - * - * @param int $id - id of the price_field_value - * @param string $prevLabel - * @param string $newLabel - * - */ - public static function updateAmountAndFeeLevel($id, $prevLabel, $newLabel) { - // update price field label in line item. - $lineItem = new CRM_Price_DAO_LineItem(); - $lineItem->price_field_value_id = $id; - $lineItem->label = $prevLabel; - $lineItem->find(); - while ($lineItem->fetch()) { - $lineItemParams['id'] = $lineItem->id; - $lineItemParams['label'] = $newLabel; - CRM_Price_BAO_LineItem::create($lineItemParams); - - // update amount and fee level in civicrm_contribution and civicrm_participant - $params = [ - 1 => [CRM_Core_DAO::VALUE_SEPARATOR . $prevLabel . ' -', 'String'], - 2 => [CRM_Core_DAO::VALUE_SEPARATOR . $newLabel . ' -', 'String'], - ]; - // Update contribution - if (!empty($lineItem->contribution_id)) { - CRM_Core_DAO::executeQuery("UPDATE `civicrm_contribution` SET `amount_level` = REPLACE(amount_level, %1, %2) WHERE id = {$lineItem->contribution_id}", $params); - } - // Update participant - if ($lineItem->entity_table == 'civicrm_participant') { - CRM_Core_DAO::executeQuery("UPDATE `civicrm_participant` SET `fee_level` = REPLACE(fee_level, %1, %2) WHERE id = {$lineItem->entity_id}", $params); - } - } - } - } diff --git a/civicrm/CRM/Price/BAO/PriceSet.php b/civicrm/CRM/Price/BAO/PriceSet.php index c5b7caaad66144818e3a0752f5ed04ab89941907..c7d9ebe7079ec8f5b958ee4568fc1f964cec60ac 100644 --- a/civicrm/CRM/Price/BAO/PriceSet.php +++ b/civicrm/CRM/Price/BAO/PriceSet.php @@ -60,6 +60,9 @@ class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet { * @return CRM_Price_DAO_PriceSet */ public static function create(&$params) { + $hook = empty($params['id']) ? 'create' : 'edit'; + CRM_Utils_Hook::pre($hook, 'PriceSet', CRM_Utils_Array::value('id', $params), $params); + if (empty($params['id']) && empty($params['name'])) { $params['name'] = CRM_Utils_String::munge($params['title'], '_', 242); } @@ -81,7 +84,10 @@ class CRM_Price_BAO_PriceSet extends CRM_Price_DAO_PriceSet { if (self::eventPriceSetDomainID()) { $priceSetBAO->domain_id = CRM_Core_Config::domainID(); } - return $priceSetBAO->save(); + $priceSetBAO->save(); + + CRM_Utils_Hook::post($hook, 'PriceSet', $priceSetBAO->id, $priceSetBAO); + return $priceSetBAO; } /** @@ -727,7 +733,7 @@ WHERE id = %1"; $field['options'][$optionValueId]['tax_amount'] = round($taxAmount['tax_amount'], 2); } } - if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) { + if (!empty($field['options'][$optionValueId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax); } $totalPrice += $lineItem[$firstOption['id']]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[key($field['options'])]); @@ -742,7 +748,7 @@ WHERE id = %1"; $optionValueId = CRM_Utils_Array::key(1, $params["price_{$id}"]); CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, $amount_override); - if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) { + if (!empty($field['options'][$optionValueId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax); if ($amount_override) { $lineItem[$optionValueId]['line_total'] = $lineItem[$optionValueId]['unit_price'] = CRM_Utils_Rule::cleanMoney($lineItem[$optionValueId]['line_total'] - $lineItem[$optionValueId]['tax_amount']); @@ -765,7 +771,7 @@ WHERE id = %1"; $optionValueId = CRM_Utils_Array::key(1, $params["price_{$id}"]); CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params)); - if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionValueId])) { + if (!empty($field['options'][$optionValueId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionValueId, $totalTax); } $totalPrice += $lineItem[$optionValueId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionValueId]); @@ -782,7 +788,7 @@ WHERE id = %1"; CRM_Price_BAO_LineItem::format($id, $params, $field, $lineItem, CRM_Utils_Array::value('partial_payment_total', $params)); foreach ($params["price_{$id}"] as $optionId => $option) { - if (CRM_Utils_Array::value('tax_rate', $field['options'][$optionId])) { + if (!empty($field['options'][$optionId]['tax_rate'])) { $lineItem = self::setLineItem($field, $lineItem, $optionId, $totalTax); } $totalPrice += $lineItem[$optionId]['line_total'] + CRM_Utils_Array::value('tax_amount', $lineItem[$optionId]); @@ -1008,19 +1014,9 @@ WHERE id = %1"; else { $feeBlock = &$form->_priceSet['fields']; } - if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) { - foreach ($feeBlock as $key => $value) { - foreach ($value['options'] as $k => $options) { - if (!CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($options['financial_type_id']))) { - unset($feeBlock[$key]['options'][$k]); - } - } - if (empty($feeBlock[$key]['options'])) { - unset($feeBlock[$key]); - } - } - } - // call the hook. + + self::applyACLFinancialTypeStatusToFeeBlock($feeBlock); + // Call the buildAmount hook. CRM_Utils_Hook::buildAmount($component, $form, $feeBlock); // CRM-14492 Admin price fields should show up on event registration if user has 'administer CiviCRM' permissions @@ -1074,6 +1070,29 @@ WHERE id = %1"; } } + /** + * Apply ACLs on Financial Type to the price options in a fee block. + * + * @param array $feeBlock + * Fee block: array of price fields. + * + * @return void + */ + public static function applyACLFinancialTypeStatusToFeeBlock(&$feeBlock) { + if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) { + foreach ($feeBlock as $key => $value) { + foreach ($value['options'] as $k => $options) { + if (!CRM_Core_Permission::check('add contributions of type ' . CRM_Contribute_PseudoConstant::financialType($options['financial_type_id']))) { + unset($feeBlock[$key]['options'][$k]); + } + } + if (empty($feeBlock[$key]['options'])) { + unset($feeBlock[$key]); + } + } + } + } + /** * Check the current Membership having end date null. * diff --git a/civicrm/CRM/Price/Form/Field.php b/civicrm/CRM/Price/Form/Field.php index dc237c1fa735a497ee4d21c81a8dfd9791375fe4..08ff9e40afb677af01779a5e23e029bed7eccd7e 100644 --- a/civicrm/CRM/Price/Form/Field.php +++ b/civicrm/CRM/Price/Form/Field.php @@ -422,7 +422,7 @@ class CRM_Price_Form_Field extends CRM_Core_Form { } if ((is_numeric(CRM_Utils_Array::value('count', $fields)) && - CRM_Utils_Array::value('count', $fields) == 0 + empty($fields['count']) ) && (CRM_Utils_Array::value('html_type', $fields) == 'Text') ) { diff --git a/civicrm/CRM/Price/Form/Option.php b/civicrm/CRM/Price/Form/Option.php index 1ad15e8ddcfd4afdef248182fcbf053435c9b3d7..3e52ab48c9144c2a1b64389e1f369991e2610041 100644 --- a/civicrm/CRM/Price/Form/Option.php +++ b/civicrm/CRM/Price/Form/Option.php @@ -357,7 +357,7 @@ class CRM_Price_Form_Option extends CRM_Core_Form { $params['visibility_id'] = CRM_Utils_Array::value('visibility_id', $params, FALSE); $ids = []; if ($this->_oid) { - $ids['id'] = $this->_oid; + $params['id'] = $this->_oid; } $optionValue = CRM_Price_BAO_PriceFieldValue::create($params, $ids); diff --git a/civicrm/CRM/Report/Form.php b/civicrm/CRM/Report/Form.php index 8090032de0de291ec5aa7f9295f47592a3493d4f..77495fdcbaa1c586e3199d2bb8c8231029c278cf 100644 --- a/civicrm/CRM/Report/Form.php +++ b/civicrm/CRM/Report/Form.php @@ -155,9 +155,6 @@ class CRM_Report_Form extends CRM_Core_Form { */ protected $_groupFilter = FALSE; - // [ML] Required for civiexportexcel - public $supportsExportExcel = TRUE; - /** * Has the report been optimised for group filtering. * @@ -2845,11 +2842,6 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND $this->_absoluteUrl = TRUE; $this->addPaging = FALSE; } - elseif ($this->_outputMode == 'excel2007') { - $printOnly = TRUE; - $this->_absoluteUrl = TRUE; - $this->addPaging = FALSE; - } elseif ($this->_outputMode == 'group') { $this->assign('outputMode', 'group'); } @@ -3502,9 +3494,6 @@ WHERE cg.extends IN ('" . implode("','", $this->_customGroupExtends) . "') AND elseif ($this->_outputMode == 'csv') { CRM_Report_Utils_Report::export2csv($this, $rows); } - elseif ($this->_outputMode == 'excel2007') { - CRM_CiviExportExcel_Utils_Report::export2excel2007($this, $rows); - } elseif ($this->_outputMode == 'group') { $group = $this->_params['groups']; $this->add2group($group); diff --git a/civicrm/CRM/Report/Form/Contact/LoggingSummary.php b/civicrm/CRM/Report/Form/Contact/LoggingSummary.php index 97ebefc94bc5efebf13f853d607745f48b1742d6..4c98b4eb64b0d7d9e77ecb41c3b1534e851ce1aa 100644 --- a/civicrm/CRM/Report/Form/Contact/LoggingSummary.php +++ b/civicrm/CRM/Report/Form/Contact/LoggingSummary.php @@ -271,7 +271,7 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { $date = CRM_Utils_Date::isoToMysql($row['log_civicrm_entity_log_date']); - if ('Update' == CRM_Utils_Array::value('log_civicrm_entity_log_action', $row)) { + if (in_array(CRM_Utils_Array::value('log_civicrm_entity_log_action', $row), ['Update', 'Delete'])) { $row = $this->addDetailReportLinksToRow($baseQueryCriteria, $row); } diff --git a/civicrm/CRM/Report/Form/Contribute/Detail.php b/civicrm/CRM/Report/Form/Contribute/Detail.php index a4c6e0d31f4bbe02ef8165248fb38384fb346e49..bea5471f545d3b9ff7f7b1954d28c3ce6d9b7e30 100644 --- a/civicrm/CRM/Report/Form/Contribute/Detail.php +++ b/civicrm/CRM/Report/Form/Contribute/Detail.php @@ -380,7 +380,7 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form { $contributionOrSoftVal = $this->getElementValue('contribution_or_soft_value'); if ($contributionOrSoftVal[0] == 'contributions_only') { $groupBySoft = $this->getElementValue('group_bys'); - if (CRM_Utils_Array::value('soft_credit_id', $groupBySoft)) { + if (!empty($groupBySoft['soft_credit_id'])) { $this->setElementError('group_bys', ts('You cannot group by soft credit when displaying contributions only. Please uncheck "Soft Credit" in the Grouping tab.')); } } diff --git a/civicrm/CRM/Report/Form/Event/Summary.php b/civicrm/CRM/Report/Form/Event/Summary.php index ec4d864bb1513b8a34833bbe84a9c400ece6773f..bfbc8e5a9187fef7be3efd6db31c6e042c0b32f4 100644 --- a/civicrm/CRM/Report/Form/Event/Summary.php +++ b/civicrm/CRM/Report/Form/Event/Summary.php @@ -349,7 +349,7 @@ class CRM_Report_Form_Event_Summary extends CRM_Report_Form { $rows[$key]['civicrm_event_id'] . ") "; } - if (CRM_Utils_Array::value('totalAmount', $rows[$key]) == 0) { + if (empty($rows[$key]['totalAmount'])) { $countEvent = count($rows); } diff --git a/civicrm/CRM/Report/Form/Member/ContributionDetail.php b/civicrm/CRM/Report/Form/Member/ContributionDetail.php index 3b92f9b633f4a128091d4a16ad80da7c82d917cd..a1c5d33850c9897e80832f66c75e3511ea756c3d 100644 --- a/civicrm/CRM/Report/Form/Member/ContributionDetail.php +++ b/civicrm/CRM/Report/Form/Member/ContributionDetail.php @@ -311,7 +311,7 @@ class CRM_Report_Form_Member_ContributionDetail extends CRM_Report_Form { 'source' => ['title' => ts('Membership Source')], ], 'filters' => [ - 'join_date' => ['operatorType' => CRM_Report_Form::OP_DATE], + 'membership_join_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_start_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_end_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'owner_membership_id' => [ diff --git a/civicrm/CRM/Report/Form/Member/Detail.php b/civicrm/CRM/Report/Form/Member/Detail.php index cdb100c8f28703ac391929e4ef6bf77e2dcf80a7..92cd8f40e9322f488eef6bb623cec7806e374491 100644 --- a/civicrm/CRM/Report/Form/Member/Detail.php +++ b/civicrm/CRM/Report/Form/Member/Detail.php @@ -115,7 +115,7 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form { 'source' => ['title' => ts('Source')], ], 'filters' => [ - 'join_date' => ['operatorType' => CRM_Report_Form::OP_DATE], + 'membership_join_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_start_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'membership_end_date' => ['operatorType' => CRM_Report_Form::OP_DATE], 'owner_membership_id' => [ diff --git a/civicrm/CRM/Report/Form/Member/Summary.php b/civicrm/CRM/Report/Form/Member/Summary.php index e4fb27ac9b995c02c2dc8d5a6c14486053cd6b33..ab7dcab2674d5041d5cf10cb4039c49514b24524 100644 --- a/civicrm/CRM/Report/Form/Member/Summary.php +++ b/civicrm/CRM/Report/Form/Member/Summary.php @@ -73,7 +73,7 @@ class CRM_Report_Form_Member_Summary extends CRM_Report_Form { ], ], 'filters' => [ - 'join_date' => [ + 'membership_join_date' => [ 'title' => ts('Member Since'), 'type' => CRM_Utils_Type::T_DATE, 'operatorType' => CRM_Report_Form::OP_DATE, @@ -595,7 +595,7 @@ GROUP BY {$this->_aliases['civicrm_contribution']}.currency implode(",", $this->_params['status_id_value']); } $url = CRM_Report_Utils_Report::getNextUrl('member/detail', - "reset=1&force=1&join_date_from={$dateStart}&join_date_to={$dateEnd}{$typeUrl}{$statusUrl}", + "reset=1&force=1&membership_join_date_from={$dateStart}&membership_join_date_to={$dateEnd}{$typeUrl}{$statusUrl}", $this->_absoluteUrl, $this->_id, $this->_drilldownReport ); $row['civicrm_membership_join_date_start'] = CRM_Utils_Date::format($row['civicrm_membership_join_date_start']); diff --git a/civicrm/CRM/Report/Form/Membership/Summary.php b/civicrm/CRM/Report/Form/Membership/Summary.php index 1a25d456039c62afeaa7c168845f98ac1d4ff21d..9ab478c0846ae746ae44c57f12c4aaaa89370705 100644 --- a/civicrm/CRM/Report/Form/Membership/Summary.php +++ b/civicrm/CRM/Report/Form/Membership/Summary.php @@ -100,7 +100,7 @@ class CRM_Report_Form_Membership_Summary extends CRM_Report_Form { 'membership_type_id' => ['title' => ts('Membership Type')], ], 'filters' => [ - 'join_date' => ['type' => CRM_Utils_Type::T_DATE], + 'membership_join_date' => ['type' => CRM_Utils_Type::T_DATE], ], ], 'civicrm_address' => [ diff --git a/civicrm/CRM/Report/Page/InstanceList.php b/civicrm/CRM/Report/Page/InstanceList.php index 8e8b17cbdd7511e27311b9ce17a529b33c209be9..b7aa9fab331fc83292559cff8125bc8e9a3e4764 100644 --- a/civicrm/CRM/Report/Page/InstanceList.php +++ b/civicrm/CRM/Report/Page/InstanceList.php @@ -282,6 +282,11 @@ class CRM_Report_Page_InstanceList extends CRM_Core_Page { 'confirm_message' => ts('Are you sure you want delete this report? This action cannot be undone.'), ]; } + CRM_Utils_Hook::links('view.report.links', + $className, + $instanceID, + $actions + ); return $actions; } diff --git a/civicrm/CRM/Upgrade/Incremental/SmartGroups.php b/civicrm/CRM/Upgrade/Incremental/SmartGroups.php index feb9c6438a103a369505f9eeb991f9ab0e498108..2ff9287b826695a0c7bc0c72eb75cf627bc0907e 100644 --- a/civicrm/CRM/Upgrade/Incremental/SmartGroups.php +++ b/civicrm/CRM/Upgrade/Incremental/SmartGroups.php @@ -56,20 +56,26 @@ class CRM_Upgrade_Incremental_SmartGroups { */ public function datePickerConversion($fields) { $fieldPossibilities = $relativeFieldNames = []; - foreach ($fields as $field) { - $fieldPossibilities[] = $field; - $fieldPossibilities[] = $field . '_high'; - $fieldPossibilities[] = $field . '_low'; - } $relativeDateMappings = [ 'activity_date_time' => 'activity', 'participant_register_date' => 'participant', 'receive_date' => 'contribution', 'contribution_cancel_date' => 'contribution_cancel', + 'membership_join_date' => 'member_join', + 'membership_start_date' => 'member_start', + 'membership_end_date' => 'member_end', + 'pledge_payment_scheduled_date' => 'pledge_payment', + 'pledge_create_date' => 'pledge_create', + 'pledge_end_date' => 'pledge_end', + 'pledge_start_date' => 'pledge_start', ]; foreach ($fields as $field) { foreach ($this->getSearchesWithField($field) as $savedSearch) { + // Only populate field possibilities as we go to convert each field + $fieldPossibilities[] = $field; + $fieldPossibilities[] = $field . '_high'; + $fieldPossibilities[] = $field . '_low'; $formValues = $savedSearch['form_values']; $isRelative = $hasRelative = FALSE; $relativeFieldName = $field . '_relative'; diff --git a/civicrm/CRM/Upgrade/Incremental/php/FiveEighteen.php b/civicrm/CRM/Upgrade/Incremental/php/FiveEighteen.php new file mode 100644 index 0000000000000000000000000000000000000000..5fb3adce2c1edacbf6164a2989b88ff721f3ae97 --- /dev/null +++ b/civicrm/CRM/Upgrade/Incremental/php/FiveEighteen.php @@ -0,0 +1,177 @@ +<?php +/* + +--------------------------------------------------------------------+ + | CiviCRM version 5 | + +--------------------------------------------------------------------+ + | Copyright CiviCRM LLC (c) 2004-2019 | + +--------------------------------------------------------------------+ + | This file is a part of CiviCRM. | + | | + | CiviCRM is free software; you can copy, modify, and distribute it | + | under the terms of the GNU Affero General Public License | + | Version 3, 19 November 2007. | + | | + | CiviCRM is distributed in the hope that it will be useful, but | + | WITHOUT ANY WARRANTY; without even the implied warranty of | + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | + | See the GNU Affero General Public License for more details. | + | | + | You should have received a copy of the GNU Affero General Public | + | License along with this program; if not, contact CiviCRM LLC | + | at info[AT]civicrm[DOT]org. If you have questions about the | + | GNU Affero General Public License or the licensing of CiviCRM, | + | see the CiviCRM license FAQ at http://civicrm.org/licensing | + +--------------------------------------------------------------------+ + */ + +/** + * Upgrade logic for FiveEighteen */ +class CRM_Upgrade_Incremental_php_FiveEighteen extends CRM_Upgrade_Incremental_Base { + + /** + * Compute any messages which should be displayed beforeupgrade. + * + * Note: This function is called iteratively for each upcoming + * revision to the database. + * + * @param string $preUpgradeMessage + * @param string $rev + * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'. + * @param null $currentVer + */ + public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) { + // Example: Generate a pre-upgrade message. + // if ($rev == '5.12.34') { + // $preUpgradeMessage .= '<p>' . ts('A new permission, "%1", has been added. This permission is now used to control access to the Manage Tags screen.', array(1 => ts('manage tags'))) . '</p>'; + // } + } + + /** + * Compute any messages which should be displayed after upgrade. + * + * @param string $postUpgradeMessage + * alterable. + * @param string $rev + * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs. + */ + public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) { + // Example: Generate a post-upgrade message. + // if ($rev == '5.12.34') { + // $postUpgradeMessage .= '<br /><br />' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'."); + // } + } + + /* + * Important! All upgrade functions MUST add a 'runSql' task. + * Uncomment and use the following template for a new upgrade version + * (change the x in the function name): + */ + + /** + * Upgrade function. + * + * @param string $rev + */ + public function upgrade_5_18_alpha1($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); + $this->addTask('Update smart groups to reflect change of unique name for is_override', 'updateSmartGroups', [ + 'renameField' => [ + ['old' => 'is_override', 'new' => 'member_is_override'], + ], + ]); + $this->addTask('Remove Foreign Key from civicrm_dashboard on domain_id if exists', 'removeDomainIDFK'); + $this->addTask('Remove Index on domain_id that might have been randomly added in the same format as FK', 'dropIndex', 'civicrm_dashboard', 'FK_civicrm_dashboard_domain_id'); + $this->addTask('Re-Create Foreign key between civicrm_dashboard and civicrm_domain correctly', 'recreateDashboardFK'); + $this->addTask('Update smart groups to rename filters on pledge_payment_date to pledge_payment_scheduled_date', 'updateSmartGroups', [ + 'renameField' => [ + ['old' => 'pledge_payment_date_relative', 'new' => 'pledge_payment_scheduled_date_relative'], + ['old' => 'pledge_payment_date_high', 'new' => 'pledge_payment_scheduled_date_high'], + ['old' => 'pledge_payment_date_low', 'new' => 'pledge_payment_scheduled_date_low'], + ['old' => 'member_join_date_relative', 'new' => 'membership_join_date_relative'], + ['old' => 'member_join_date_high', 'new' => 'membership_join_date_high'], + ['old' => 'member_join_date_low', 'new' => 'membership_join_date_low'], + ['old' => 'member_start_date_relative', 'new' => 'membership_start_date_relative'], + ['old' => 'member_start_date_high', 'new' => 'membership_start_date_high'], + ['old' => 'member_start_date_low', 'new' => 'membership_start_date_low'], + ['old' => 'member_end_date_relative', 'new' => 'membership_end_date_relative'], + ['old' => 'member_end_date_high', 'new' => 'membership_end_date_high'], + ['old' => 'member_end_date_low', 'new' => 'membership_end_date_low'], + ], + ]); + $this->addTask('Update smart groups where jcalendar fields have been converted to datepicker', 'updateSmartGroups', [ + 'datepickerConversion' => [ + 'pledge_payment_scheduled_date', + 'pledge_create_date', + 'pledge_end_date', + 'pledge_start_date', + 'membership_join_date', + 'membership_end_date', + 'membership_start_date', + ], + ]); + $this->addTask('Update civicrm_mapping_field and civicrm_uf_field for change in join_date name', 'updateJoinDateMappingUF'); + $this->addTask('Update civicrm_report_instances for change in filter from join_date to membership_join_date', 'joinDateReportUpdate'); + } + + public static function removeDomainIDFK() { + CRM_Core_BAO_SchemaHandler::safeRemoveFK('civicrm_dashboard', 'FK_civicrm_dashboard_domain_id'); + return TRUE; + } + + public static function recreateDashboardFK() { + $sql = CRM_Core_BAO_SchemaHandler::buildForeignKeySQL([ + 'fk_table_name' => 'civicrm_domain', + 'fk_field_name' => 'id', + 'name' => 'domain_id', + 'fk_attributes' => ' ON DELETE CASCADE', + ], "\n", " ADD ", 'civicrm_dashboard'); + CRM_Core_DAO::executeQuery("ALTER TABLE civicrm_dashboard " . $sql, [], TRUE, NULL, FALSE, FALSE); + return TRUE; + } + + public static function updateJoinDateMappingUF() { + CRM_Core_DAO::executeQuery("UPDATE civicrm_mapping_field SET name = 'membership_join_date' WHERE name = 'join_date' AND contact_type = 'Membership'"); + CRM_Core_DAO::executeQuery("UPDATE civicrm_uf_field SET field_name = 'membership_join_date' WHERE field_name = 'join_date' AND field_type = 'Membership'"); + return TRUE; + } + + public static function joinDateReportUpdate() { + $report_templates = ['member/contributionDetail', 'member/Detail', 'member/Summary']; + $substitutions = [ + 'join_date_relative' => 'membership_join_date_relative', + 'join_date_from' => 'membership_join_date_from', + 'join_date_to' => 'membership_join_date_to', + ]; + foreach ($report_templates as $report_template) { + $reports = civicrm_api3('ReportInstance', 'get', [ + 'report_id' => $report_template, + 'options' => ['limit' => 0], + ])['values']; + foreach ($reports as $report) { + if (!is_array($report['form_values'])) { + $form_values = unserialize($report['form_values']); + } + else { + $form_values = $report['form_values']; + } + foreach ($form_values as $key => $value) { + if (array_key_exists($key, $substitutions)) { + $form_values[$substitutions[$key]] = $value; + unset($form_values[$key]); + } + } + $form_values = serialize($form_values); + CRM_Core_DAO::executeQuery("UPDATE civicrm_report_instance SET form_values = %1 WHERE id = %2", [ + 1 => [$form_values, 'String'], + 2 => [$report['id'], 'Positive'], + ]); + } + } + return TRUE; + } + + // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) { + // return TRUE; + // } + +} diff --git a/civicrm/CRM/Upgrade/Incremental/php/Template.php b/civicrm/CRM/Upgrade/Incremental/php/Template.php index d9fbf67e0fb4bcbd7fe6cfd1e754d80c51acadc3..bce4716c11a26aca5df61a49411414deeb1d9dda 100644 --- a/civicrm/CRM/Upgrade/Incremental/php/Template.php +++ b/civicrm/CRM/Upgrade/Incremental/php/Template.php @@ -79,7 +79,7 @@ class CRM_Upgrade_Incremental_php_<?php echo $camelNumber; ?> extends CRM_Upgrad // * @param string $rev // */ // public function upgrade_5_0_x($rev) { - // $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); + // $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); // $this->addTask('Do the foo change', 'taskFoo', ...); // // Additional tasks here... // // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex. diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.0.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.0.mysql.tpl deleted file mode 100644 index fb5a361377032e0aa39f163a3e886bb74dbe2bd2..0000000000000000000000000000000000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.0.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.0 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.2.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.2.mysql.tpl deleted file mode 100644 index 08c75608e25ab93ff824dfef6d5181c470874d60..0000000000000000000000000000000000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.2.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.2 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.3.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.3.mysql.tpl deleted file mode 100644 index 684237bb69cd52be4a01d70bb4a13740888844bf..0000000000000000000000000000000000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.3.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.3 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.4.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.4.mysql.tpl deleted file mode 100644 index bf00882ddf36948db3143ffb0144364731f63797..0000000000000000000000000000000000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.4.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.4 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.17.5.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.17.5.mysql.tpl deleted file mode 100644 index 13dae8841f612ca34dcdb0036a2b4be99733e936..0000000000000000000000000000000000000000 --- a/civicrm/CRM/Upgrade/Incremental/sql/5.17.5.mysql.tpl +++ /dev/null @@ -1 +0,0 @@ -{* file to handle db changes in 5.17.5 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.18.0.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.18.0.mysql.tpl new file mode 100644 index 0000000000000000000000000000000000000000..34af8cc2526633a76aae99c137ea6bdb9473c850 --- /dev/null +++ b/civicrm/CRM/Upgrade/Incremental/sql/5.18.0.mysql.tpl @@ -0,0 +1 @@ +{* file to handle db changes in 5.18.0 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.18.alpha1.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.18.alpha1.mysql.tpl new file mode 100644 index 0000000000000000000000000000000000000000..9db49d5112faa26dafc4da3cd92abe8b5dda5042 --- /dev/null +++ b/civicrm/CRM/Upgrade/Incremental/sql/5.18.alpha1.mysql.tpl @@ -0,0 +1 @@ +{* file to handle db changes in 5.18.alpha1 during upgrade *} diff --git a/civicrm/CRM/Upgrade/Incremental/sql/5.18.beta1.mysql.tpl b/civicrm/CRM/Upgrade/Incremental/sql/5.18.beta1.mysql.tpl new file mode 100644 index 0000000000000000000000000000000000000000..341608e6f1d33155a3409cd02cdfd4a6ff0666e1 --- /dev/null +++ b/civicrm/CRM/Upgrade/Incremental/sql/5.18.beta1.mysql.tpl @@ -0,0 +1 @@ +{* file to handle db changes in 5.18.beta1 during upgrade *} diff --git a/civicrm/CRM/Utils/API/ReloadOption.php b/civicrm/CRM/Utils/API/ReloadOption.php index 4eaa30cfe1df9d0938d152d97237720748cd0d16..6b0793a26f12538c613611b50d1f8565cfa7fe5f 100644 --- a/civicrm/CRM/Utils/API/ReloadOption.php +++ b/civicrm/CRM/Utils/API/ReloadOption.php @@ -76,7 +76,7 @@ class CRM_Utils_API_ReloadOption implements API_Wrapper { public function toApiOutput($apiRequest, $result) { $reloadMode = NULL; if ($apiRequest['action'] === 'create' && isset($apiRequest['params'], $apiRequest['params']['options']) && is_array($apiRequest['params']['options']) && isset($apiRequest['params']['options']['reload'])) { - if (!CRM_Utils_Array::value('is_error', $result, FALSE)) { + if (empty($result['is_error'])) { $reloadMode = $apiRequest['params']['options']['reload']; } $id = (!empty($apiRequest['params']['sequential'])) ? 0 : $result['id']; diff --git a/civicrm/CRM/Utils/Address.php b/civicrm/CRM/Utils/Address.php index 4f2cdc5f5ce3efc376719ee8ad78bede747df3b8..518c17e7727e0bd23cbd398bb356c5cda9b41d73 100644 --- a/civicrm/CRM/Utils/Address.php +++ b/civicrm/CRM/Utils/Address.php @@ -343,7 +343,7 @@ class CRM_Utils_Address { $alternateName = $alternate2; } //Include values which prepend 'billing_' to country and state_province. - if (CRM_Utils_Array::value($alternateName, $params)) { + if (!empty($params[$alternateName])) { if (empty($value) || !is_numeric($value)) { $value = $params[$alternateName]; } diff --git a/civicrm/CRM/Utils/Array.php b/civicrm/CRM/Utils/Array.php index 4cda076ea3fc531a289cc4c3276f2fc99f029856..7dd32cd4be1d43e4a493ddd044666ebf220c8bda 100644 --- a/civicrm/CRM/Utils/Array.php +++ b/civicrm/CRM/Utils/Array.php @@ -375,7 +375,7 @@ class CRM_Utils_Array { public static function crmInArray($value, $params, $caseInsensitive = TRUE) { foreach ($params as $item) { if (is_array($item)) { - $ret = crmInArray($value, $item, $caseInsensitive); + $ret = self::crmInArray($value, $item, $caseInsensitive); } else { $ret = ($caseInsensitive) ? strtolower($item) == strtolower($value) : $item == $value; diff --git a/civicrm/CRM/Utils/JS.php b/civicrm/CRM/Utils/JS.php index 06331b5a2c343b32f68cf200b58ee02b2a4da0e6..718afc457654066932b05e1db3ccfcefa52700bb 100644 --- a/civicrm/CRM/Utils/JS.php +++ b/civicrm/CRM/Utils/JS.php @@ -143,11 +143,13 @@ class CRM_Utils_JS { */ public static function decode($js) { $js = trim($js); - if ($js[0] === "'" || $js[0] === '"') { + $first = substr($js, 0, 1); + $last = substr($js, -1); + if ($last === $first && ($first === "'" || $first === '"')) { // Use a temp placeholder for escaped backslashes return str_replace(['\\\\', "\\'", '\\"', '\\&', '\\/', '**backslash**'], ['**backslash**', "'", '"', '&', '/', '\\'], substr($js, 1, -1)); } - if ($js[0] === '{' || $js[0] === '[') { + if (($first === '{' && $last === '}') || ($first === '[' && $last === ']')) { $obj = self::getRawProps($js); foreach ($obj as $idx => $item) { $obj[$idx] = self::decode($item); diff --git a/civicrm/CRM/Utils/System.php b/civicrm/CRM/Utils/System.php index 622e1aae9acccbcfee615a7fbbefbcddea095c59..b52932368805f2c7f3579531484d4921059661bf 100644 --- a/civicrm/CRM/Utils/System.php +++ b/civicrm/CRM/Utils/System.php @@ -53,7 +53,6 @@ * @method static array synchronizeUsers() Create CRM contacts for all existing CMS users. * @method static appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) Callback for hook_civicrm_coreResourceList. * @method static alterAssetUrl(\Civi\Core\Event\GenericHookEvent $e) Callback for hook_civicrm_getAssetUrl. - * @method static sendResponse(\Psr\Http\Message\ResponseInterface $response) function to handle RepsoseInterface for delivering HTTP Responses. */ class CRM_Utils_System { @@ -1442,6 +1441,8 @@ class CRM_Utils_System { Civi::cache('groups')->flush(); Civi::cache('navigation')->flush(); Civi::cache('customData')->flush(); + Civi::cache('contactTypes')->clear(); + Civi::cache('metadata')->clear(); CRM_Extension_System::singleton()->getCache()->flush(); CRM_Cxn_CiviCxnHttp::singleton()->getCache()->flush(); } diff --git a/civicrm/CRM/Utils/System/Backdrop.php b/civicrm/CRM/Utils/System/Backdrop.php index 5482e800895fd8ab7118d10d1b46ecbe8665d4fa..e7e8ace39fa31ab17a65e23db9ec6f3daf6038d0 100644 --- a/civicrm/CRM/Utils/System/Backdrop.php +++ b/civicrm/CRM/Utils/System/Backdrop.php @@ -880,9 +880,6 @@ AND u.status = 1 else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/Drupal.php b/civicrm/CRM/Utils/System/Drupal.php index 4af43912446b38f14b1c99e797ae4aaaadf4486a..44e4349b86876829fd723ded7a28ffe498e2edcf 100644 --- a/civicrm/CRM/Utils/System/Drupal.php +++ b/civicrm/CRM/Utils/System/Drupal.php @@ -836,9 +836,6 @@ AND u.status = 1 else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/Drupal6.php b/civicrm/CRM/Utils/System/Drupal6.php index 9fc4813751b723caa03fa160d4d37fed38e73703..af566e5d2a786c38a9069d18c8fb838e9881fda0 100644 --- a/civicrm/CRM/Utils/System/Drupal6.php +++ b/civicrm/CRM/Utils/System/Drupal6.php @@ -815,9 +815,6 @@ class CRM_Utils_System_Drupal6 extends CRM_Utils_System_DrupalBase { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/Drupal8.php b/civicrm/CRM/Utils/System/Drupal8.php index 4a54bdc799c63f96b5f3250da46f9f3f22e417cf..38ed2933c671bca40bbd577285f79714c08ba2a1 100644 --- a/civicrm/CRM/Utils/System/Drupal8.php +++ b/civicrm/CRM/Utils/System/Drupal8.php @@ -616,9 +616,6 @@ class CRM_Utils_System_Drupal8 extends CRM_Utils_System_DrupalBase { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/Joomla.php b/civicrm/CRM/Utils/System/Joomla.php index fa5b4e5b68c1833edb43122c42ec2dd9748876e0..4fd07e84d0c053332909337efa0468e395da7a4f 100644 --- a/civicrm/CRM/Utils/System/Joomla.php +++ b/civicrm/CRM/Utils/System/Joomla.php @@ -833,23 +833,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { } } - /** - * Output code from error function. - * @param string $content - */ - public function outputError($content) { - if (class_exists('JErrorPage')) { - $error = new Exception($content); - JErrorPage::render($error); - } - elseif (class_exists('JError')) { - JError::raiseError('CiviCRM-001', $content); - } - else { - parent::outputError($content); - } - } - /** * @inheritDoc */ @@ -897,9 +880,6 @@ class CRM_Utils_System_Joomla extends CRM_Utils_System_Base { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/CRM/Utils/System/WordPress.php b/civicrm/CRM/Utils/System/WordPress.php index d841ba15d8875b65628d0425cc801efde688659a..382892d314b62688942bcfdacbc56655b2324cc1 100644 --- a/civicrm/CRM/Utils/System/WordPress.php +++ b/civicrm/CRM/Utils/System/WordPress.php @@ -827,13 +827,11 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { $contactCreated = 0; $contactMatching = 0; - // previously used $wpdb - which means WordPress *must* be bootstrapped - $wpUsers = get_users(array( - 'blog_id' => get_current_blog_id(), - 'number' => -1, - )); + global $wpdb; + $wpUserIds = $wpdb->get_col("SELECT $wpdb->users.ID FROM $wpdb->users"); - foreach ($wpUsers as $wpUserData) { + foreach ($wpUserIds as $wpUserId) { + $wpUserData = get_userdata($wpUserId); $contactCount++; if ($match = CRM_Core_BAO_UFMatch::synchronizeUFMatch($wpUserData, $wpUserData->$id, @@ -849,9 +847,6 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base { else { $contactMatching++; } - if (is_object($match)) { - $match->free(); - } } return [ diff --git a/civicrm/Civi/Core/Container.php b/civicrm/Civi/Core/Container.php index 9c78f0b3126c57686e909977d6b8125c30a56293..0dfebb73ed9564e5496eacb80361c903e08a4475 100644 --- a/civicrm/Civi/Core/Container.php +++ b/civicrm/Civi/Core/Container.php @@ -159,6 +159,8 @@ class Container { 'navigation' => 'navigation', 'customData' => 'custom data', 'fields' => 'contact fields', + 'contactTypes' => 'contactTypes', + 'metadata' => 'metadata', ]; foreach ($basicCaches as $cacheSvc => $cacheGrp) { $definitionParams = [ @@ -168,7 +170,7 @@ class Container { // For Caches that we don't really care about the ttl for and/or maybe accessed // fairly often we use the fastArrayDecorator which improves reads and writes, these // caches should also not have concurrency risk. - $fastArrayCaches = ['groups', 'navigation', 'customData', 'fields']; + $fastArrayCaches = ['groups', 'navigation', 'customData', 'fields', 'contactTypes', 'metadata']; if (in_array($cacheSvc, $fastArrayCaches)) { $definitionParams['withArray'] = 'fast'; } diff --git a/civicrm/Civi/Test/Api3DocTrait.php b/civicrm/Civi/Test/Api3DocTrait.php index 6b3ad189a2b80f8877ef1241f94b2c85a2256c69..cde946250155997974dca4e202589ef65703f46b 100644 --- a/civicrm/Civi/Test/Api3DocTrait.php +++ b/civicrm/Civi/Test/Api3DocTrait.php @@ -124,7 +124,9 @@ trait Api3DocTrait { mkdir($civicrm_root . "/api/v3/examples/$entity"); } $f = fopen($civicrm_root . "/api/v3/examples/$entity/$exampleName.php", "w+b"); - fwrite($f, $smarty->fetch($civicrm_root . '/tests/templates/documentFunction.tpl')); + $contents = $smarty->fetch($civicrm_root . '/tests/templates/documentFunction.tpl'); + $contents = \CRM_Core_CodeGen_Util_ArraySyntaxConverter::convert($contents); + fwrite($f, $contents); fclose($f); } } diff --git a/civicrm/Civi/Test/GenericAssertionsTrait.php b/civicrm/Civi/Test/GenericAssertionsTrait.php index 1e969f7c39bea67fccc0d07832d767bb3aaba982..993e1278cbbb3eb93817929e9b13868ef1809655 100644 --- a/civicrm/Civi/Test/GenericAssertionsTrait.php +++ b/civicrm/Civi/Test/GenericAssertionsTrait.php @@ -12,8 +12,10 @@ namespace Civi\Test; trait GenericAssertionsTrait { /** - * @param $expected + * @param string $expected + * Ex: 'array', 'object', 'int' * @param $actual + * The variable/item to check. * @param string $message */ public function assertType($expected, $actual, $message = '') { @@ -21,8 +23,13 @@ trait GenericAssertionsTrait { } /** - * Assert that two array-trees are exactly equal, notwithstanding - * the sorting of keys + * Assert that two array-trees are exactly equal. + * + * The ordering of keys do not affect the outcome (within either the roots + * or in any child elements). + * + * Error messages will reveal a readable -path-, regardless of how many + * levels of nesting are present. * * @param array $expected * @param array $actual @@ -39,25 +46,29 @@ trait GenericAssertionsTrait { } /** - * Assert that two numbers are approximately equal. + * Assert that two numbers are approximately equal, + * give or take some $tolerance. * * @param int|float $expected * @param int|float $actual * @param int|float $tolerance + * Any differences <$tolerance are considered irrelevant. + * Differences >=$tolerance are considered relevant. * @param string $message */ public function assertApproxEquals($expected, $actual, $tolerance, $message = NULL) { + $diff = abs($actual - $expected); if ($message === NULL) { - $message = sprintf("approx-equals: expected=[%.3f] actual=[%.3f] tolerance=[%.3f]", $expected, $actual, $tolerance); + $message = sprintf("approx-equals: expected=[%.3f] actual=[%.3f] diff=[%.3f] tolerance=[%.3f]", $expected, $actual, $diff, $tolerance); } - $this->assertTrue(abs($actual - $expected) < $tolerance, $message); + $this->assertTrue($diff < $tolerance, $message); } /** * Assert attributes are equal. * - * @param $expectedValues - * @param $actualValues + * @param array $expectedValues + * @param array $actualValues * @param string $message * * @throws \PHPUnit_Framework_AssertionFailedError @@ -74,34 +85,32 @@ trait GenericAssertionsTrait { } /** - * @param $key - * @param $list + * @param string|int $key + * @param array $list */ public function assertArrayKeyExists($key, &$list) { $result = isset($list[$key]) ? TRUE : FALSE; - $this->assertTrue($result, ts("%1 element exists?", - array(1 => $key) - )); + $this->assertTrue($result, sprintf("%s element exists?", $key)); } /** - * @param $key - * @param $list + * @param string|int $key + * @param array $list */ public function assertArrayValueNotNull($key, &$list) { $this->assertArrayKeyExists($key, $list); $value = isset($list[$key]) ? $list[$key] : NULL; $this->assertTrue($value, - ts("%1 element not null?", - array(1 => $key) - ) + sprintf("%s element not null?", $key) ); } /** * Assert the 2 arrays have the same values. * + * The order of arrays, and keys of the arrays, do not affect the outcome. + * * @param array $array1 * @param array $array2 */ diff --git a/civicrm/ang/crmMailing/BlockMailing.html b/civicrm/ang/crmMailing/BlockMailing.html index 8e09974322ce46b3edd8587e415e2db98cd026f9..3f6c7ca44aa1895d2431a409cb51c817c4d825d5 100644 --- a/civicrm/ang/crmMailing/BlockMailing.html +++ b/civicrm/ang/crmMailing/BlockMailing.html @@ -6,7 +6,7 @@ It could perhaps be thinned by 30-60% by making more directives. --> <div class="crm-block" ng-form="subform" crm-ui-id-scope> <div class="crm-group"> - <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}"> + <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}" ng-if="mailing.template_type=='traditional'"> <div crm-mailing-block-templates="{name: 'templates', id: 'subform.msg_template_id'}" crm-mailing="mailing"></div> </div> <div crm-ui-field="{name: 'subform.fromAddress', title: ts('From'), help: hs('from_email')}"> diff --git a/civicrm/ang/crmMailingAB/BlockMailing.html b/civicrm/ang/crmMailingAB/BlockMailing.html index 92448156415210214fa1c84f16404ef64666cee4..592e94c847fe38e9a23600790f503f631ee55013 100644 --- a/civicrm/ang/crmMailingAB/BlockMailing.html +++ b/civicrm/ang/crmMailingAB/BlockMailing.html @@ -14,57 +14,57 @@ processed by Angular; if false, the field will be hidden and completely ignored <div class="crm-block" ng-form="subform" crm-ui-id-scope> <div class="crm-group"> - - <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}" ng-if="fields.msg_template_id"> - <div ng-controller="MsgTemplateCtrl"> - <select - crm-ui-id="subform.msg_template_id" - name="msg_template_id" - class="fa-clipboard" - crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" - ng-model="abtest.mailings.a.msg_template_id" - ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" - > - <option value=""></option> - <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> - </select> - <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + <div ng-if="abtest.mailings.a.template_type=='traditional'"> + <div crm-ui-field="{name: 'subform.msg_template_id', title: ts('Template')}" ng-if="fields.msg_template_id"> + <div ng-controller="MsgTemplateCtrl"> + <select + crm-ui-id="subform.msg_template_id" + name="msg_template_id" + class="fa-clipboard" + crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" + ng-model="abtest.mailings.a.msg_template_id" + ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" + > + <option value=""></option> + <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> + </select> + <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + </div> </div> - </div> - <div crm-ui-field="{name: 'subform.msg_template_idA', title: ts('Template (A)')}" ng-if="fields.msg_template_idA"> - <div ng-controller="MsgTemplateCtrl"> - <select - crm-ui-id="subform.msg_template_idA" - name="msg_template_idA" - class="fa-clipboard" - crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" - ng-model="abtest.mailings.a.msg_template_id" - ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" - > - <option value=""></option> - <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> - </select> - <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + <div crm-ui-field="{name: 'subform.msg_template_idA', title: ts('Template (A)')}" ng-if="fields.msg_template_idA"> + <div ng-controller="MsgTemplateCtrl"> + <select + crm-ui-id="subform.msg_template_idA" + name="msg_template_idA" + class="fa-clipboard" + crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" + ng-model="abtest.mailings.a.msg_template_id" + ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)" + > + <option value=""></option> + <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> + </select> + <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + </div> </div> - </div> - <div crm-ui-field="{name: 'subform.msg_template_idB', title: ts('Template (B)')}" ng-if="fields.msg_template_idB"> - <div ng-controller="MsgTemplateCtrl"> - <select - crm-ui-id="subform.msg_template_idB" - name="msg_template_idB" - class="fa-clipboard" - crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" - ng-model="abtest.mailings.b.msg_template_id" - ng-change="loadTemplate(abtest.mailings.b, abtest.mailings.b.msg_template_id)" - > - <option value=""></option> - <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> - </select> - <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.b)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + <div crm-ui-field="{name: 'subform.msg_template_idB', title: ts('Template (B)')}" ng-if="fields.msg_template_idB"> + <div ng-controller="MsgTemplateCtrl"> + <select + crm-ui-id="subform.msg_template_idB" + name="msg_template_idB" + class="fa-clipboard" + crm-ui-select="{dropdownAutoWidth : true, allowClear: true, placeholder: ts('Message Template')}" + ng-model="abtest.mailings.b.msg_template_id" + ng-change="loadTemplate(abtest.mailings.b, abtest.mailings.b.msg_template_id)" + > + <option value=""></option> + <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option> + </select> + <a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.b)" class="crm-hover-button" title="{{ts('Save As')}}"></a> + </div> </div> </div> - <div crm-ui-field="{name: 'subform.fromAddress', title: ts('From'), help: hs('from_email')}" ng-if="fields.fromAddress"> <span ng-controller="EmailAddrCtrl" crm-mailing-from-address="fromPlaceholder" crm-mailing="abtest.mailings.a"> <select diff --git a/civicrm/api/v3/Batch.php b/civicrm/api/v3/Batch.php index 36b5ee35df53ca7868aae8e1b67d04bb74426bd5..9e93ad9f4e1fe12df8dd18f8b30f17adbd09254f 100644 --- a/civicrm/api/v3/Batch.php +++ b/civicrm/api/v3/Batch.php @@ -37,6 +37,8 @@ * @param array $params * * @return array + * @throws \API_Exception + * @throws \Civi\API\Exception\UnauthorizedException */ function civicrm_api3_batch_create($params) { return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Batch'); @@ -56,8 +58,10 @@ function _civicrm_api3_batch_create_spec(&$params) { $params['entity_table']['api.default'] = "civicrm_batch"; $params['entity_table']['type'] = CRM_Utils_Type::T_STRING; $params['entity_table']['title'] = 'Batch Entity Table - remove?'; - - $params['modified_date']['api.default'] = "now"; + $params['created_id']['api.default'] = 'user_contact_id'; + $params['created_date']['api.default'] = 'now'; + $params['modified_id']['api.default'] = 'user_contact_id'; + $params['modified_date']['api.default'] = 'now'; $params['status_id']['api.required'] = 1; $params['title']['api.required'] = 1; $params['status_id']['api.required'] = 1; @@ -82,6 +86,8 @@ function civicrm_api3_batch_get($params) { * * @return array * Array of deleted values. + * @throws \API_Exception + * @throws \Civi\API\Exception\UnauthorizedException */ function civicrm_api3_batch_delete($params) { return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params); diff --git a/civicrm/api/v3/Contribution.php b/civicrm/api/v3/Contribution.php index 6c710fdc6cb14b63dcce96d6c3fcc2424abce574..f190f3eb3222994ed2e745eb924a73b852553250 100644 --- a/civicrm/api/v3/Contribution.php +++ b/civicrm/api/v3/Contribution.php @@ -612,6 +612,15 @@ function _civicrm_api3_contribution_completetransaction_spec(&$params) { 'optionGroupName' => 'accept_creditcard', ], ]; + // At some point we will deprecate this api in favour of calling payment create which will in turn call this + // api if appropriate to transition related entities and send receipts - ie. financial responsibility should + // not exist in completetransaction. For now we just need to allow payment.create to force a bypass on the + // things it does itself. + $params['is_post_payment_create'] = [ + 'title' => 'Is this being called from payment create?', + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'description' => 'The \'correct\' flow is to call payment.create for the financial side & for that to call completecontribution for the entity & receipt management. However, we need to still support completetransaction directly for legacy reasons', + ]; } /** @@ -669,6 +678,7 @@ function civicrm_api3_contribution_repeattransaction($params) { 'fee_amount', 'financial_type_id', 'contribution_status_id', + 'membership_id', ]; $input = array_intersect_key($params, array_fill_keys($passThroughParams, NULL)); @@ -728,7 +738,7 @@ function _ipn_process_transaction(&$params, $contribution, $input, $ids, $firstC $input['pan_truncation'] = CRM_Utils_Array::value('pan_truncation', $params); $transaction = new CRM_Core_Transaction(); return CRM_Contribute_BAO_Contribution::completeOrder($input, $ids, $objects, $transaction, - !empty($contribution->contribution_recur_id), $contribution); + !empty($contribution->contribution_recur_id), $contribution, CRM_Utils_Array::value('is_post_payment_create', $params)); } /** diff --git a/civicrm/api/v3/Dedupe.php b/civicrm/api/v3/Dedupe.php index 00992069184055a2c76082a58ee96c3aa41189c9..6762af43c68896d96a527e60446a25b8378e704f 100644 --- a/civicrm/api/v3/Dedupe.php +++ b/civicrm/api/v3/Dedupe.php @@ -107,7 +107,8 @@ function civicrm_api3_dedupe_getstatistics($params) { $params['rule_group_id'], CRM_Utils_Array::value('group_id', $params), CRM_Utils_Array::value('criteria', $params, []), - CRM_Utils_Array::value('check_permissions', $params, []) + !empty($params['check_permissions']), + CRM_Utils_Array::value('search_limit', $params, 0) )); return civicrm_api3_create_success($stats); } @@ -135,6 +136,11 @@ function _civicrm_api3_dedupe_getstatistics_spec(&$params) { 'title' => ts('Criteria'), 'description' => ts('Dedupe search criteria, as parsable by v3 Contact.get api'), ]; + $spec['search_limit'] = [ + 'title' => ts('Number of contacts to look for matches for.'), + 'type' => CRM_Utils_Type::T_INT, + 'api.default' => (int) Civi::settings()->get('dedupe_default_limit'), + ]; } @@ -150,7 +156,7 @@ function _civicrm_api3_dedupe_getstatistics_spec(&$params) { */ function civicrm_api3_dedupe_getduplicates($params) { $options = _civicrm_api3_get_options_from_params($params); - $dupePairs = CRM_Dedupe_Merger::getDuplicatePairs($params['rule_group_id'], NULL, TRUE, $options['limit'], FALSE, TRUE, $params['criteria'], CRM_Utils_Array::value('check_permissions', $params), CRM_Utils_Array::value('search_limit', $params, 0)); + $dupePairs = CRM_Dedupe_Merger::getDuplicatePairs($params['rule_group_id'], NULL, TRUE, $options['limit'], FALSE, TRUE, $params['criteria'], CRM_Utils_Array::value('check_permissions', $params), CRM_Utils_Array::value('search_limit', $params, 0), CRM_Utils_Array::value('is_force_new_search', $params)); return civicrm_api3_create_success($dupePairs); } @@ -178,5 +184,9 @@ function _civicrm_api3_dedupe_getduplicates_spec(&$params) { 'type' => CRM_Utils_Type::T_INT, 'api.default' => (int) Civi::settings()->get('dedupe_default_limit'), ]; + $spec['is_force_new_search'] = [ + 'title' => ts('Force a new search, refreshing any cached search'), + 'type' => CRM_Utils_Type::T_BOOLEAN, + ]; } diff --git a/civicrm/api/v3/Event.php b/civicrm/api/v3/Event.php index 8f30864e469517c5052327de05f9870aace05221..f99d9a0430e40dcf1566e4fbe5bbb64a2d009842 100644 --- a/civicrm/api/v3/Event.php +++ b/civicrm/api/v3/Event.php @@ -59,13 +59,6 @@ function civicrm_api3_event_create($params) { ]); } - // Clone event from template - if (!empty($params['template_id']) && empty($params['id'])) { - $copy = CRM_Event_BAO_Event::copy($params['template_id']); - $params['id'] = $copy->id; - unset($params['template_id']); - } - _civicrm_api3_event_create_legacy_support_42($params); return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Event'); } diff --git a/civicrm/api/v3/Job.php b/civicrm/api/v3/Job.php index 86cfa253d27f0c514b90e0bee397023197f34b64..4a4b0eca75f0729fd2e85161aed74c5d67015b2c 100644 --- a/civicrm/api/v3/Job.php +++ b/civicrm/api/v3/Job.php @@ -541,7 +541,7 @@ function civicrm_api3_job_process_batch_merge($params) { $gid = CRM_Utils_Array::value('gid', $params); $mode = CRM_Utils_Array::value('mode', $params, 'safe'); - $result = CRM_Dedupe_Merger::batchMerge($rule_group_id, $gid, $mode, 1, 2, CRM_Utils_Array::value('criteria', $params, []), CRM_Utils_Array::value('check_permissions', $params)); + $result = CRM_Dedupe_Merger::batchMerge($rule_group_id, $gid, $mode, 1, 2, CRM_Utils_Array::value('criteria', $params, []), CRM_Utils_Array::value('check_permissions', $params), NULL, $params['search_limit']); return civicrm_api3_create_success($result, $params); } @@ -571,6 +571,12 @@ function _civicrm_api3_job_process_batch_merge_spec(&$params) { 'description' => 'let the api decide which contact to retain and which to delete?', 'type' => CRM_Utils_Type::T_BOOLEAN, ]; + $params['search_limit'] = [ + 'title' => ts('Number of contacts to look for matches for.'), + 'type' => CRM_Utils_Type::T_INT, + 'api.default' => (int) Civi::settings()->get('dedupe_default_limit'), + ]; + } /** diff --git a/civicrm/api/v3/LineItem.php b/civicrm/api/v3/LineItem.php index ff37983e6bf8785ec9fd0e82bf5ec895498d0ba1..9b784435c60e84ce298c9c4680c9fdeca83ecfc8 100644 --- a/civicrm/api/v3/LineItem.php +++ b/civicrm/api/v3/LineItem.php @@ -78,7 +78,7 @@ function _civicrm_api3_line_item_create_spec(&$params) { * Array of matching line_items */ function civicrm_api3_line_item_get($params) { - if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) { + if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) { CRM_Price_BAO_LineItem::getAPILineItemParams($params); } return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params); @@ -95,7 +95,7 @@ function civicrm_api3_line_item_get($params) { * @throws API_Exception */ function civicrm_api3_line_item_delete($params) { - if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) { + if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !empty($params['check_permissions'])) { CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types, CRM_Core_Action::DELETE); if (empty($params['financial_type_id'])) { $params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_LineItem', $params['id'], 'financial_type_id'); diff --git a/civicrm/api/v3/MembershipType.php b/civicrm/api/v3/MembershipType.php index 386626c548f784ef2c3749b94d699e54236cf765..cf4bccf62ea8d24abc10e1d8134fea8b7148dda9 100644 --- a/civicrm/api/v3/MembershipType.php +++ b/civicrm/api/v3/MembershipType.php @@ -87,6 +87,7 @@ function civicrm_api3_membership_type_get($params) { // Workaround for fields using nonstandard serialization foreach (['relationship_type_id', 'relationship_direction'] as $field) { if (isset($item[$field]) && !is_array($item[$field])) { + // @todo - this should be handled by the serialization now... $item[$field] = (array) $item[$field]; } } @@ -95,6 +96,18 @@ function civicrm_api3_membership_type_get($params) { return $results; } +/** + * Adjust Metadata for Get action. + * + * The metadata is used for setting defaults, documentation & validation. + * + * @param array $params + * Array of parameters determined by getfields. + */ +function _civicrm_api3_membership_type_get_spec(&$params) { + $params['domain_id']['api.default'] = CRM_Core_Config::domainID(); +} + /** * Adjust input for getlist action. * diff --git a/civicrm/api/v3/Order.php b/civicrm/api/v3/Order.php index 6d3b4bad5e36fce3c2b1d7395bc378c775699934..e570855b57a9b1081237f7a8b2959c304d08b3d2 100644 --- a/civicrm/api/v3/Order.php +++ b/civicrm/api/v3/Order.php @@ -45,7 +45,7 @@ function civicrm_api3_order_get($params) { $contributions = []; $params['api.line_item.get'] = ['qty' => ['<>' => 0]]; $isSequential = FALSE; - if (CRM_Utils_Array::value('sequential', $params)) { + if (!empty($params['sequential'])) { $params['sequential'] = 0; $isSequential = TRUE; } @@ -88,7 +88,7 @@ function civicrm_api3_order_create($params) { $entity = NULL; $entityIds = []; - if (CRM_Utils_Array::value('line_items', $params) && is_array($params['line_items'])) { + if (!empty($params['line_items']) && is_array($params['line_items'])) { $priceSetID = NULL; CRM_Contribute_BAO_Contribution::checkLineItems($params); foreach ($params['line_items'] as $lineItems) { @@ -124,7 +124,7 @@ function civicrm_api3_order_create($params) { } $contribution = civicrm_api3('Contribution', 'create', $params); // add payments - if ($entity && CRM_Utils_Array::value('id', $contribution)) { + if ($entity && !empty($contribution['id'])) { foreach ($entityIds as $entityId) { $paymentParams = [ 'contribution_id' => $contribution['id'], diff --git a/civicrm/api/v3/Payment.php b/civicrm/api/v3/Payment.php index a2deaf562c77c84ddc4172074e4c7f5cea207d50..4ac10c070fc8714e0f2984ee44ba7ae22b6e8fd8 100644 --- a/civicrm/api/v3/Payment.php +++ b/civicrm/api/v3/Payment.php @@ -43,7 +43,7 @@ function civicrm_api3_payment_get($params) { $financialTrxn = []; $limit = ''; - if (isset($params['options']) && CRM_Utils_Array::value('limit', $params['options'])) { + if (isset($params['options']) && !empty($params['options']['limit'])) { $limit = CRM_Utils_Array::value('limit', $params['options']); } $params['options']['limit'] = 0; @@ -132,7 +132,7 @@ function civicrm_api3_payment_cancel($params) { */ function civicrm_api3_payment_create($params) { // Check if it is an update - if (CRM_Utils_Array::value('id', $params)) { + if (!empty($params['id'])) { $amount = $params['total_amount']; civicrm_api3('Payment', 'cancel', $params); $params['total_amount'] = $amount; @@ -178,6 +178,12 @@ function _civicrm_api3_payment_create_spec(&$params) { 'title' => ts('Cancel Date'), 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, ], + 'is_send_contribution_notification' => [ + 'title' => ts('Send out notifications based on contribution status change?'), + 'description' => ts('Most commonly this equates to emails relating to the contribution, event, etcwhen a payment completes a contribution'), + 'type' => CRM_Utils_Type::T_BOOLEAN, + 'api.default' => TRUE, + ], ]; } diff --git a/civicrm/api/v3/examples/Activity/Get.php b/civicrm/api/v3/examples/Activity/Get.php index 0c8055de06febd2ec2c51a2e44f0c64bd95c3869..014e703a3def99613a0f753fcf24b5968466d57b 100644 --- a/civicrm/api/v3/examples/Activity/Get.php +++ b/civicrm/api/v3/examples/Activity/Get.php @@ -7,10 +7,9 @@ */ function activity_get_example() { $params = [ - 'contact_id' => 1, - 'activity_type_id' => 9999, - 'sequential' => 1, - 'return.custom_1' => 1, + 'case_id' => [ + 'IS NULL' => 1, + ], ]; try{ @@ -44,28 +43,25 @@ function activity_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 9, 'values' => [ - '0' => [ - 'id' => '1', - 'activity_type_id' => '9999', - 'subject' => 'test activity type id', - 'activity_date_time' => '2011-06-02 14:36:13', - 'duration' => '120', - 'location' => 'Pennsylvania', - 'details' => 'a test activity', + '9' => [ + 'id' => '9', + 'activity_type_id' => '2', + 'subject' => 'Ask not what your API can do for you, but what you can do for your API.', + 'activity_date_time' => '2019-08-20 19:10:43', 'status_id' => '2', - 'priority_id' => '1', + 'priority_id' => '2', 'is_test' => 0, 'is_auto' => 0, 'is_current_revision' => '1', 'is_deleted' => 0, 'is_star' => 0, - 'custom_1' => 'custom string', - 'source_contact_id' => '1', - 'status' => 'Completed', - 'activity_name' => 'Test activity type', - 'custom_1_1' => 'custom string', + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', + 'source_contact_id' => '19', + 'source_contact_name' => 'Mr. Anthony Anderson II', + 'source_contact_sort_name' => 'Anderson, Anthony', ], ], ]; @@ -75,22 +71,22 @@ function activity_get_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testActivityGetContact_idCustom" +* The test that created it is called "testGet" * and can be found at: -* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTest.php +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityCaseTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ActivityContact/Create.php b/civicrm/api/v3/examples/ActivityContact/Create.php index 551318b11489fa59b57bf3ad362e94ea965698cd..d538c10419cfde4ed0b04d55eadeae523800bbf3 100644 --- a/civicrm/api/v3/examples/ActivityContact/Create.php +++ b/civicrm/api/v3/examples/ActivityContact/Create.php @@ -64,17 +64,17 @@ function activity_contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ActivityContact/Delete.php b/civicrm/api/v3/examples/ActivityContact/Delete.php index e3cc42dceb6a681f8f75120fba9770fdb51a472b..34a0727e074e3af64a94b9e9651dfb9cbfcae3b1 100644 --- a/civicrm/api/v3/examples/ActivityContact/Delete.php +++ b/civicrm/api/v3/examples/ActivityContact/Delete.php @@ -7,7 +7,7 @@ */ function activity_contact_delete_example() { $params = [ - 'id' => 8, + 'id' => 11, ]; try{ @@ -54,17 +54,17 @@ function activity_contact_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ActivityType/Create.php b/civicrm/api/v3/examples/ActivityType/Create.php index 10325428f7c5900f755ed6201a6158f879e8b751..32298d87390aabc0272980304a5ce37863f0cf70 100644 --- a/civicrm/api/v3/examples/ActivityType/Create.php +++ b/civicrm/api/v3/examples/ActivityType/Create.php @@ -49,10 +49,10 @@ function activity_type_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 849, + 'id' => 869, 'values' => [ - '849' => [ - 'id' => '849', + '869' => [ + 'id' => '869', 'option_group_id' => '2', 'label' => 'send out letters', 'value' => '55', @@ -85,17 +85,17 @@ function activity_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ActivityType/Get.php b/civicrm/api/v3/examples/ActivityType/Get.php index a1d8d70fd9140ea507dc53a36de90a4fedc3737c..0c81f5052c60042a7a6d60598f1b0dc32b589fe0 100644 --- a/civicrm/api/v3/examples/ActivityType/Get.php +++ b/civicrm/api/v3/examples/ActivityType/Get.php @@ -41,7 +41,7 @@ function activity_type_get_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 54, + 'count' => 35, 'values' => [ '1' => 'Meeting', '2' => 'Phone Call', @@ -55,27 +55,9 @@ function activity_type_get_expectedresult() { '10' => 'Pledge Acknowledgment', '11' => 'Pledge Reminder', '12' => 'Inbound Email', - '13' => 'Open Case', - '14' => 'Follow up', - '15' => 'Change Case Type', - '16' => 'Change Case Status', '17' => 'Membership Renewal Reminder', - '18' => 'Change Case Start Date', '19' => 'Bulk Email', - '20' => 'Assign Case Role', - '21' => 'Remove Case Role', '22' => 'Print/Merge Document', - '23' => 'Merge Case', - '24' => 'Reassigned Case', - '25' => 'Link Cases', - '26' => 'Change Case Tags', - '27' => 'Add Client To Case', - '28' => 'Survey', - '29' => 'Canvass', - '30' => 'PhoneBank', - '31' => 'WalkList', - '32' => 'Petition Signature', - '33' => 'Change Custom Data', '34' => 'Mass SMS', '35' => 'Change Membership Status', '36' => 'Change Membership Type', @@ -95,8 +77,7 @@ function activity_type_get_expectedresult() { '50' => 'Emailed Invoice', '51' => 'Contact Merged', '52' => 'Contact Deleted by Merge', - '53' => 'Failed Payment', - '54' => 'Close Accounting Period', + '54' => 'Failed Payment', ], 'deprecated' => 'The ActivityType api is deprecated. Please use the OptionValue api instead.', ]; @@ -111,17 +92,17 @@ function activity_type_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ActivityTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/AddressLike.php b/civicrm/api/v3/examples/Address/AddressLike.php index b781816ce6c4123dc6653600d4ede3028045d6f9..6f36acfeb36286fdbbef58fe042c5010648c8cf8 100644 --- a/civicrm/api/v3/examples/Address/AddressLike.php +++ b/civicrm/api/v3/examples/Address/AddressLike.php @@ -50,8 +50,8 @@ function address_get_expectedresult() { 'values' => [ '0' => [ 'id' => '1', - 'contact_id' => '20', - 'location_type_id' => '18', + 'contact_id' => '4', + 'location_type_id' => '33', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => 'Ambachtstraat 23', @@ -75,17 +75,17 @@ function address_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/AddressParse.php b/civicrm/api/v3/examples/Address/AddressParse.php index ddd86d3cc0ac85a8b454d5594099178d026466ee..264e7684bfbe6a00d75d94a9913fbabba7fe45d2 100644 --- a/civicrm/api/v3/examples/Address/AddressParse.php +++ b/civicrm/api/v3/examples/Address/AddressParse.php @@ -11,7 +11,7 @@ function address_create_example() { $params = [ 'street_parsing' => 1, 'street_address' => '54A Excelsior Ave. Apt 1C', - 'location_type_id' => 7, + 'location_type_id' => 8, 'contact_id' => 4, ]; @@ -51,7 +51,7 @@ function address_create_expectedresult() { '1' => [ 'id' => '1', 'contact_id' => '4', - 'location_type_id' => '7', + 'location_type_id' => '8', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => '54A Excelsior Ave. Apt 1C', @@ -74,17 +74,17 @@ function address_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/AddressSort.php b/civicrm/api/v3/examples/Address/AddressSort.php index edde7694d211afe3728a0cd35b1d06ac22dcdb50..7c4937ba1245062edef59fd43996789049238d74 100644 --- a/civicrm/api/v3/examples/Address/AddressSort.php +++ b/civicrm/api/v3/examples/Address/AddressSort.php @@ -50,8 +50,8 @@ function address_get_expectedresult() { 'values' => [ '0' => [ 'id' => '2', - 'contact_id' => '19', - 'location_type_id' => '17', + 'contact_id' => '4', + 'location_type_id' => '31', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => 'yzy', @@ -64,8 +64,8 @@ function address_get_expectedresult() { ], '1' => [ 'id' => '1', - 'contact_id' => '19', - 'location_type_id' => '17', + 'contact_id' => '4', + 'location_type_id' => '31', 'is_primary' => 0, 'is_billing' => 0, 'street_address' => 'Ambachtstraat 23', @@ -89,17 +89,17 @@ function address_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/Create.php b/civicrm/api/v3/examples/Address/Create.php index d4075de134aa650c29ffce894fedb5e13665f5a5..870a0208e4e7b646f55eb25b33f0dd8a1c266bad 100644 --- a/civicrm/api/v3/examples/Address/Create.php +++ b/civicrm/api/v3/examples/Address/Create.php @@ -7,8 +7,7 @@ */ function address_create_example() { $params = [ - 'contact_id' => 3, - 'location_type_id' => 6, + 'contact_id' => 4, 'street_name' => 'Ambachtstraat', 'street_number' => '23', 'street_address' => 'Ambachtstraat 23', @@ -49,12 +48,12 @@ function address_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 1, 'values' => [ - '2' => [ - 'id' => '2', - 'contact_id' => '3', - 'location_type_id' => '6', + '1' => [ + 'id' => '1', + 'contact_id' => '4', + 'location_type_id' => '1', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => 'Ambachtstraat 23', @@ -73,22 +72,22 @@ function address_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreateAddress" +* The test that created it is called "testCreateAddressDefaultLocation" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/Delete.php b/civicrm/api/v3/examples/Address/Delete.php index 0f9508a113c10faebaa5b7f3fbf84ac353fb40d1..ba8524486c61cd54dcdb603415d72786923e8f3b 100644 --- a/civicrm/api/v3/examples/Address/Delete.php +++ b/civicrm/api/v3/examples/Address/Delete.php @@ -54,17 +54,17 @@ function address_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/Get.php b/civicrm/api/v3/examples/Address/Get.php index 89cb571ae345aab902c85a4593bf6869f6e97d36..92f17e96cb43696ef1487faef688221a23b31b57 100644 --- a/civicrm/api/v3/examples/Address/Get.php +++ b/civicrm/api/v3/examples/Address/Get.php @@ -7,7 +7,7 @@ */ function address_get_example() { $params = [ - 'contact_id' => 17, + 'contact_id' => 4, 'street_name' => 'Ambachtstraat', ]; @@ -46,8 +46,8 @@ function address_get_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '17', - 'location_type_id' => '15', + 'contact_id' => '4', + 'location_type_id' => '27', 'is_primary' => '1', 'is_billing' => 0, 'street_address' => 'Ambachtstraat 23', @@ -71,17 +71,17 @@ function address_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/AddressTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Address/GetOptions.php b/civicrm/api/v3/examples/Address/GetOptions.php index 3ec7f662b928cfd2db86349f55581cb1f7a7d6e7..db58c9f81b9bcfc162ffbbf26621dbdae6157be7 100644 --- a/civicrm/api/v3/examples/Address/GetOptions.php +++ b/civicrm/api/v3/examples/Address/GetOptions.php @@ -60,17 +60,17 @@ function address_getoptions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Batch/Create.php b/civicrm/api/v3/examples/Batch/Create.php index e8cf61299b81ccf1380e98af522dd7acec293ef4..978a965ab8a212d6e0241d99d3a518c2e0c20239 100644 --- a/civicrm/api/v3/examples/Batch/Create.php +++ b/civicrm/api/v3/examples/Batch/Create.php @@ -80,17 +80,17 @@ function batch_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Batch/Delete.php b/civicrm/api/v3/examples/Batch/Delete.php index a8478434a5719365e03cb62dd7c686943e08b262..0180f59c0314292d5ae95735943e3a904ff04cf5 100644 --- a/civicrm/api/v3/examples/Batch/Delete.php +++ b/civicrm/api/v3/examples/Batch/Delete.php @@ -54,17 +54,17 @@ function batch_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Batch/Get.php b/civicrm/api/v3/examples/Batch/Get.php index 45420adb86af1a36d880e9dc73b6f67fd853087d..84e73fed73ba0025d76b959affce01e6e0ddabee 100644 --- a/civicrm/api/v3/examples/Batch/Get.php +++ b/civicrm/api/v3/examples/Batch/Get.php @@ -63,17 +63,17 @@ function batch_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/BatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Campaign/Create.php b/civicrm/api/v3/examples/Campaign/Create.php index 1a8e74242d0dbbdce61d8cd907e0396e4de8bb2b..342f8c3c6492d4645144caa3a617b9e96eeffdc3 100644 --- a/civicrm/api/v3/examples/Campaign/Create.php +++ b/civicrm/api/v3/examples/Campaign/Create.php @@ -59,7 +59,7 @@ function campaign_create_expectedresult() { 'status_id' => '', 'external_identifier' => '', 'parent_id' => '', - 'is_active' => '', + 'is_active' => '1', 'created_id' => '', 'created_date' => '2013-07-28 08:49:19', 'last_modified_id' => '', @@ -80,17 +80,17 @@ function campaign_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Campaign/Delete.php b/civicrm/api/v3/examples/Campaign/Delete.php index b6d5d3c420907bd4e8482a1030367b958e4fa722..4acc3c37bb4d7f35eb5b8a0a1f779ef31bd3e67a 100644 --- a/civicrm/api/v3/examples/Campaign/Delete.php +++ b/civicrm/api/v3/examples/Campaign/Delete.php @@ -54,17 +54,17 @@ function campaign_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Campaign/Get.php b/civicrm/api/v3/examples/Campaign/Get.php index 5e6fb6a0f022d06ab53ad7e52457e72cadea670d..0938d0f7cb2f9702ec386227329d97638e30efeb 100644 --- a/civicrm/api/v3/examples/Campaign/Get.php +++ b/civicrm/api/v3/examples/Campaign/Get.php @@ -66,17 +66,17 @@ function campaign_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CampaignTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Case/Create.php b/civicrm/api/v3/examples/Case/Create.php index d57c589a9c28d9a26d40f915ad39c934a42bd2e2..abea3d5ecaedcef3bb71cc8dad41755385cf44c3 100644 --- a/civicrm/api/v3/examples/Case/Create.php +++ b/civicrm/api/v3/examples/Case/Create.php @@ -7,9 +7,10 @@ */ function case_create_example() { $params = [ + 'case_type_id' => 1, 'subject' => 'Test case', 'contact_id' => 17, - 'case_type' => 'housing_support', + 'custom_1' => 'custom string', ]; try{ @@ -53,7 +54,9 @@ function case_create_expectedresult() { 'end_date' => '', 'details' => '', 'status_id' => '1', - 'is_deleted' => '', + 'is_deleted' => 0, + 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', ], ], ]; @@ -63,22 +66,22 @@ function case_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCaseCreate" +* The test that created it is called "testCaseCreateCustom" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CaseTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CaseContact/Create.php b/civicrm/api/v3/examples/CaseContact/Create.php new file mode 100644 index 0000000000000000000000000000000000000000..9491e8d159d07af97f1af3784b6f82df77e847b4 --- /dev/null +++ b/civicrm/api/v3/examples/CaseContact/Create.php @@ -0,0 +1,78 @@ +<?php +/** + * Test Generated example demonstrating the CaseContact.create API. + * + * @return array + * API result array + */ +function case_contact_create_example() { + $params = [ + 'case_id' => 2, + 'contact_id' => 20, + ]; + + try{ + $result = civicrm_api3('CaseContact', 'create', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function case_contact_create_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => [ + '3' => [ + 'id' => '3', + 'case_id' => '2', + 'contact_id' => '20', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testCaseContactCreate" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CaseContactTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/CaseContact/Get.php b/civicrm/api/v3/examples/CaseContact/Get.php index 3f12514ceae4849d88c01a6069230e42dba800b3..75619449d606cf801ec630b319f904bdaecad627 100644 --- a/civicrm/api/v3/examples/CaseContact/Get.php +++ b/civicrm/api/v3/examples/CaseContact/Get.php @@ -61,17 +61,17 @@ function case_contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CaseContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Constant/Get.php b/civicrm/api/v3/examples/Constant/Get.php index c147be4c928a3c077d465c1b2be3205671c32453..24ee51a80f567f95f683616a4c982590b51afe18 100644 --- a/civicrm/api/v3/examples/Constant/Get.php +++ b/civicrm/api/v3/examples/Constant/Get.php @@ -43,7 +43,7 @@ function constant_get_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 36, + 'count' => 35, 'values' => [ '1' => 'Meeting', '2' => 'Phone Call', @@ -79,8 +79,7 @@ function constant_get_expectedresult() { '50' => 'Emailed Invoice', '51' => 'Contact Merged', '52' => 'Contact Deleted by Merge', - '53' => 'Failed Payment', - '54' => 'Close Accounting Period', + '54' => 'Failed Payment', ], 'deprecated' => 'The Constant api is deprecated as of CiviCRM 4.4. Please use the getoptions api action instead.', ]; @@ -95,17 +94,17 @@ function constant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/APIChainedArray.php b/civicrm/api/v3/examples/Contact/APIChainedArray.php index d69e48ce4c34e293caead31bcd9354164d3c3b97..dbb7bc713aa5eec7a36bffb3f609852e4b05c6bd 100644 --- a/civicrm/api/v3/examples/Contact/APIChainedArray.php +++ b/civicrm/api/v3/examples/Contact/APIChainedArray.php @@ -78,7 +78,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -115,7 +115,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -148,7 +148,9 @@ function contact_get_expectedresult() { 'display_name' => 'abc3 xyz3', 'contribution_id' => '2', 'currency' => 'USD', - 'payment_instrument' => 'Credit Card', + 'contribution_recur_id' => '', + 'contribution_status_id' => '1', + 'contribution_campaign_id' => '', 'payment_instrument_id' => '1', 'receive_date' => '2011-01-01 00:00:00', 'non_deductible_amount' => '10.00', @@ -157,37 +159,30 @@ function contact_get_expectedresult() { 'net_amount' => '90.00', 'trxn_id' => '12335', 'invoice_id' => '67830', - 'cancel_date' => '', + 'invoice_number' => '', + 'contribution_cancel_date' => '', 'cancel_reason' => '', 'receipt_date' => '', 'thankyou_date' => '', 'contribution_source' => 'SSF', 'amount_level' => '', - 'contribution_recur_id' => '', 'is_test' => 0, 'is_pay_later' => 0, - 'contribution_status' => 'Completed', - 'contribution_status_id' => '1', 'contribution_check_number' => '', - 'contribution_campaign_id' => '', - 'financial_type_id' => '1', - 'financial_type' => 'Donation', - 'product_id' => '', - 'product_name' => '', - 'sku' => '', - 'contribution_product_id' => '', - 'product_option' => '', - 'fulfilled_date' => '', - 'contribution_start_date' => '', - 'contribution_end_date' => '', 'financial_account_id' => '1', 'accounting_code' => '4200', 'campaign_id' => '', 'contribution_campaign_title' => '', + 'financial_type_id' => '1', + 'financial_type' => 'Donation', 'contribution_note' => '', 'contribution_batch' => '', + 'contribution_recur_status' => 'Completed', + 'payment_instrument' => 'Credit Card', + 'contribution_status' => 'Completed', 'check_number' => '', 'instrument_id' => '1', + 'cancel_date' => '', 'id' => '2', 'contribution_type_id' => '1', ], @@ -219,17 +214,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/APIChainedArrayFormats.php b/civicrm/api/v3/examples/Contact/APIChainedArrayFormats.php index a0c462fceea96ac5223b79ac26e0f34cb5f0a66c..aed4d81f0a14d7b77be0841335b9888ea4dae594 100644 --- a/civicrm/api/v3/examples/Contact/APIChainedArrayFormats.php +++ b/civicrm/api/v3/examples/Contact/APIChainedArrayFormats.php @@ -79,7 +79,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -116,7 +116,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -136,7 +136,7 @@ function contact_get_expectedresult() { 'count' => 0, 'values' => [], ], - 'api.Membership.getCount' => 0, + 'api.Membership.getCount' => 1, ], ], ]; @@ -151,17 +151,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php b/civicrm/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php index 555b0d3bc1f71f901d34ebf2c26d361074fa176f..75640d5586d45cc309fff672e0351c331393bc50 100644 --- a/civicrm/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php +++ b/civicrm/api/v3/examples/Contact/APIChainedArrayMultipleCustom.php @@ -76,7 +76,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -113,7 +113,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -193,17 +193,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php b/civicrm/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php index 91f2eae1924e1987009b71f0482889a98ad9825e..9570d244cd290ba7eabd1e8a8d729c9f89702400 100644 --- a/civicrm/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php +++ b/civicrm/api/v3/examples/Contact/APIChainedArrayValuesFromSiblingFunction.php @@ -83,7 +83,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -126,17 +126,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/ChainTwoWebsites.php b/civicrm/api/v3/examples/Contact/ChainTwoWebsites.php index 1d2d0159674c1510340949841f60aecc7ca149de..3526a4d009f0c4306e1df816248dd3dd2efd5b74 100644 --- a/civicrm/api/v3/examples/Contact/ChainTwoWebsites.php +++ b/civicrm/api/v3/examples/Contact/ChainTwoWebsites.php @@ -25,6 +25,7 @@ function contact_create_example() { 'invoice_id' => 67990, 'source' => 'SSF', 'contribution_status_id' => 1, + 'skipCleanMoney' => 1, ], 'api.website.create' => [ 'url' => 'http://civicrm.org', @@ -95,7 +96,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -136,6 +137,7 @@ function contact_create_expectedresult() { 'net_amount' => '90', 'trxn_id' => '15345', 'invoice_id' => '67990', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -199,17 +201,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php b/civicrm/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php index d3050a7b940fe05dca363c80732e2c47577b2890..9d587c36b0c071f398033f75ab4fbe8918c91250 100644 --- a/civicrm/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php +++ b/civicrm/api/v3/examples/Contact/ChainTwoWebsitesSyntax2.php @@ -25,6 +25,7 @@ function contact_create_example() { 'invoice_id' => 67890, 'source' => 'SSF', 'contribution_status_id' => 1, + 'skipCleanMoney' => 1, ], 'api.website.create' => [ '0' => [ @@ -98,7 +99,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -139,6 +140,7 @@ function contact_create_expectedresult() { 'net_amount' => '90', 'trxn_id' => '12345', 'invoice_id' => '67890', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -204,17 +206,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php b/civicrm/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php index c38bd4708b39152a5999fb2449b5b8a5b5b01d1e..a3f0d28d452833ebf20122359a50365a468ead83 100644 --- a/civicrm/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php +++ b/civicrm/api/v3/examples/Contact/ContactIDOfLoggedInUserContactAPI.php @@ -49,8 +49,8 @@ function contact_get_expectedresult() { 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', - 'sort_name' => 'User 412074113, Logged In', - 'display_name' => 'Mr. Logged In User 412074113 II', + 'sort_name' => 'User 202290815, Logged In', + 'display_name' => 'Mr. Logged In User 202290815 II', 'do_not_email' => 0, 'do_not_phone' => 0, 'do_not_mail' => 0, @@ -67,11 +67,11 @@ function contact_get_expectedresult() { 'preferred_mail_format' => 'Both', 'first_name' => 'Logged In', 'middle_name' => 'J.', - 'last_name' => 'User 412074113', + 'last_name' => 'User 202290815', 'prefix_id' => '3', 'suffix_id' => '3', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -86,6 +86,7 @@ function contact_get_expectedresult() { 'street_address' => '', 'supplemental_address_1' => '', 'supplemental_address_2' => '', + 'supplemental_address_3' => '', 'city' => '', 'postal_code_suffix' => '', 'postal_code' => '', @@ -107,7 +108,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => 'Mr.', 'individual_suffix' => 'II', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -127,17 +128,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/Create.php b/civicrm/api/v3/examples/Contact/Create.php index a0727ef7e0aac2e9e51f0656576950d9941bdb87..73ebfaa96f7a42d4a34b31477f8f333a3bd3e675 100644 --- a/civicrm/api/v3/examples/Contact/Create.php +++ b/civicrm/api/v3/examples/Contact/Create.php @@ -76,7 +76,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -112,17 +112,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/CreateParticipantPayment.php b/civicrm/api/v3/examples/Contact/CreateParticipantPayment.php index 9cc9537ae83410be56136795b1f589294beb79ba..11aa8c872c80d2f6205012a67b15359136cc0cbd 100644 --- a/civicrm/api/v3/examples/Contact/CreateParticipantPayment.php +++ b/civicrm/api/v3/examples/Contact/CreateParticipantPayment.php @@ -13,7 +13,7 @@ function contact_create_example() { 'contact_type' => 'Individual', 'display_name' => 'dlobo', 'api.participant' => [ - 'event_id' => 42, + 'event_id' => 43, 'status_id' => 1, 'role_id' => 1, 'format.only_id' => 1, @@ -90,7 +90,7 @@ function contact_create_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => '', @@ -141,17 +141,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/CustomFieldGet.php b/civicrm/api/v3/examples/Contact/CustomFieldGet.php index 32e6c2218a2fb6891075bf392657cf5687f57b5b..d2dc04746fd8d1bf32d3783febce3fcb30c7c715 100644 --- a/civicrm/api/v3/examples/Contact/CustomFieldGet.php +++ b/civicrm/api/v3/examples/Contact/CustomFieldGet.php @@ -65,17 +65,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php b/civicrm/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php index 4e130c6fbf66397d4f6759519ac91d6addb691d3..0c4d4840dba65a195e1083a441fff4dee1970cb9 100644 --- a/civicrm/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php +++ b/civicrm/api/v3/examples/Contact/CustomFieldGetReturnSyntaxVariation.php @@ -65,17 +65,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/Delete.php b/civicrm/api/v3/examples/Contact/Delete.php index c6d0df354bb043d7f92e64c3b72d13a117fd32d4..ab8d6a6809a29fbc61127e93236850372f889d6e 100644 --- a/civicrm/api/v3/examples/Contact/Delete.php +++ b/civicrm/api/v3/examples/Contact/Delete.php @@ -54,17 +54,17 @@ function contact_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/FormatIsSuccess_Fail.php b/civicrm/api/v3/examples/Contact/FormatIsSuccess_Fail.php index c0625de77675463d27825a9c56e132f87c254274..4bff37e48d9e13c00fbd11dce2f35242009afa30 100644 --- a/civicrm/api/v3/examples/Contact/FormatIsSuccess_Fail.php +++ b/civicrm/api/v3/examples/Contact/FormatIsSuccess_Fail.php @@ -53,17 +53,17 @@ function contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/FormatIsSuccess_True.php b/civicrm/api/v3/examples/Contact/FormatIsSuccess_True.php index 14d29195ea5222d31366027df15f3a3f3c2e9d7b..ca3a493b0f7259ed66661283a4d6a7ce5f1d9974 100644 --- a/civicrm/api/v3/examples/Contact/FormatIsSuccess_True.php +++ b/civicrm/api/v3/examples/Contact/FormatIsSuccess_True.php @@ -10,7 +10,7 @@ */ function contact_get_example() { $params = [ - 'id' => 17, + 'id' => 3, 'format.is_success' => 1, ]; @@ -53,17 +53,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/FormatOnlyID.php b/civicrm/api/v3/examples/Contact/FormatOnlyID.php index 201111a312ea97dcda5e4e78b8ed7dcc22d64d0b..2aad1376a6932286e6bf0d1ee5cb049acb3ea94b 100644 --- a/civicrm/api/v3/examples/Contact/FormatOnlyID.php +++ b/civicrm/api/v3/examples/Contact/FormatOnlyID.php @@ -11,7 +11,7 @@ */ function contact_get_example() { $params = [ - 'id' => 17, + 'id' => 3, 'format.only_id' => 1, ]; @@ -42,7 +42,7 @@ function contact_get_example() { */ function contact_get_expectedresult() { - $expectedResult = 17; + $expectedResult = 3; return $expectedResult; } @@ -54,17 +54,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/FormatSingleValue.php b/civicrm/api/v3/examples/Contact/FormatSingleValue.php index fa3f23783e4e0c6dc6b0b7f7a6f59d074d411bf7..926da812bed1ac78b6f5fd03f4d01bc6018a2429 100644 --- a/civicrm/api/v3/examples/Contact/FormatSingleValue.php +++ b/civicrm/api/v3/examples/Contact/FormatSingleValue.php @@ -11,7 +11,7 @@ */ function contact_getvalue_example() { $params = [ - 'id' => 17, + 'id' => 3, 'return' => 'display_name', ]; @@ -42,7 +42,7 @@ function contact_getvalue_example() { */ function contact_getvalue_expectedresult() { - $expectedResult = 'Test Contact'; + $expectedResult = 'Mr. Test Contact II'; return $expectedResult; } @@ -54,17 +54,17 @@ function contact_getvalue_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/Get.php b/civicrm/api/v3/examples/Contact/Get.php index 17b6b621028760d26db3c015ea37d3259fae7cba..86b47f251b6ad444f09ac3ec8ced78544e050b63 100644 --- a/civicrm/api/v3/examples/Contact/Get.php +++ b/civicrm/api/v3/examples/Contact/Get.php @@ -69,7 +69,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -106,7 +106,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -126,17 +126,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetActions.php b/civicrm/api/v3/examples/Contact/GetActions.php index 459b2e1e6441565d4e484aead943e8a030dd8f8a..5d293b478f8399f9f5b56b9a219819e85b6a24c4 100644 --- a/civicrm/api/v3/examples/Contact/GetActions.php +++ b/civicrm/api/v3/examples/Contact/GetActions.php @@ -40,28 +40,37 @@ function contact_getactions_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 20, + 'count' => 29, 'values' => [ '0' => 'create', '1' => 'delete', '2' => 'duplicatecheck', - '3' => 'get', - '4' => 'getactions', - '5' => 'getcount', - '6' => 'getfield', - '7' => 'getfields', - '8' => 'getlist', - '9' => 'getoptions', - '10' => 'getquick', - '11' => 'getrefcount', - '12' => 'getsingle', - '13' => 'getvalue', - '14' => 'merge', - '15' => 'proximity', - '16' => 'replace', - '17' => 'setvalue', - '18' => 'update', - '19' => 'validate', + '3' => 'example_action1', + '4' => 'example_action2', + '5' => 'get', + '6' => 'get_merge_conflicts', + '7' => 'getactions', + '8' => 'getcount', + '9' => 'getfield', + '10' => 'getfields', + '11' => 'getlist', + '12' => 'getmergedfrom', + '13' => 'getmergedto', + '14' => 'getoptions', + '15' => 'getquick', + '16' => 'getrefcount', + '17' => 'getsingle', + '18' => 'getunique', + '19' => 'getvalue', + '20' => 'merge', + '21' => 'proximity', + '22' => 'replace', + '23' => 'setvalue', + '24' => 'type_create', + '25' => 'type_delete', + '26' => 'type_get', + '27' => 'update', + '28' => 'validate', ], 'deprecated' => [ 'getquick' => 'The "getquick" action is deprecated in favor of "getlist".', @@ -80,17 +89,17 @@ function contact_getactions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetCountContact.php b/civicrm/api/v3/examples/Contact/GetCountContact.php index 5bffef16fcd6aa1e57348fcfc749e327ffe40e03..da0cff83ccfd92c1335896681059e0734307091e 100644 --- a/civicrm/api/v3/examples/Contact/GetCountContact.php +++ b/civicrm/api/v3/examples/Contact/GetCountContact.php @@ -10,7 +10,7 @@ */ function contact_getcount_example() { $params = [ - 'id' => 17, + 'id' => 3, ]; try{ @@ -52,17 +52,17 @@ function contact_getcount_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetFieldsOptions.php b/civicrm/api/v3/examples/Contact/GetFieldsOptions.php index d800b7268051f682b52f2d61332ddab4a20b306c..392bbe1d385e7714fe132e0e93c02efa481fa251 100644 --- a/civicrm/api/v3/examples/Contact/GetFieldsOptions.php +++ b/civicrm/api/v3/examples/Contact/GetFieldsOptions.php @@ -45,7 +45,7 @@ function contact_getfields_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 55, + 'count' => 56, 'values' => [ 'id' => [ 'name' => 'id', @@ -60,6 +60,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'contact_id', ], @@ -71,11 +73,12 @@ function contact_getfields_expectedresult() { 'description' => 'Type of Contact.', 'maxlength' => 64, 'size' => 30, - 'export' => TRUE, 'where' => 'civicrm_contact.contact_type', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'maxlength' => 64, @@ -87,6 +90,7 @@ function contact_getfields_expectedresult() { 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', ], + 'is_core_field' => TRUE, 'api.required' => 1, ], 'contact_sub_type' => [ @@ -103,6 +107,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'serialize' => 1, 'html' => [ 'type' => 'Select', 'maxlength' => 255, @@ -114,6 +120,7 @@ function contact_getfields_expectedresult() { 'labelColumn' => 'label', 'condition' => 'parent_id IS NOT NULL', ], + 'is_core_field' => TRUE, ], 'do_not_email' => [ 'name' => 'do_not_email', @@ -127,9 +134,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'do_not_phone' => [ 'name' => 'do_not_phone', @@ -143,9 +152,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'do_not_mail' => [ 'name' => 'do_not_mail', @@ -159,9 +170,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'do_not_sms' => [ 'name' => 'do_not_sms', @@ -175,9 +188,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'do_not_trade' => [ 'name' => 'do_not_trade', @@ -191,9 +206,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'is_opt_out' => [ 'name' => 'is_opt_out', @@ -207,16 +224,17 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'legal_identifier' => [ 'name' => 'legal_identifier', 'type' => 2, 'title' => 'Legal Identifier', - 'description' => 'May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID. - ', + 'description' => 'May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.', 'maxlength' => 32, 'size' => 20, 'import' => TRUE, @@ -227,11 +245,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 32, 'size' => 20, ], + 'is_core_field' => TRUE, ], 'external_identifier' => [ 'name' => 'external_identifier', @@ -248,11 +268,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 8, ], + 'is_core_field' => TRUE, ], 'sort_name' => [ 'name' => 'sort_name', @@ -261,16 +283,18 @@ function contact_getfields_expectedresult() { 'description' => 'Name used for sorting different contact types', 'maxlength' => 128, 'size' => 30, - 'export' => TRUE, 'where' => 'civicrm_contact.sort_name', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'display_name' => [ 'name' => 'display_name', @@ -279,16 +303,18 @@ function contact_getfields_expectedresult() { 'description' => 'Formatted name representing preferred format for display/print/other output.', 'maxlength' => 128, 'size' => 30, - 'export' => TRUE, 'where' => 'civicrm_contact.display_name', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'nick_name' => [ 'name' => 'nick_name', @@ -305,11 +331,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'legal_name' => [ 'name' => 'legal_name', @@ -325,11 +353,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'image_URL' => [ 'name' => 'image_URL', @@ -342,11 +372,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'File', 'rows' => 2, 'cols' => 80, ], + 'is_core_field' => TRUE, ], 'preferred_communication_method' => [ 'name' => 'preferred_communication_method', @@ -363,6 +395,8 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'serialize' => 1, 'html' => [ 'type' => 'Select', 'maxlength' => 255, @@ -372,6 +406,7 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'preferred_communication_method', 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method', ], + 'is_core_field' => TRUE, ], 'preferred_language' => [ 'name' => 'preferred_language', @@ -387,6 +422,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'maxlength' => 5, @@ -397,6 +433,7 @@ function contact_getfields_expectedresult() { 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/languages', ], + 'is_core_field' => TRUE, ], 'preferred_mail_format' => [ 'name' => 'preferred_mail_format', @@ -413,6 +450,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'maxlength' => 8, @@ -421,6 +459,7 @@ function contact_getfields_expectedresult() { 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::pmf', ], + 'is_core_field' => TRUE, ], 'hash' => [ 'name' => 'hash', @@ -429,11 +468,13 @@ function contact_getfields_expectedresult() { 'description' => 'Key for validating requests related to this contact.', 'maxlength' => 32, 'size' => 20, - 'export' => TRUE, 'where' => 'civicrm_contact.hash', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'api_key' => [ 'name' => 'api_key', @@ -442,9 +483,18 @@ function contact_getfields_expectedresult() { 'description' => 'API Key for validating requests related to this contact.', 'maxlength' => 32, 'size' => 20, + 'where' => 'civicrm_contact.api_key', + 'permission' => [ + '0' => [ + '0' => 'administer CiviCRM', + '1' => 'edit api keys', + ], + ], 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'first_name' => [ 'name' => 'first_name', @@ -461,11 +511,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'middle_name' => [ 'name' => 'middle_name', @@ -482,11 +534,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'last_name' => [ 'name' => 'last_name', @@ -503,11 +557,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'prefix_id' => [ 'name' => 'prefix_id', @@ -522,6 +578,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -531,6 +588,7 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'individual_prefix', 'optionEditPath' => 'civicrm/admin/options/individual_prefix', ], + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'individual_prefix', '1' => 'individual_prefix_id', @@ -549,6 +607,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -558,6 +617,7 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'individual_suffix', 'optionEditPath' => 'civicrm/admin/options/individual_suffix', ], + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'individual_suffix', '1' => 'individual_suffix_id', @@ -577,22 +637,25 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'communication_style_id' => [ 'name' => 'communication_style_id', 'type' => 1, 'title' => 'Communication Style', 'description' => 'Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.', - 'export' => TRUE, 'where' => 'civicrm_contact.communication_style_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -602,15 +665,24 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'communication_style', 'optionEditPath' => 'civicrm/admin/options/communication_style', ], + 'is_core_field' => TRUE, ], 'email_greeting_id' => [ 'name' => 'email_greeting_id', 'type' => 1, 'title' => 'Email Greeting ID', 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Email Greeting.', + 'where' => 'civicrm_contact.email_greeting_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'pseudoconstant' => [ + 'optionGroupName' => 'email_greeting', + 'optionEditPath' => 'civicrm/admin/options/email_greeting', + ], + 'is_core_field' => TRUE, ], 'email_greeting_custom' => [ 'name' => 'email_greeting_custom', @@ -624,11 +696,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'email_greeting_display' => [ 'name' => 'email_greeting_display', @@ -637,28 +711,39 @@ function contact_getfields_expectedresult() { 'description' => 'Cache Email Greeting.', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_contact.email_greeting_display', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'postal_greeting_id' => [ 'name' => 'postal_greeting_id', 'type' => 1, 'title' => 'Postal Greeting ID', 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.', + 'where' => 'civicrm_contact.postal_greeting_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'size' => 6, 'maxlength' => 14, ], + 'pseudoconstant' => [ + 'optionGroupName' => 'postal_greeting', + 'optionEditPath' => 'civicrm/admin/options/postal_greeting', + ], + 'is_core_field' => TRUE, ], 'postal_greeting_custom' => [ 'name' => 'postal_greeting_custom', @@ -672,11 +757,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'postal_greeting_display' => [ 'name' => 'postal_greeting_display', @@ -685,23 +772,34 @@ function contact_getfields_expectedresult() { 'description' => 'Cache Postal greeting.', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_contact.postal_greeting_display', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'addressee_id' => [ 'name' => 'addressee_id', 'type' => 1, 'title' => 'Addressee ID', 'description' => 'FK to civicrm_option_value.id, that has to be valid registered Addressee.', + 'where' => 'civicrm_contact.addressee_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'pseudoconstant' => [ + 'optionGroupName' => 'addressee', + 'optionEditPath' => 'civicrm/admin/options/addressee', + ], + 'is_core_field' => TRUE, ], 'addressee_custom' => [ 'name' => 'addressee_custom', @@ -715,11 +813,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'addressee_display' => [ 'name' => 'addressee_display', @@ -728,14 +828,17 @@ function contact_getfields_expectedresult() { 'description' => 'Cache Addressee.', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_contact.addressee_display', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'job_title' => [ 'name' => 'job_title', @@ -752,11 +855,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'gender_id' => [ 'name' => 'gender_id', @@ -770,6 +875,7 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -779,6 +885,7 @@ function contact_getfields_expectedresult() { 'optionGroupName' => 'gender', 'optionEditPath' => 'civicrm/admin/options/gender', ], + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'gender', ], @@ -796,10 +903,12 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select Date', - 'format' => 'birth', + 'formatType' => 'birth', ], + 'is_core_field' => TRUE, ], 'is_deceased' => [ 'name' => 'is_deceased', @@ -812,9 +921,11 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, ], 'deceased_date' => [ 'name' => 'deceased_date', @@ -828,10 +939,12 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Select Date', - 'format' => 'birth', + 'formatType' => 'birth', ], + 'is_core_field' => TRUE, ], 'household_name' => [ 'name' => 'household_name', @@ -848,26 +961,31 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'primary_contact_id' => [ 'name' => 'primary_contact_id', 'type' => 1, 'title' => 'Household Primary Contact ID', 'description' => 'Optional FK to Primary Contact for this household.', + 'where' => 'civicrm_contact.primary_contact_id', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'html' => [ 'type' => 'Select', 'size' => 6, 'maxlength' => 14, ], + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], 'organization_name' => [ @@ -885,11 +1003,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'sic_code' => [ 'name' => 'sic_code', @@ -905,11 +1025,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 8, 'size' => 8, ], + 'is_core_field' => TRUE, ], 'user_unique_id' => [ 'name' => 'user_unique_id', @@ -927,11 +1049,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 45, ], + 'is_core_field' => TRUE, ], 'created_date' => [ 'name' => 'created_date', @@ -939,12 +1063,14 @@ function contact_getfields_expectedresult() { 'title' => 'Created Date', 'description' => 'When was the contact was created.', 'required' => '', - 'export' => TRUE, 'where' => 'civicrm_contact.created_date', + 'export' => TRUE, 'default' => 'NULL', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'modified_date' => [ 'name' => 'modified_date', @@ -952,12 +1078,14 @@ function contact_getfields_expectedresult() { 'title' => 'Modified Date', 'description' => 'When was the contact (or closely related entity) was created or modified or deleted.', 'required' => '', - 'export' => TRUE, 'where' => 'civicrm_contact.modified_date', + 'export' => TRUE, 'default' => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'source' => [ 'name' => 'source', @@ -973,11 +1101,13 @@ function contact_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 255, 'size' => 30, ], + 'is_core_field' => TRUE, 'uniqueName' => 'contact_source', ], 'employer_id' => [ @@ -985,17 +1115,19 @@ function contact_getfields_expectedresult() { 'type' => 1, 'title' => 'Current Employer', 'description' => 'OPTIONAL FK to civicrm_contact record.', - 'export' => TRUE, 'where' => 'civicrm_contact.employer_id', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', 'html' => [ 'type' => 'EntityRef', 'size' => 6, 'maxlength' => 14, ], + 'is_core_field' => TRUE, 'uniqueName' => 'current_employer_id', 'FKApiName' => 'Contact', ], @@ -1004,20 +1136,28 @@ function contact_getfields_expectedresult() { 'type' => 16, 'title' => 'Contact is in Trash', 'required' => TRUE, - 'export' => TRUE, 'where' => 'civicrm_contact.is_deleted', + 'export' => TRUE, 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'CheckBox', ], + 'is_core_field' => TRUE, 'uniqueName' => 'contact_is_deleted', ], 'custom_1' => [ + 'id' => '1', 'label' => 'Our special field', - 'groupTitle' => 'select_test_g', + 'headerPattern' => '//', + 'title' => 'Our special field', + 'custom_field_id' => '1', + 'groupTitle' => 'select_test_group', 'data_type' => 'String', + 'name' => 'custom_1', + 'type' => 2, 'html_type' => 'Select', 'default_value' => '', 'text_length' => '', @@ -1029,19 +1169,19 @@ function contact_getfields_expectedresult() { 'extends_entity_column_id' => '', 'is_view' => 0, 'is_multiple' => 0, - 'option_group_id' => '105', + 'option_group_id' => '110', 'date_format' => '', 'time_format' => '', 'is_required' => '1', 'table_name' => 'civicrm_value_select_test_g_1', 'column_name' => 'our_special_field_1', + 'where' => 'civicrm_value_select_test_g_1.our_special_field_1', + 'extends_table' => 'civicrm_contact', + 'search_table' => 'contact_a', 'pseudoconstant' => [ - 'optionGroupName' => 'our_special_field_20170207021937', - 'optionEditPath' => 'civicrm/admin/options/our_special_field_20170207021937', + 'optionGroupName' => 'our_special_field_20190820191605', + 'optionEditPath' => 'civicrm/admin/options/our_special_field_20190820191605', ], - 'name' => 'custom_1', - 'title' => 'Our special field', - 'type' => 2, 'options' => [ '1' => 'Label1', '2' => 'Label2', @@ -1059,6 +1199,13 @@ function contact_getfields_expectedresult() { 'type' => 16, 'name' => 'dupe_check', ], + 'skip_greeting_processing' => [ + 'title' => 'Skip Greeting processing', + 'description' => 'Do not process greetings, (these can be done by scheduled job and there may be a preference to do so for performance reasons)', + 'type' => 16, + 'api.default' => 0, + 'name' => 'skip_greeting_processing', + ], ], ]; @@ -1072,17 +1219,17 @@ function contact_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetMergedfrom.php b/civicrm/api/v3/examples/Contact/GetMergedfrom.php new file mode 100644 index 0000000000000000000000000000000000000000..5349486299a632c9a8ae8e8a471a2e116bed3285 --- /dev/null +++ b/civicrm/api/v3/examples/Contact/GetMergedfrom.php @@ -0,0 +1,80 @@ +<?php +/** + * Test Generated example demonstrating the Contact.getmergedfrom API. + * + * @return array + * API result array + */ +function contact_getmergedfrom_example() { + $params = [ + 'contact_id' => 4, + ]; + + try{ + $result = civicrm_api3('Contact', 'getmergedfrom', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function contact_getmergedfrom_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'values' => [ + '3' => [ + 'id' => '3', + ], + '5' => [ + 'id' => '5', + ], + '6' => [ + 'id' => '6', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testMergedGet" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Contact/GetMergedto.php b/civicrm/api/v3/examples/Contact/GetMergedto.php new file mode 100644 index 0000000000000000000000000000000000000000..7d50e49cc8579d26918d95054cb8c90609b5880c --- /dev/null +++ b/civicrm/api/v3/examples/Contact/GetMergedto.php @@ -0,0 +1,76 @@ +<?php +/** + * Test Generated example demonstrating the Contact.getmergedto API. + * + * @return array + * API result array + */ +function contact_getmergedto_example() { + $params = [ + 'sequential' => 1, + 'contact_id' => 6, + ]; + + try{ + $result = civicrm_api3('Contact', 'getmergedto', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function contact_getmergedto_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 4, + 'values' => [ + '0' => [ + 'id' => '4', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testMergedGet" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Contact/GetOptions.php b/civicrm/api/v3/examples/Contact/GetOptions.php index 352a2296ea123ec56017f063e7c33232447106ca..60cd8e5197e41b8398e5aa431eaaae3cb8f7709d 100644 --- a/civicrm/api/v3/examples/Contact/GetOptions.php +++ b/civicrm/api/v3/examples/Contact/GetOptions.php @@ -59,17 +59,17 @@ function contact_getoptions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetSingleContact.php b/civicrm/api/v3/examples/Contact/GetSingleContact.php index de75c962f48b863050f0bff0042406238cdcebc4..1c5534833ba9f9d807f52fadcedf14196a9c9c05 100644 --- a/civicrm/api/v3/examples/Contact/GetSingleContact.php +++ b/civicrm/api/v3/examples/Contact/GetSingleContact.php @@ -11,7 +11,7 @@ */ function contact_getsingle_example() { $params = [ - 'id' => 17, + 'id' => 3, ]; try{ @@ -42,16 +42,16 @@ function contact_getsingle_example() { function contact_getsingle_expectedresult() { $expectedResult = [ - 'contact_id' => '17', + 'contact_id' => '3', 'contact_type' => 'Individual', 'contact_sub_type' => '', - 'sort_name' => '', - 'display_name' => 'Test Contact', - 'do_not_email' => '', - 'do_not_phone' => '', - 'do_not_mail' => '', - 'do_not_sms' => '', - 'do_not_trade' => '', + 'sort_name' => 'Contact, Test', + 'display_name' => 'Mr. Test Contact II', + 'do_not_email' => 0, + 'do_not_phone' => 0, + 'do_not_mail' => 0, + 'do_not_sms' => 0, + 'do_not_trade' => 0, 'is_opt_out' => 0, 'legal_identifier' => '', 'external_identifier' => '', @@ -59,15 +59,15 @@ function contact_getsingle_expectedresult() { 'legal_name' => '', 'image_URL' => '', 'preferred_communication_method' => '', - 'preferred_language' => '', - 'preferred_mail_format' => '', + 'preferred_language' => 'en_US', + 'preferred_mail_format' => 'Both', 'first_name' => 'Test', - 'middle_name' => '', + 'middle_name' => 'J.', 'last_name' => 'Contact', - 'prefix_id' => '', - 'suffix_id' => '', + 'prefix_id' => '3', + 'suffix_id' => '3', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -93,23 +93,23 @@ function contact_getsingle_expectedresult() { 'phone_id' => '', 'phone_type_id' => '', 'phone' => '', - 'email_id' => '', - 'email' => '', - 'on_hold' => '', + 'email_id' => '1', + 'email' => 'anthony_anderson@civicrm.org', + 'on_hold' => 0, 'im_id' => '', 'provider_id' => '', 'im' => '', 'worldregion_id' => '', 'world_region' => '', - 'languages' => '', - 'individual_prefix' => '', - 'individual_suffix' => '', - 'communication_style' => '', + 'languages' => 'English (United States)', + 'individual_prefix' => 'Mr.', + 'individual_suffix' => 'II', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', 'country' => '', - 'id' => '17', + 'id' => '3', ]; return $expectedResult; @@ -122,17 +122,17 @@ function contact_getsingle_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/GetUnique.php b/civicrm/api/v3/examples/Contact/GetUnique.php new file mode 100644 index 0000000000000000000000000000000000000000..b8f75bcc4eb464ea5de9b4006561e6b7d691771a --- /dev/null +++ b/civicrm/api/v3/examples/Contact/GetUnique.php @@ -0,0 +1,71 @@ +<?php +/** + * Test Generated example demonstrating the Contact.getunique API. + * + * @return array + * API result array + */ +function contact_getunique_example() { + $params = []; + + try{ + $result = civicrm_api3('Contact', 'getunique', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function contact_getunique_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 'UI_external_identifier', + 'values' => [ + 'UI_external_identifier' => [], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testContactGetUnique" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Contact/GroupFilterUsingContactAPI.php b/civicrm/api/v3/examples/Contact/GroupFilterUsingContactAPI.php index 43d22f067b87025f629d657ca77e147d012c3935..1fd3b4f3ac8314cdee1d053883730a731b956eac 100644 --- a/civicrm/api/v3/examples/Contact/GroupFilterUsingContactAPI.php +++ b/civicrm/api/v3/examples/Contact/GroupFilterUsingContactAPI.php @@ -76,7 +76,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -113,7 +113,7 @@ function contact_get_expectedresult() { 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', @@ -133,17 +133,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contact/NestedReplaceEmail.php b/civicrm/api/v3/examples/Contact/NestedReplaceEmail.php index 753e3ffa7845713687da60bf00fd75a47bbad908..04d61e2bc699fdb7f20faa8da1ba521717168f08 100644 --- a/civicrm/api/v3/examples/Contact/NestedReplaceEmail.php +++ b/civicrm/api/v3/examples/Contact/NestedReplaceEmail.php @@ -9,31 +9,31 @@ */ function contact_get_example() { $params = [ - 'id' => 10, + 'id' => 19, 'api.email.replace' => [ 'values' => [ '0' => [ - 'location_type_id' => 20, + 'location_type_id' => 38, 'email' => '1-1@example.com', 'is_primary' => 1, ], '1' => [ - 'location_type_id' => 20, + 'location_type_id' => 38, 'email' => '1-2@example.com', 'is_primary' => 0, ], '2' => [ - 'location_type_id' => 20, + 'location_type_id' => 38, 'email' => '1-3@example.com', 'is_primary' => 0, ], '3' => [ - 'location_type_id' => 21, + 'location_type_id' => 39, 'email' => '2-1@example.com', 'is_primary' => 0, ], '4' => [ - 'location_type_id' => 21, + 'location_type_id' => 39, 'email' => '2-2@example.com', 'is_primary' => 0, ], @@ -72,10 +72,10 @@ function contact_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 10, + 'id' => 19, 'values' => [ - '10' => [ - 'contact_id' => '10', + '19' => [ + 'contact_id' => '19', 'contact_type' => 'Organization', 'contact_sub_type' => '', 'sort_name' => 'Unit Test Organization', @@ -100,7 +100,7 @@ function contact_get_expectedresult() { 'prefix_id' => '', 'suffix_id' => '', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'job_title' => '', 'gender_id' => '', 'birth_date' => '', @@ -134,27 +134,28 @@ function contact_get_expectedresult() { 'im' => '', 'worldregion_id' => '', 'world_region' => '', + 'languages' => 'English (United States)', 'individual_prefix' => '', 'individual_suffix' => '', - 'communication_style' => '', + 'communication_style' => 'Formal', 'gender' => '', 'state_province_name' => '', 'state_province' => '', 'country' => '', - 'id' => '10', + 'id' => '19', 'api.email.replace' => [ 'is_error' => 0, 'version' => 3, 'count' => 5, 'values' => [ '0' => [ - 'id' => '18', - 'contact_id' => '10', - 'location_type_id' => '20', + 'id' => '19', + 'contact_id' => '19', + 'location_type_id' => '38', 'email' => '1-1@example.com', 'is_primary' => '1', 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -162,13 +163,13 @@ function contact_get_expectedresult() { 'signature_html' => '', ], '1' => [ - 'id' => '19', - 'contact_id' => '10', - 'location_type_id' => '20', + 'id' => '20', + 'contact_id' => '19', + 'location_type_id' => '38', 'email' => '1-2@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -176,13 +177,13 @@ function contact_get_expectedresult() { 'signature_html' => '', ], '2' => [ - 'id' => '20', - 'contact_id' => '10', - 'location_type_id' => '20', + 'id' => '21', + 'contact_id' => '19', + 'location_type_id' => '38', 'email' => '1-3@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -190,13 +191,13 @@ function contact_get_expectedresult() { 'signature_html' => '', ], '3' => [ - 'id' => '21', - 'contact_id' => '10', - 'location_type_id' => '21', + 'id' => '22', + 'contact_id' => '19', + 'location_type_id' => '39', 'email' => '2-1@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -204,13 +205,13 @@ function contact_get_expectedresult() { 'signature_html' => '', ], '4' => [ - 'id' => '22', - 'contact_id' => '10', - 'location_type_id' => '21', + 'id' => '23', + 'contact_id' => '19', + 'location_type_id' => '39', 'email' => '2-2@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -233,17 +234,17 @@ function contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php b/civicrm/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php index fc33466272557215f2b1ae7046b2fe1e9af4924f..e775abbb76edda865a38580d7a539adb53345f57 100644 --- a/civicrm/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php +++ b/civicrm/api/v3/examples/Contribution/ContributionCreateWithHonoreeContact.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 28, + 'contact_id' => 31, 'receive_date' => '20120511', 'total_amount' => '100', 'financial_type_id' => 1, @@ -18,7 +18,7 @@ function contribution_create_example() { 'net_amount' => '95', 'source' => 'SSF', 'contribution_status_id' => 1, - 'honor_contact_id' => 29, + 'honor_contact_id' => 32, ]; try{ @@ -56,7 +56,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '28', + 'contact_id' => '31', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '4', @@ -67,6 +67,7 @@ function contribution_create_expectedresult() { 'net_amount' => '95', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -99,17 +100,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/ContributionCreateWithNote.php b/civicrm/api/v3/examples/Contribution/ContributionCreateWithNote.php index d9e863ea23c8470f38984ad5eb61b60668b359f3..1c22dd7f1f7409a3e51a3b2dfd574fd5e12a9718 100644 --- a/civicrm/api/v3/examples/Contribution/ContributionCreateWithNote.php +++ b/civicrm/api/v3/examples/Contribution/ContributionCreateWithNote.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 22, + 'contact_id' => 25, 'receive_date' => '2012-01-01', 'total_amount' => '100', 'financial_type_id' => 1, @@ -59,7 +59,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '22', + 'contact_id' => '25', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '1', @@ -70,6 +70,7 @@ function contribution_create_expectedresult() { 'net_amount' => '90', 'trxn_id' => '12345', 'invoice_id' => '67890', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -102,17 +103,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php b/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php index e8f3cf62b44f8637bda0bd3a9c5b343840fc1929..e4d36539ba9ad5b1442f1c2df3fb6d4b10985384 100644 --- a/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php +++ b/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCredit.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 24, + 'contact_id' => 27, 'receive_date' => '20120511', 'total_amount' => '100', 'financial_type_id' => 1, @@ -20,7 +20,7 @@ function contribution_create_example() { 'contribution_status_id' => 1, 'soft_credit' => [ '1' => [ - 'contact_id' => 25, + 'contact_id' => 28, 'amount' => 50, 'soft_credit_type_id' => 3, ], @@ -62,7 +62,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '24', + 'contact_id' => '27', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '4', @@ -73,6 +73,7 @@ function contribution_create_expectedresult() { 'net_amount' => '95', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -105,17 +106,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php b/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php index 9698b850e538043e7169a69d62250c22f34a9cf9..2c6729fb0a90e80739f285933a3daa0f6dd7b211 100644 --- a/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php +++ b/civicrm/api/v3/examples/Contribution/ContributionCreateWithSoftCreditDefaults.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 26, + 'contact_id' => 29, 'receive_date' => '20120511', 'total_amount' => '100', 'financial_type_id' => 1, @@ -18,7 +18,7 @@ function contribution_create_example() { 'net_amount' => '95', 'source' => 'SSF', 'contribution_status_id' => 1, - 'soft_credit_to' => 27, + 'soft_credit_to' => 30, ]; try{ @@ -56,7 +56,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '26', + 'contact_id' => '29', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '4', @@ -67,6 +67,7 @@ function contribution_create_expectedresult() { 'net_amount' => '95', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -99,17 +100,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/Create.php b/civicrm/api/v3/examples/Contribution/Create.php index df458f5908dfa0a972ebafd300fdfb8982b88dca..7540683df7fc2d51c2f5afa1760fb1ed614911e1 100644 --- a/civicrm/api/v3/examples/Contribution/Create.php +++ b/civicrm/api/v3/examples/Contribution/Create.php @@ -65,6 +65,7 @@ function contribution_create_expectedresult() { 'net_amount' => '100', 'trxn_id' => '12345', 'invoice_id' => '67890', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -83,7 +84,6 @@ function contribution_create_expectedresult() { 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', - 'invoice_number' => '', ], ], ]; @@ -98,17 +98,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/CreateWithNestedLineItems.php b/civicrm/api/v3/examples/Contribution/CreateWithNestedLineItems.php index dd23dd07a66378ca52f7cf75aea80c32a30e0452..3c27c405c59f2120a26ccc1a500e6918b4303ed0 100644 --- a/civicrm/api/v3/examples/Contribution/CreateWithNestedLineItems.php +++ b/civicrm/api/v3/examples/Contribution/CreateWithNestedLineItems.php @@ -9,7 +9,7 @@ */ function contribution_create_example() { $params = [ - 'contact_id' => 11, + 'contact_id' => 12, 'receive_date' => '20120511', 'total_amount' => '100', 'financial_type_id' => 1, @@ -73,7 +73,7 @@ function contribution_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '11', + 'contact_id' => '12', 'financial_type_id' => '1', 'contribution_page_id' => '', 'payment_instrument_id' => '1', @@ -84,6 +84,7 @@ function contribution_create_expectedresult() { 'net_amount' => '90', 'trxn_id' => '12345', 'invoice_id' => '67890', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -166,17 +167,17 @@ function contribution_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/Delete.php b/civicrm/api/v3/examples/Contribution/Delete.php index bb445f01b52e5c7e058acfaa8ea62631461a9cda..b13f4108dd9fcaa16c0dc911e367485ead401fbc 100644 --- a/civicrm/api/v3/examples/Contribution/Delete.php +++ b/civicrm/api/v3/examples/Contribution/Delete.php @@ -57,17 +57,17 @@ function contribution_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/Get.php b/civicrm/api/v3/examples/Contribution/Get.php index ee07a1ab53ce2854f849ba249cb7ce394bc43331..410875dc47c4dbaf657ad2149c66ccd56bf06811 100644 --- a/civicrm/api/v3/examples/Contribution/Get.php +++ b/civicrm/api/v3/examples/Contribution/Get.php @@ -51,6 +51,10 @@ function contribution_get_expectedresult() { 'display_name' => 'Mr. Anthony Anderson II', 'contribution_id' => '1', 'currency' => 'USD', + 'contribution_recur_id' => '', + 'contribution_status_id' => '1', + 'contribution_campaign_id' => '', + 'payment_instrument_id' => '4', 'receive_date' => '2010-01-20 00:00:00', 'non_deductible_amount' => '10.00', 'total_amount' => '100.00', @@ -58,39 +62,30 @@ function contribution_get_expectedresult() { 'net_amount' => '95.00', 'trxn_id' => '23456', 'invoice_id' => '78910', - 'cancel_date' => '', + 'invoice_number' => 'INV_1', + 'contribution_cancel_date' => '', 'cancel_reason' => '', 'receipt_date' => '', 'thankyou_date' => '', 'contribution_source' => 'SSF', 'amount_level' => '', - 'contribution_recur_id' => '', 'is_test' => 0, 'is_pay_later' => 0, - 'contribution_status_id' => '1', 'contribution_check_number' => '', - 'contribution_campaign_id' => '', - 'financial_type_id' => '1', - 'financial_type' => 'Donation', - 'product_id' => '', - 'product_name' => '', - 'sku' => '', - 'contribution_product_id' => '', - 'product_option' => '', - 'fulfilled_date' => '', - 'contribution_start_date' => '', - 'contribution_end_date' => '', 'financial_account_id' => '1', 'accounting_code' => '4200', 'campaign_id' => '', 'contribution_campaign_title' => '', + 'financial_type_id' => '1', + 'financial_type' => 'Donation', 'contribution_note' => '', 'contribution_batch' => '', - 'contribution_status' => 'Completed', + 'contribution_recur_status' => 'Completed', 'payment_instrument' => 'Check', - 'payment_instrument_id' => '4', - 'instrument_id' => '4', + 'contribution_status' => 'Completed', 'check_number' => '', + 'instrument_id' => '4', + 'cancel_date' => '', 'id' => '1', 'contribution_type_id' => '1', ], @@ -107,17 +102,17 @@ function contribution_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Contribution/GetUnique.php b/civicrm/api/v3/examples/Contribution/GetUnique.php new file mode 100644 index 0000000000000000000000000000000000000000..04b96bece685e90ef8cd412859ccb2d696c536ac --- /dev/null +++ b/civicrm/api/v3/examples/Contribution/GetUnique.php @@ -0,0 +1,71 @@ +<?php +/** + * Test Generated example demonstrating the Contribution.getunique API. + * + * @return array + * API result array + */ +function contribution_getunique_example() { + $params = []; + + try{ + $result = civicrm_api3('Contribution', 'getunique', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function contribution_getunique_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => [ + 'UI_contrib_trxn_id' => [], + 'UI_contrib_invoice_id' => [], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testContributionGetUnique" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/ContributionPage/Create.php b/civicrm/api/v3/examples/ContributionPage/Create.php index 2b18e3ffca083d479fef9202b42af92f94e48d71..5ad0fd2858c0606e777ed49ece9b0881a795f95c 100644 --- a/civicrm/api/v3/examples/ContributionPage/Create.php +++ b/civicrm/api/v3/examples/ContributionPage/Create.php @@ -97,6 +97,7 @@ function contribution_page_create_expectedresult() { 'campaign_id' => '', 'is_share' => '', 'is_billing_required' => '', + 'contribution_type_id' => '1', ], ], ]; @@ -111,17 +112,17 @@ function contribution_page_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionPage/Delete.php b/civicrm/api/v3/examples/ContributionPage/Delete.php index 87221bb754e9eed0657cf9d7fd3de654ac454ddb..423f5c2b08cd3861474cfa265ad78912abe3433f 100644 --- a/civicrm/api/v3/examples/ContributionPage/Delete.php +++ b/civicrm/api/v3/examples/ContributionPage/Delete.php @@ -54,17 +54,17 @@ function contribution_page_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionPage/Get.php b/civicrm/api/v3/examples/ContributionPage/Get.php index f5b2b365ba7dd49c143bc5aeccd08985fcdb56a8..ae66d5d0dbedf491542f2a52754c903a7d8ac089 100644 --- a/civicrm/api/v3/examples/ContributionPage/Get.php +++ b/civicrm/api/v3/examples/ContributionPage/Get.php @@ -82,17 +82,17 @@ function contribution_page_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionPage/Submit.php b/civicrm/api/v3/examples/ContributionPage/Submit.php index e58d1ef989c32e90f9abd2fe32ced1379c2c51a8..c7ef21f1c03d29bb470b52f1331cb2fb54c1f64e 100644 --- a/civicrm/api/v3/examples/ContributionPage/Submit.php +++ b/civicrm/api/v3/examples/ContributionPage/Submit.php @@ -26,11 +26,11 @@ function contribution_page_submit_example() { ], 'cvv2' => 123, 'pledge_id' => '1', - 'cid' => '83', - 'contact_id' => '83', + 'cid' => '4', + 'contact_id' => '4', 'amount' => '100', 'is_pledge' => TRUE, - 'pledge_block_id' => 2, + 'pledge_block_id' => 1, ]; try{ @@ -77,17 +77,17 @@ function contribution_page_submit_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionPageTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionRecur/Create.php b/civicrm/api/v3/examples/ContributionRecur/Create.php index dc953c9d4f8b2d2a7829d536220da2d8e7a73835..7018d2ef9fa7b9ca6062c80bf9606e91cbf6ce8e 100644 --- a/civicrm/api/v3/examples/ContributionRecur/Create.php +++ b/civicrm/api/v3/examples/ContributionRecur/Create.php @@ -62,6 +62,7 @@ function contribution_recur_create_expectedresult() { 'create_date' => '20120130621222105', 'modified_date' => '2012-11-14 16:02:35', 'cancel_date' => '', + 'cancel_reason' => '', 'end_date' => '', 'processor_id' => '', 'payment_token_id' => '', @@ -93,17 +94,17 @@ function contribution_recur_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionRecur/Delete.php b/civicrm/api/v3/examples/ContributionRecur/Delete.php index d27fe4de885043ef4ec1273f4cf22f0a6a290bfd..52e8b6482b483fcb64eae4f116df535be1c1cbea 100644 --- a/civicrm/api/v3/examples/ContributionRecur/Delete.php +++ b/civicrm/api/v3/examples/ContributionRecur/Delete.php @@ -54,17 +54,17 @@ function contribution_recur_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionRecur/Get.php b/civicrm/api/v3/examples/ContributionRecur/Get.php index de3ae0566648710712b92a2c2982c0f6e8c39411..ce054103fce6159973e65d37b748e00d2755c8ca 100644 --- a/civicrm/api/v3/examples/ContributionRecur/Get.php +++ b/civicrm/api/v3/examples/ContributionRecur/Get.php @@ -74,17 +74,17 @@ function contribution_recur_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionRecurTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionSoft/Create.php b/civicrm/api/v3/examples/ContributionSoft/Create.php index 523683a58f1573ae894e82ea18ab9ac676bf7000..83a46b9e67944f4cd861d475eee55f227bc4d317 100644 --- a/civicrm/api/v3/examples/ContributionSoft/Create.php +++ b/civicrm/api/v3/examples/ContributionSoft/Create.php @@ -72,17 +72,17 @@ function contribution_soft_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionSoft/Delete.php b/civicrm/api/v3/examples/ContributionSoft/Delete.php index 5c663ddaa464fa29e8664e8c50732e4b548229c8..8bf895bebdc31e7a7c7fe33305f07ed547fa1a08 100644 --- a/civicrm/api/v3/examples/ContributionSoft/Delete.php +++ b/civicrm/api/v3/examples/ContributionSoft/Delete.php @@ -37,7 +37,12 @@ function contribution_soft_delete_example() { */ function contribution_soft_delete_expectedresult() { - $expectedResult = ''; + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ]; return $expectedResult; } @@ -49,17 +54,17 @@ function contribution_soft_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ContributionSoft/Get.php b/civicrm/api/v3/examples/ContributionSoft/Get.php index 00f58d7e95a0b871180c9c3383d448ec262e8cb4..1ac873f42fc53c2c761f17102dd51813cf9aff9d 100644 --- a/civicrm/api/v3/examples/ContributionSoft/Get.php +++ b/civicrm/api/v3/examples/ContributionSoft/Get.php @@ -65,17 +65,17 @@ function contribution_soft_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ContributionSoftTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Country/Create.php b/civicrm/api/v3/examples/Country/Create.php index 1d76d52b87890086ba814a8164990d0ad2968486..ab03f90864a95e4b12afbdc5d76867a02ba15b03 100644 --- a/civicrm/api/v3/examples/Country/Create.php +++ b/civicrm/api/v3/examples/Country/Create.php @@ -69,17 +69,17 @@ function country_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Country/Delete.php b/civicrm/api/v3/examples/Country/Delete.php index 07676caec1daf0a6e9c5acc63747e600d0fb2d43..691d99a2c6e31557ccb9bbaf0fd4d540b0330d65 100644 --- a/civicrm/api/v3/examples/Country/Delete.php +++ b/civicrm/api/v3/examples/Country/Delete.php @@ -54,17 +54,17 @@ function country_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Country/Get.php b/civicrm/api/v3/examples/Country/Get.php index 7ff129241439a6f1639338546a183a0083acae0f..827b2c5c0d22a0db1fd26db1bf08e0454dc2158e 100644 --- a/civicrm/api/v3/examples/Country/Get.php +++ b/civicrm/api/v3/examples/Country/Get.php @@ -63,17 +63,17 @@ function country_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CountryTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomField/Create.php b/civicrm/api/v3/examples/CustomField/Create.php index a29f9842cb6b3be6972e020011c8edfa8bbb5c3d..1d622aa3de450beaf8dc0c59765575b96d69b4d8 100644 --- a/civicrm/api/v3/examples/CustomField/Create.php +++ b/civicrm/api/v3/examples/CustomField/Create.php @@ -97,17 +97,17 @@ function custom_field_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomField/Delete.php b/civicrm/api/v3/examples/CustomField/Delete.php index 90c6985ef086ae82dacf5f2771272c49ca93a28c..6ea27931d31760f80da6233655bd030d5f5497f5 100644 --- a/civicrm/api/v3/examples/CustomField/Delete.php +++ b/civicrm/api/v3/examples/CustomField/Delete.php @@ -54,17 +54,17 @@ function custom_field_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomGroup/Create.php b/civicrm/api/v3/examples/CustomGroup/Create.php index 950622f0ea7f036100f122cca7f943124ef4a169..99787e2640cea4b2747a63a1e37fe1b4e89be5d1 100644 --- a/civicrm/api/v3/examples/CustomGroup/Create.php +++ b/civicrm/api/v3/examples/CustomGroup/Create.php @@ -74,6 +74,7 @@ function custom_group_create_expectedresult() { 'created_id' => '', 'created_date' => '', 'is_reserved' => '', + 'is_public' => '', ], ], ]; @@ -88,17 +89,17 @@ function custom_group_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomGroup/Delete.php b/civicrm/api/v3/examples/CustomGroup/Delete.php index d05b071399029e62846eb2219df4e75b5c010268..f09b053b270ab71f5ad6cc9e3d47d90f234130b7 100644 --- a/civicrm/api/v3/examples/CustomGroup/Delete.php +++ b/civicrm/api/v3/examples/CustomGroup/Delete.php @@ -54,17 +54,17 @@ function custom_group_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/CustomGroup/Get.php b/civicrm/api/v3/examples/CustomGroup/Get.php index 1ed12b4930961fd902036353b31c6af25fd67dcd..29cc2f521b526aba3c505ff936edf584c10bf929 100644 --- a/civicrm/api/v3/examples/CustomGroup/Get.php +++ b/civicrm/api/v3/examples/CustomGroup/Get.php @@ -56,6 +56,7 @@ function custom_group_get_expectedresult() { 'is_multiple' => 0, 'collapse_adv_display' => 0, 'is_reserved' => 0, + 'is_public' => '1', ], ], ]; @@ -70,17 +71,17 @@ function custom_group_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CustomGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Domain/Create.php b/civicrm/api/v3/examples/Domain/Create.php index 328446478ed37a4d8df31035636fc74824e48a66..85b9fb6dbe2880863e49cadd75c28ba57710aa4a 100644 --- a/civicrm/api/v3/examples/Domain/Create.php +++ b/civicrm/api/v3/examples/Domain/Create.php @@ -10,7 +10,7 @@ function domain_create_example() { 'name' => 'A-team domain', 'description' => 'domain of chaos', 'domain_version' => '4.2', - 'contact_id' => 6, + 'contact_id' => 7, ]; try{ @@ -51,7 +51,7 @@ function domain_create_expectedresult() { 'name' => 'A-team domain', 'description' => 'domain of chaos', 'config_backend' => '', - 'contact_id' => '6', + 'contact_id' => '7', 'locales' => '', 'locale_custom_strings' => '', 'domain_version' => '4.2', @@ -69,17 +69,17 @@ function domain_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/DomainTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Domain/Get.php b/civicrm/api/v3/examples/Domain/Get.php index 8ea402bbaaea87b042c9a4070f8371b43058698a..9ccfc284cd8595a5506a1bf42aa55cc25a6c8729 100644 --- a/civicrm/api/v3/examples/Domain/Get.php +++ b/civicrm/api/v3/examples/Domain/Get.php @@ -65,8 +65,8 @@ function domain_get_expectedresult() { 'geo_code_1' => '', 'geo_code_2' => '', ], - 'from_email' => 'info@EXAMPLE.ORG', 'from_name' => 'FIXME', + 'from_email' => 'info@EXAMPLE.ORG', 'domain_version' => '4.6.alpha1', ], '1' => [ @@ -91,8 +91,8 @@ function domain_get_expectedresult() { 'geo_code_1' => '41.8328', 'geo_code_2' => '-72.9253', ], - 'from_email' => 'info@EXAMPLE.ORG', 'from_name' => 'FIXME', + 'from_email' => 'info@EXAMPLE.ORG', 'domain_version' => '4.6.alpha1', ], ], @@ -108,17 +108,17 @@ function domain_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/DomainTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Email/Create.php b/civicrm/api/v3/examples/Email/Create.php index 98abb059d18e97a24fd41e19c995fb8b82993c56..b2db488cab741855822d96c063c285627f8008a5 100644 --- a/civicrm/api/v3/examples/Email/Create.php +++ b/civicrm/api/v3/examples/Email/Create.php @@ -7,10 +7,9 @@ */ function email_create_example() { $params = [ - 'contact_id' => 3, - 'location_type_id' => 6, + 'contact_id' => 23, 'email' => 'api@a-team.com', - 'is_primary' => 1, + 'on_hold' => '2', ]; try{ @@ -44,18 +43,18 @@ function email_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 3, + 'id' => 26, 'values' => [ - '3' => [ - 'id' => '3', - 'contact_id' => '3', - 'location_type_id' => '6', + '26' => [ + 'id' => '26', + 'contact_id' => '23', + 'location_type_id' => '1', 'email' => 'api@a-team.com', 'is_primary' => '1', 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => '2', 'is_bulkmail' => '', - 'hold_date' => '', + 'hold_date' => '20190820191652', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', @@ -68,22 +67,22 @@ function email_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreateEmail" +* The test that created it is called "testEmailOnHold" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Email/Delete.php b/civicrm/api/v3/examples/Email/Delete.php index 4f10a208cbc013d4ad5153493a2807299359cf0f..b872078fc542cda79c747d9ffcf27d0cc2a7a02d 100644 --- a/civicrm/api/v3/examples/Email/Delete.php +++ b/civicrm/api/v3/examples/Email/Delete.php @@ -7,7 +7,7 @@ */ function email_delete_example() { $params = [ - 'id' => 11, + 'id' => 12, ]; try{ @@ -54,17 +54,17 @@ function email_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Email/Replace.php b/civicrm/api/v3/examples/Email/Replace.php index f85feea54790dcec6572dc0427f5e816dd7a2995..4623896d513a3040fe6e3443a86324462b27004c 100644 --- a/civicrm/api/v3/examples/Email/Replace.php +++ b/civicrm/api/v3/examples/Email/Replace.php @@ -7,30 +7,30 @@ */ function email_replace_example() { $params = [ - 'contact_id' => 9, + 'contact_id' => 17, 'values' => [ '0' => [ - 'location_type_id' => 18, + 'location_type_id' => 34, 'email' => '1-1@example.com', 'is_primary' => 1, ], '1' => [ - 'location_type_id' => 18, + 'location_type_id' => 34, 'email' => '1-2@example.com', 'is_primary' => 0, ], '2' => [ - 'location_type_id' => 18, + 'location_type_id' => 34, 'email' => '1-3@example.com', 'is_primary' => 0, ], '3' => [ - 'location_type_id' => 19, + 'location_type_id' => 35, 'email' => '2-1@example.com', 'is_primary' => 0, ], '4' => [ - 'location_type_id' => 19, + 'location_type_id' => 35, 'email' => '2-2@example.com', 'is_primary' => 0, ], @@ -69,70 +69,70 @@ function email_replace_expectedresult() { 'version' => 3, 'count' => 5, 'values' => [ - '12' => [ - 'id' => '12', - 'contact_id' => '9', - 'location_type_id' => '18', + '13' => [ + 'id' => '13', + 'contact_id' => '17', + 'location_type_id' => '34', 'email' => '1-1@example.com', 'is_primary' => '1', 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', ], - '13' => [ - 'id' => '13', - 'contact_id' => '9', - 'location_type_id' => '18', + '14' => [ + 'id' => '14', + 'contact_id' => '17', + 'location_type_id' => '34', 'email' => '1-2@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', ], - '14' => [ - 'id' => '14', - 'contact_id' => '9', - 'location_type_id' => '18', + '15' => [ + 'id' => '15', + 'contact_id' => '17', + 'location_type_id' => '34', 'email' => '1-3@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', ], - '15' => [ - 'id' => '15', - 'contact_id' => '9', - 'location_type_id' => '19', + '16' => [ + 'id' => '16', + 'contact_id' => '17', + 'location_type_id' => '35', 'email' => '2-1@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', 'signature_text' => '', 'signature_html' => '', ], - '16' => [ - 'id' => '16', - 'contact_id' => '9', - 'location_type_id' => '19', + '17' => [ + 'id' => '17', + 'contact_id' => '17', + 'location_type_id' => '35', 'email' => '2-2@example.com', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -152,17 +152,17 @@ function email_replace_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EmailTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityBatch/Create.php b/civicrm/api/v3/examples/EntityBatch/Create.php index 71bf9bbf30f69c467db69d43cd0aadf3141dcf2a..b2039d6d941619819521c1669a507f9dc49c3c6d 100644 --- a/civicrm/api/v3/examples/EntityBatch/Create.php +++ b/civicrm/api/v3/examples/EntityBatch/Create.php @@ -64,17 +64,17 @@ function entity_batch_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityBatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityBatch/Delete.php b/civicrm/api/v3/examples/EntityBatch/Delete.php index af39a1564b093cebc560df4dc39bf791ee841df3..1c195417e6cb4504f4caf4b7c7977724ea5ca261 100644 --- a/civicrm/api/v3/examples/EntityBatch/Delete.php +++ b/civicrm/api/v3/examples/EntityBatch/Delete.php @@ -54,17 +54,17 @@ function entity_batch_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityBatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityBatch/Get.php b/civicrm/api/v3/examples/EntityBatch/Get.php index fbe65d197ab8555a4c7e826a41f0d4f10f0e4061..20044f5e62db61b80bc2000afdf10d4a2efb3707 100644 --- a/civicrm/api/v3/examples/EntityBatch/Get.php +++ b/civicrm/api/v3/examples/EntityBatch/Get.php @@ -64,17 +64,17 @@ function entity_batch_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityBatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityTag/Delete.php b/civicrm/api/v3/examples/EntityTag/Delete.php index f79f4925efc3d30ede4047d9b1518da4f13c02ee..51ecc823bb7debe407ed9d47fd8901a790265529 100644 --- a/civicrm/api/v3/examples/EntityTag/Delete.php +++ b/civicrm/api/v3/examples/EntityTag/Delete.php @@ -7,8 +7,8 @@ */ function entity_tag_delete_example() { $params = [ - 'contact_id_h' => 31, - 'tag_id' => '15', + 'contact_id_h' => 43, + 'tag_id' => '19', ]; try{ @@ -55,17 +55,17 @@ function entity_tag_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/EntityTag/Get.php b/civicrm/api/v3/examples/EntityTag/Get.php index 94bb042ccc18db6cde711b430f7e681bec26ca45..5312259a604dbeee9bef666ed88d658b7af6b44f 100644 --- a/civicrm/api/v3/examples/EntityTag/Get.php +++ b/civicrm/api/v3/examples/EntityTag/Get.php @@ -7,7 +7,7 @@ */ function entity_tag_get_example() { $params = [ - 'contact_id' => 15, + 'contact_id' => 18, ]; try{ @@ -46,8 +46,8 @@ function entity_tag_get_expectedresult() { '5' => [ 'id' => '5', 'entity_table' => 'civicrm_contact', - 'entity_id' => '15', - 'tag_id' => '10', + 'entity_id' => '18', + 'tag_id' => '11', ], ], ]; @@ -62,17 +62,17 @@ function entity_tag_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EntityTagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/ContactRefCustomField.php b/civicrm/api/v3/examples/Event/ContactRefCustomField.php index 776dcc35a7f2102f6576de0b2e2e2de05b6d49dd..a492401dee38642239b976d8b1cdfa9b826f9c05 100644 --- a/civicrm/api/v3/examples/Event/ContactRefCustomField.php +++ b/civicrm/api/v3/examples/Event/ContactRefCustomField.php @@ -93,17 +93,17 @@ function event_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/Create.php b/civicrm/api/v3/examples/Event/Create.php index b94693c427f9ae3ed111c67e11975b37a8d6c852..0a9977424c9e641cc883b8c05866e2b560d30dbc 100644 --- a/civicrm/api/v3/examples/Event/Create.php +++ b/civicrm/api/v3/examples/Event/Create.php @@ -141,17 +141,17 @@ function event_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/Delete.php b/civicrm/api/v3/examples/Event/Delete.php index 9e50397ccae3fec98481bc432d8ae2046f866e1d..99e53f4ab0baf13ccb69e844d00991e26edf3cdc 100644 --- a/civicrm/api/v3/examples/Event/Delete.php +++ b/civicrm/api/v3/examples/Event/Delete.php @@ -54,17 +54,17 @@ function event_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/Get.php b/civicrm/api/v3/examples/Event/Get.php index a616f289f2fc0954b7e2fdd28423391b312a6a5d..5eb8a9e8713ce0daea6e07367ef4589c82d94043 100644 --- a/civicrm/api/v3/examples/Event/Get.php +++ b/civicrm/api/v3/examples/Event/Get.php @@ -88,17 +88,17 @@ function event_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/IsCurrentOption.php b/civicrm/api/v3/examples/Event/IsCurrentOption.php index 1c3cc7f06b85283cd7df948046932433e951c574..c43d238240a0d1986a51e4bdc5bc8a15222f33c9 100644 --- a/civicrm/api/v3/examples/Event/IsCurrentOption.php +++ b/civicrm/api/v3/examples/Event/IsCurrentOption.php @@ -96,17 +96,17 @@ function event_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Event/IsFullOption.php b/civicrm/api/v3/examples/Event/IsFullOption.php index 4afe21ddc2d5bc91a0b9f97745e68a3bc79203f6..6954a283eb9042cfd42759e8e4126a4d0c65837d 100644 --- a/civicrm/api/v3/examples/Event/IsFullOption.php +++ b/civicrm/api/v3/examples/Event/IsFullOption.php @@ -67,7 +67,7 @@ function event_getsingle_expectedresult() { 'allow_selfcancelxfer' => 0, 'selfcancelxfer_time' => 0, 'is_template' => 0, - 'created_date' => '2017-02-07 02:22:22', + 'created_date' => '2019-08-20 19:17:20', 'is_share' => '1', 'is_confirm_enabled' => '1', 'is_billing_required' => 0, @@ -85,17 +85,17 @@ function event_getsingle_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/EventTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Grant/Create.php b/civicrm/api/v3/examples/Grant/Create.php index ceb0dd71ce78a3ea715c5378e7e7cb7038f8468e..80c79bab87f81a2aedb85f7330e5c6c621701c9f 100644 --- a/civicrm/api/v3/examples/Grant/Create.php +++ b/civicrm/api/v3/examples/Grant/Create.php @@ -80,17 +80,17 @@ function grant_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Grant/Delete.php b/civicrm/api/v3/examples/Grant/Delete.php index 4c0222a01eae9603bf30fbeb56590bcd7fc65e29..8ef84ffc357ee89773c387a581df944f877381fa 100644 --- a/civicrm/api/v3/examples/Grant/Delete.php +++ b/civicrm/api/v3/examples/Grant/Delete.php @@ -54,17 +54,17 @@ function grant_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Grant/Get.php b/civicrm/api/v3/examples/Grant/Get.php index a85ffc2317a9067b51c3385e12fde2a746bf5d11..16692d60bf0bbb2e65ddfedfbf70ed9b990bac4c 100644 --- a/civicrm/api/v3/examples/Grant/Get.php +++ b/civicrm/api/v3/examples/Grant/Get.php @@ -45,7 +45,7 @@ function grant_get_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '5', + 'contact_id' => '3', 'application_received_date' => '20130728084957', 'decision_date' => '20130805000000', 'grant_type_id' => '1', @@ -67,17 +67,17 @@ function grant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GrantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Group/Get.php b/civicrm/api/v3/examples/Group/Get.php index 9c6f7c0e1454783530acce2c71f6ed3e6344aaa5..f2a35bf736e378364db8dacd94653c4337584473 100644 --- a/civicrm/api/v3/examples/Group/Get.php +++ b/civicrm/api/v3/examples/Group/Get.php @@ -41,18 +41,18 @@ function group_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 4, + 'id' => 1, 'values' => [ - '4' => [ - 'id' => '4', + '1' => [ + 'id' => '1', 'name' => 'Test Group 1', 'title' => 'New Test Group Created', 'description' => 'New Test Group Created', 'is_active' => '1', 'visibility' => 'Public Pages', - 'where_clause' => ' ( `civicrm_group_contact-4`.group_id IN ( 4 ) ) ', - 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON (contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.status IN (\'Added\'))\";}', - 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-4`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-4` ON (contact_a.id = `civicrm_group_contact-4`.contact_id AND `civicrm_group_contact-4`.status IN (\'Added\'))\";}', + 'where_clause' => ' ( ( ( `civicrm_group_contact-5d5bbacea0631`.group_id IN (\"1\") ) ) ) ', + 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:37:\"`civicrm_group_contact-5d5bbacea0631`\";s:201:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5d5bbacea0631` ON (contact_a.id = `civicrm_group_contact-5d5bbacea0631`.contact_id AND `civicrm_group_contact-5d5bbacea0631`.status IN (\'Added\'))\";}', + 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:37:\"`civicrm_group_contact-5d5bbacea0631`\";s:201:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5d5bbacea0631` ON (contact_a.id = `civicrm_group_contact-5d5bbacea0631`.contact_id AND `civicrm_group_contact-5d5bbacea0631`.status IN (\'Added\'))\";}', 'group_type' => [ '0' => '1', '1' => '2', @@ -73,17 +73,17 @@ function group_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Group/GetFields.php b/civicrm/api/v3/examples/Group/GetFields.php index a93b6f8754acba82cd7c7b330b0593423be203b8..09d09af2a47b4966e1c18a006d4fb1b77789148a 100644 --- a/civicrm/api/v3/examples/Group/GetFields.php +++ b/civicrm/api/v3/examples/Group/GetFields.php @@ -50,9 +50,12 @@ function group_getfields_expectedresult() { 'title' => 'Group ID', 'description' => 'Group ID', 'required' => TRUE, + 'where' => 'civicrm_group.id', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'group_id', ], @@ -64,9 +67,12 @@ function group_getfields_expectedresult() { 'description' => 'Internal name of Group.', 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_group.name', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'title' => [ 'name' => 'title', @@ -75,9 +81,17 @@ function group_getfields_expectedresult() { 'description' => 'Name of Group.', 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_group.title', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 1, + 'html' => [ + 'type' => 'Text', + 'maxlength' => 64, + 'size' => 30, + ], + 'is_core_field' => TRUE, 'api.required' => 1, ], 'description' => [ @@ -87,14 +101,17 @@ function group_getfields_expectedresult() { 'description' => 'Optional verbose description of the group.', 'rows' => 2, 'cols' => 60, + 'where' => 'civicrm_group.description', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'html' => [ 'type' => 'TextArea', 'rows' => 2, 'cols' => 60, ], + 'is_core_field' => TRUE, ], 'source' => [ 'name' => 'source', @@ -103,19 +120,25 @@ function group_getfields_expectedresult() { 'description' => 'Module or process which created this group.', 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_group.source', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'saved_search_id' => [ 'name' => 'saved_search_id', 'type' => 1, 'title' => 'Saved Search ID', 'description' => 'FK to saved search table.', + 'where' => 'civicrm_group.saved_search_id', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_SavedSearch', + 'is_core_field' => TRUE, 'FKApiName' => 'SavedSearch', ], 'is_active' => [ @@ -123,9 +146,12 @@ function group_getfields_expectedresult() { 'type' => 16, 'title' => 'Group Enabled', 'description' => 'Is this entry active?', + 'where' => 'civicrm_group.is_active', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.default' => 1, ], 'visibility' => [ @@ -135,10 +161,12 @@ function group_getfields_expectedresult() { 'description' => 'In what context(s) is this field visible.', 'maxlength' => 24, 'size' => 20, + 'where' => 'civicrm_group.visibility', 'default' => 'User and User Admin Only', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'maxlength' => 24, @@ -147,33 +175,45 @@ function group_getfields_expectedresult() { 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupVisibility', ], + 'is_core_field' => TRUE, ], 'where_clause' => [ 'name' => 'where_clause', 'type' => 32, 'title' => 'Group Where Clause', 'description' => 'the sql where clause if a saved search acl', + 'where' => 'civicrm_group.where_clause', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'select_tables' => [ 'name' => 'select_tables', 'type' => 32, 'title' => 'Tables For Select Clause', 'description' => 'the tables to be included in a select data', + 'where' => 'civicrm_group.select_tables', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'serialize' => 4, + 'is_core_field' => TRUE, ], 'where_tables' => [ 'name' => 'where_tables', 'type' => 32, 'title' => 'Tables For Where Clause', 'description' => 'the tables to be included in the count statement', + 'where' => 'civicrm_group.where_tables', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'serialize' => 4, + 'is_core_field' => TRUE, ], 'group_type' => [ 'name' => 'group_type', @@ -182,13 +222,17 @@ function group_getfields_expectedresult() { 'description' => 'FK to group type', 'maxlength' => 128, 'size' => 45, + 'where' => 'civicrm_group.group_type', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'serialize' => 1, 'pseudoconstant' => [ 'optionGroupName' => 'group_type', 'optionEditPath' => 'civicrm/admin/options/group_type', ], + 'is_core_field' => TRUE, ], 'cache_date' => [ 'name' => 'cache_date', @@ -196,9 +240,12 @@ function group_getfields_expectedresult() { 'title' => 'Group Cache Date', 'description' => 'Date when we created the cache for a smart group', 'required' => '', + 'where' => 'civicrm_group.cache_date', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'refresh_date' => [ 'name' => 'refresh_date', @@ -206,54 +253,76 @@ function group_getfields_expectedresult() { 'title' => 'Next Group Refresh Time', 'description' => 'Date and time when we need to refresh the cache next.', 'required' => '', + 'where' => 'civicrm_group.refresh_date', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'parents' => [ 'name' => 'parents', 'type' => 32, 'title' => 'Group Parents', 'description' => 'IDs of the parent(s)', + 'where' => 'civicrm_group.parents', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'serialize' => 5, + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_PseudoConstant::allGroup', + ], + 'is_core_field' => TRUE, ], 'children' => [ 'name' => 'children', 'type' => 32, 'title' => 'Group Children', 'description' => 'IDs of the child(ren)', + 'where' => 'civicrm_group.children', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'is_hidden' => [ 'name' => 'is_hidden', 'type' => 16, 'title' => 'Group is Hidden', 'description' => 'Is this group hidden?', + 'where' => 'civicrm_group.is_hidden', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'is_reserved' => [ 'name' => 'is_reserved', 'type' => 16, 'title' => 'Group is Reserved', + 'where' => 'civicrm_group.is_reserved', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'created_id' => [ 'name' => 'created_id', 'type' => 1, 'title' => 'Group Created By', 'description' => 'FK to contact table.', + 'where' => 'civicrm_group.created_id', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], 'modified_id' => [ @@ -261,10 +330,13 @@ function group_getfields_expectedresult() { 'type' => 1, 'title' => 'Group Modified By', 'description' => 'FK to contact table.', + 'where' => 'civicrm_group.modified_id', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], ], @@ -280,17 +352,17 @@ function group_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupContact/Create.php b/civicrm/api/v3/examples/GroupContact/Create.php index 4f8eff192c100142f13ce7fe6cda17b1463e3f93..afb9496b78898a2d0a07dd0375353bc1505bcc4b 100644 --- a/civicrm/api/v3/examples/GroupContact/Create.php +++ b/civicrm/api/v3/examples/GroupContact/Create.php @@ -59,17 +59,17 @@ function group_contact_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupContact/Delete.php b/civicrm/api/v3/examples/GroupContact/Delete.php index b87de53d2a95774e5f47cc613766f11f7690b203..0f4db2245fd60acdb7f1892ea7bf8edc61358225 100644 --- a/civicrm/api/v3/examples/GroupContact/Delete.php +++ b/civicrm/api/v3/examples/GroupContact/Delete.php @@ -58,17 +58,17 @@ function group_contact_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupContact/Get.php b/civicrm/api/v3/examples/GroupContact/Get.php index a8dda828c6ff7a4ed2dcaa1bcc29703da69a41b8..e7718d55111dd51e357723c899c37f3787a750bf 100644 --- a/civicrm/api/v3/examples/GroupContact/Get.php +++ b/civicrm/api/v3/examples/GroupContact/Get.php @@ -65,17 +65,17 @@ function group_contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupContact/GetWithGroupID.php b/civicrm/api/v3/examples/GroupContact/GetWithGroupID.php index e60f16df58722a20a2fb4144f5add341ac97ce84..2607a81f7f92cf32459876e0da5e7c9706970de4 100644 --- a/civicrm/api/v3/examples/GroupContact/GetWithGroupID.php +++ b/civicrm/api/v3/examples/GroupContact/GetWithGroupID.php @@ -65,9 +65,9 @@ function group_contact_get_expectedresult() { 'description' => 'New Test Group Created', 'is_active' => '1', 'visibility' => 'Public Pages', - 'where_clause' => ' ( `civicrm_group_contact-3`.group_id IN ( 3 ) ) ', - 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON (contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.status IN (\'Added\'))\";}', - 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:25:\"`civicrm_group_contact-3`\";s:165:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-3` ON (contact_a.id = `civicrm_group_contact-3`.contact_id AND `civicrm_group_contact-3`.status IN (\'Added\'))\";}', + 'where_clause' => ' ( ( ( `civicrm_group_contact-5d5bbabeb0cbd`.group_id IN (\"3\") ) ) ) ', + 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:37:\"`civicrm_group_contact-5d5bbabeb0cbd`\";s:201:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5d5bbabeb0cbd` ON (contact_a.id = `civicrm_group_contact-5d5bbabeb0cbd`.contact_id AND `civicrm_group_contact-5d5bbabeb0cbd`.status IN (\'Added\'))\";}', + 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:37:\"`civicrm_group_contact-5d5bbabeb0cbd`\";s:201:\" LEFT JOIN civicrm_group_contact `civicrm_group_contact-5d5bbabeb0cbd` ON (contact_a.id = `civicrm_group_contact-5d5bbabeb0cbd`.contact_id AND `civicrm_group_contact-5d5bbabeb0cbd`.status IN (\'Added\'))\";}', 'group_type' => [ '0' => '1', '1' => '2', @@ -91,17 +91,17 @@ function group_contact_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupContactTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupNesting/Create.php b/civicrm/api/v3/examples/GroupNesting/Create.php index f45099640947c7ac1a28b87439fd6e4368ebf4e0..a25f5bb4635792ebdb05cf0d4349cb5a316eb19c 100644 --- a/civicrm/api/v3/examples/GroupNesting/Create.php +++ b/civicrm/api/v3/examples/GroupNesting/Create.php @@ -42,9 +42,13 @@ function group_nesting_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 'is_error', + 'id' => 2, 'values' => [ - 'is_error' => 0, + '2' => [ + 'id' => '2', + 'child_group_id' => '3', + 'parent_group_id' => '1', + ], ], ]; @@ -58,17 +62,17 @@ function group_nesting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupNesting/Delete.php b/civicrm/api/v3/examples/GroupNesting/Delete.php index baaea1baaa2f10d5d12d8a9e8fa838b4d850f7e5..dc99c74c88ed1742cd0ccf9fc2a4b950d516b07a 100644 --- a/civicrm/api/v3/examples/GroupNesting/Delete.php +++ b/civicrm/api/v3/examples/GroupNesting/Delete.php @@ -54,17 +54,17 @@ function group_nesting_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupNesting/Get.php b/civicrm/api/v3/examples/GroupNesting/Get.php index 3e19ef53b1040fa333c2a005f8863fdf5abc6903..40631a5cc314b3557c165605ad2ee6251ab9e9dc 100644 --- a/civicrm/api/v3/examples/GroupNesting/Get.php +++ b/civicrm/api/v3/examples/GroupNesting/Get.php @@ -62,17 +62,17 @@ function group_nesting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupNestingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupOrganization/Create.php b/civicrm/api/v3/examples/GroupOrganization/Create.php index 1a669375783bfff63e8bdf444533cb94fa8429be..9d812d508a9ea8c8fb090a2e2e8ff254439dab1e 100644 --- a/civicrm/api/v3/examples/GroupOrganization/Create.php +++ b/civicrm/api/v3/examples/GroupOrganization/Create.php @@ -41,12 +41,14 @@ function group_organization_create_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 3, + 'count' => 1, 'id' => 3, 'values' => [ - 'id' => '3', - 'group_id' => '6', - 'organization_id' => '8', + '3' => [ + 'id' => '3', + 'group_id' => '6', + 'organization_id' => '8', + ], ], ]; @@ -60,17 +62,17 @@ function group_organization_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupOrganization/Delete.php b/civicrm/api/v3/examples/GroupOrganization/Delete.php index 79f776f3b07d5aecc12fbd890bb64eb1f92fd90b..722934bf19da7e172d8e4dd3cd97ffedec1f4718 100644 --- a/civicrm/api/v3/examples/GroupOrganization/Delete.php +++ b/civicrm/api/v3/examples/GroupOrganization/Delete.php @@ -54,17 +54,17 @@ function group_organization_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/GroupOrganization/Get.php b/civicrm/api/v3/examples/GroupOrganization/Get.php index 1ebfc68c3fefeeb23dfea5ec837dc5a13609d0bf..500c215a7942b68bf7f434abffcfea57cecc4f93 100644 --- a/civicrm/api/v3/examples/GroupOrganization/Get.php +++ b/civicrm/api/v3/examples/GroupOrganization/Get.php @@ -54,17 +54,17 @@ function group_organization_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/GroupOrganizationTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Im/Create.php b/civicrm/api/v3/examples/Im/Create.php index c32a2ea5f8ee0af3a47277da8ef23e4e1493ea90..dda5c2ccf6c7aa0e81f4fd2fd18c00d4fbf9262c 100644 --- a/civicrm/api/v3/examples/Im/Create.php +++ b/civicrm/api/v3/examples/Im/Create.php @@ -7,9 +7,8 @@ */ function im_create_example() { $params = [ - 'contact_id' => 3, + 'contact_id' => 5, 'name' => 'My Yahoo IM Handle', - 'location_type_id' => 1, 'provider_id' => 1, ]; @@ -44,11 +43,11 @@ function im_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 2, 'values' => [ - '1' => [ - 'id' => '1', - 'contact_id' => '3', + '2' => [ + 'id' => '2', + 'contact_id' => '5', 'location_type_id' => '1', 'name' => 'My Yahoo IM Handle', 'provider_id' => '1', @@ -63,22 +62,22 @@ function im_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreateIm" +* The test that created it is called "testCreateImDefaultLocation" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Im/Delete.php b/civicrm/api/v3/examples/Im/Delete.php index 81438d73021258cef35833dd5c028e33dc78671d..975bfac70bafe37da1c658a029a0983d24267310 100644 --- a/civicrm/api/v3/examples/Im/Delete.php +++ b/civicrm/api/v3/examples/Im/Delete.php @@ -7,7 +7,7 @@ */ function im_delete_example() { $params = [ - 'id' => 3, + 'id' => 4, ]; try{ @@ -54,17 +54,17 @@ function im_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Im/Get.php b/civicrm/api/v3/examples/Im/Get.php index 90d23fe359068924199bf996d0ac36c833713b37..e2cacaad3f877f7d389de9ff2cd34528c1f51d6a 100644 --- a/civicrm/api/v3/examples/Im/Get.php +++ b/civicrm/api/v3/examples/Im/Get.php @@ -7,7 +7,7 @@ */ function im_get_example() { $params = [ - 'contact_id' => 4, + 'contact_id' => 7, 'name' => 'My Yahoo IM Handle', 'location_type_id' => 1, 'provider_id' => 1, @@ -44,11 +44,11 @@ function im_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 3, 'values' => [ - '2' => [ - 'id' => '2', - 'contact_id' => '4', + '3' => [ + 'id' => '3', + 'contact_id' => '7', 'location_type_id' => '1', 'name' => 'My Yahoo IM Handle', 'provider_id' => '1', @@ -68,17 +68,17 @@ function im_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ImTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Job/Clone.php b/civicrm/api/v3/examples/Job/Clone.php new file mode 100644 index 0000000000000000000000000000000000000000..b2235b8854cc0d35c2d449ace52f9a3fad82496e --- /dev/null +++ b/civicrm/api/v3/examples/Job/Clone.php @@ -0,0 +1,83 @@ +<?php +/** + * Test Generated example demonstrating the Job.clone API. + * + * @return array + * API result array + */ +function job_clone_example() { + $params = [ + 'id' => 31, + ]; + + try{ + $result = civicrm_api3('Job', 'clone', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function job_clone_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 32, + 'values' => [ + '32' => [ + 'id' => '32', + 'domain_id' => '1', + 'run_frequency' => 'Daily', + 'name' => 'API_Test_Job - Copy', + 'description' => 'A long description written by hand in cursive', + 'api_entity' => 'ApiTestEntity', + 'api_action' => 'apitestaction', + 'parameters' => 'Semi-formal explanation of runtime job parameters', + 'is_active' => '1', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testClone" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Job/Create.php b/civicrm/api/v3/examples/Job/Create.php index 3e64c91d75df1949c9cf29905948105e491bc442..5109836ee969332817766c67668ead950c8f09e0 100644 --- a/civicrm/api/v3/examples/Job/Create.php +++ b/civicrm/api/v3/examples/Job/Create.php @@ -76,17 +76,17 @@ function job_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Job/Delete.php b/civicrm/api/v3/examples/Job/Delete.php index 3fb114359874c5ad84b83e4ddfc7dde3de4f50f4..6bbd95169abda387fad383d3ab77248fe34d7bce 100644 --- a/civicrm/api/v3/examples/Job/Delete.php +++ b/civicrm/api/v3/examples/Job/Delete.php @@ -7,7 +7,7 @@ */ function job_delete_example() { $params = [ - 'id' => 31, + 'id' => 33, ]; try{ @@ -49,17 +49,17 @@ function job_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/JobTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LineItem/Create.php b/civicrm/api/v3/examples/LineItem/Create.php index 44d22760961cf0b539be2acf2ecd590a20c13e4d..050bcfa25deeeed5e8c805d9e0fca58fef83ec9c 100644 --- a/civicrm/api/v3/examples/LineItem/Create.php +++ b/civicrm/api/v3/examples/LineItem/Create.php @@ -79,17 +79,17 @@ function line_item_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LineItem/Delete.php b/civicrm/api/v3/examples/LineItem/Delete.php index 2381abb56257426bbdfe9646148f8e8f024fe5a5..a84be8f5606beeda4407bb4df23473b1701052b7 100644 --- a/civicrm/api/v3/examples/LineItem/Delete.php +++ b/civicrm/api/v3/examples/LineItem/Delete.php @@ -54,17 +54,17 @@ function line_item_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LineItem/Get.php b/civicrm/api/v3/examples/LineItem/Get.php index 68a319605bf014682050e4135d607e2a98868ee4..2e5d7fa2ecddf6f9bad2978265638cede7dc9230 100644 --- a/civicrm/api/v3/examples/LineItem/Get.php +++ b/civicrm/api/v3/examples/LineItem/Get.php @@ -71,17 +71,17 @@ function line_item_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LineItemTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LocBlock/Create.php b/civicrm/api/v3/examples/LocBlock/Create.php index 723137931ccc0884f97b848eebf6700a1b534b35..b752ec02a6e097a04bab6e91be254fa1ac6e2171 100644 --- a/civicrm/api/v3/examples/LocBlock/Create.php +++ b/civicrm/api/v3/examples/LocBlock/Create.php @@ -71,17 +71,17 @@ function loc_block_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LocBlock/CreateEntities.php b/civicrm/api/v3/examples/LocBlock/CreateEntities.php index 2cb6213339880c16542d7c08fad3ab8ef6271bb5..1ac4588448827d97a2098c0a5f0fb288f53dcd47 100644 --- a/civicrm/api/v3/examples/LocBlock/CreateEntities.php +++ b/civicrm/api/v3/examples/LocBlock/CreateEntities.php @@ -76,7 +76,7 @@ function loc_block_create_expectedresult() { 'email' => 'test2@loc.block', 'is_primary' => 0, 'is_billing' => '', - 'on_hold' => '', + 'on_hold' => 0, 'is_bulkmail' => '', 'hold_date' => '', 'reset_date' => '', @@ -130,17 +130,17 @@ function loc_block_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/LocBlock/Get.php b/civicrm/api/v3/examples/LocBlock/Get.php index dccde31f7b9ec353c50f5e24e93fc636ed6a2bed..926c03d45eb5ff140f19d686576d02b04600014d 100644 --- a/civicrm/api/v3/examples/LocBlock/Get.php +++ b/civicrm/api/v3/examples/LocBlock/Get.php @@ -99,17 +99,17 @@ function loc_block_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LocBlockTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Logging/Get.php b/civicrm/api/v3/examples/Logging/Get.php index f6d921898b62f04f6bae2c8096c7a6472dcfa1ce..a0a26f4c254e2d8393887d9e3796fc23392a0fa7 100644 --- a/civicrm/api/v3/examples/Logging/Get.php +++ b/civicrm/api/v3/examples/Logging/Get.php @@ -49,7 +49,7 @@ function logging_get_expectedresult() { 'from' => 'Anderson, Anthony', 'to' => 'Dwarf, Dopey', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '1' => [ @@ -59,7 +59,7 @@ function logging_get_expectedresult() { 'from' => 'Mr. Anthony Anderson II', 'to' => 'Mr. Dopey Dwarf II', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '2' => [ @@ -69,7 +69,7 @@ function logging_get_expectedresult() { 'from' => 'Anthony', 'to' => 'Dopey', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '3' => [ @@ -79,17 +79,17 @@ function logging_get_expectedresult() { 'from' => 'Anderson', 'to' => 'Dwarf', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '4' => [ 'action' => 'Update', 'id' => '3', 'field' => 'modified_date', - 'from' => '2017-02-07 02:36:28', - 'to' => '2017-02-07 02:36:46', + 'from' => '2019-08-20 19:23:20', + 'to' => '2019-08-20 19:23:24', 'table' => 'civicrm_contact', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:24', 'log_conn_id' => 'wooty wop wop', ], '5' => [ @@ -99,7 +99,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '2', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '6' => [ @@ -109,7 +109,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '3', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '7' => [ @@ -117,9 +117,9 @@ function logging_get_expectedresult() { 'id' => '2', 'field' => 'location_type_id', 'from' => '', - 'to' => '', + 'to' => '1', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '8' => [ @@ -129,7 +129,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 'dopey@mail.com', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '9' => [ @@ -139,7 +139,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 0, 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '10' => [ @@ -149,7 +149,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 0, 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '11' => [ @@ -159,7 +159,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 0, 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '12' => [ @@ -169,7 +169,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => 0, 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '13' => [ @@ -179,7 +179,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '14' => [ @@ -189,7 +189,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '15' => [ @@ -199,7 +199,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], '16' => [ @@ -209,7 +209,7 @@ function logging_get_expectedresult() { 'from' => '', 'to' => '', 'table' => 'civicrm_email', - 'log_date' => '2017-02-07 02:36:46', + 'log_date' => '2019-08-20 19:23:25', 'log_conn_id' => 'wooty wop wop', ], ], @@ -225,17 +225,17 @@ function logging_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/LoggingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Logging/Revert.php b/civicrm/api/v3/examples/Logging/Revert.php index 01642fc870b2c99069035c402953e7a46886c937..32fa318ff29c4dcbe28e8ea5a3429e1a0480500c 100644 --- a/civicrm/api/v3/examples/Logging/Revert.php +++ b/civicrm/api/v3/examples/Logging/Revert.php @@ -8,7 +8,7 @@ function logging_revert_example() { $params = [ 'log_conn_id' => 'woot', - 'log_date' => '2017-02-07 02:35:06', + 'log_date' => '2019-08-20 19:22:48', ]; try{ @@ -50,22 +50,22 @@ function logging_revert_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "/Users/emcnaughton/buildkit/build/dmaster/sites/all/modules/civicrm/tests/phpunit/api/v3/LoggingTest.php" +* The test that created it is called "/home/seamus/buildkit/build/47-test/sites/all/modules/civicrm/tests/phpunit/api/v3/LoggingTest.php" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/Revert * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/ChainedGetDelete.php b/civicrm/api/v3/examples/MailSettings/ChainedGetDelete.php index 966d269684030e98608589ea4d4a1fa999e0db5f..b243259d28de2ccb12d21f868baf5abd8aea5f8e 100644 --- a/civicrm/api/v3/examples/MailSettings/ChainedGetDelete.php +++ b/civicrm/api/v3/examples/MailSettings/ChainedGetDelete.php @@ -9,7 +9,7 @@ */ function mail_settings_get_example() { $params = [ - 'title' => 'MailSettings title', + 'name' => 'delete this setting', 'api.MailSettings.delete' => 1, ]; @@ -43,27 +43,16 @@ function mail_settings_get_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 2, + 'count' => 1, + 'id' => 6, 'values' => [ - '1' => [ - 'id' => '1', - 'domain_id' => '1', - 'name' => 'default', - 'is_default' => 0, - 'domain' => 'EXAMPLE.ORG', - 'api.MailSettings.delete' => [ - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'values' => 1, - ], - ], '6' => [ 'id' => '6', 'domain_id' => '1', - 'name' => 'my mail setting', + 'name' => 'delete this setting', 'is_default' => '1', 'domain' => 'setting.com', + 'localpart' => 'civicrm+', 'server' => 'localhost', 'username' => 'sue', 'password' => 'pass', @@ -88,17 +77,17 @@ function mail_settings_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/Create.php b/civicrm/api/v3/examples/MailSettings/Create.php index 43fbf4385668766fad205dbffeea32cc7d794ac4..08eba6659768c6ea01ff2025aa592b9b96e73267 100644 --- a/civicrm/api/v3/examples/MailSettings/Create.php +++ b/civicrm/api/v3/examples/MailSettings/Create.php @@ -10,7 +10,7 @@ function mail_settings_create_example() { 'domain_id' => 1, 'name' => 'my mail setting', 'domain' => 'setting.com', - 'local_part' => 'civicrm+', + 'localpart' => 'civicrm+', 'server' => 'localhost', 'username' => 'sue', 'password' => 'pass', @@ -56,7 +56,7 @@ function mail_settings_create_expectedresult() { 'name' => 'my mail setting', 'is_default' => '1', 'domain' => 'setting.com', - 'localpart' => '', + 'localpart' => 'civicrm+', 'return_path' => '', 'protocol' => '', 'server' => 'localhost', @@ -65,6 +65,7 @@ function mail_settings_create_expectedresult() { 'password' => 'pass', 'is_ssl' => '', 'source' => '', + 'activity_status' => '', ], ], ]; @@ -79,17 +80,17 @@ function mail_settings_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/Delete.php b/civicrm/api/v3/examples/MailSettings/Delete.php index a1cc7a50b457ef25d1e67d281a2c88b23138a971..dbfc74cfc5f864c4851de0f7e0420f20f3ae906d 100644 --- a/civicrm/api/v3/examples/MailSettings/Delete.php +++ b/civicrm/api/v3/examples/MailSettings/Delete.php @@ -54,17 +54,17 @@ function mail_settings_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/Get.php b/civicrm/api/v3/examples/MailSettings/Get.php index 19c75bb4be14df071aef2d13fc9064ce7ed7a004..42d80d7c2e0513e0ba3de7d21b2d243693a2ea9b 100644 --- a/civicrm/api/v3/examples/MailSettings/Get.php +++ b/civicrm/api/v3/examples/MailSettings/Get.php @@ -10,7 +10,7 @@ function mail_settings_get_example() { 'domain_id' => 1, 'name' => 'my mail setting', 'domain' => 'setting.com', - 'local_part' => 'civicrm+', + 'localpart' => 'civicrm+', 'server' => 'localhost', 'username' => 'sue', 'password' => 'pass', @@ -56,6 +56,7 @@ function mail_settings_get_expectedresult() { 'name' => 'my mail setting', 'is_default' => '1', 'domain' => 'setting.com', + 'localpart' => 'civicrm+', 'server' => 'localhost', 'username' => 'sue', 'password' => 'pass', @@ -74,17 +75,17 @@ function mail_settings_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailSettingsTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailSettings/GetOptions.php b/civicrm/api/v3/examples/MailSettings/GetOptions.php index 5a8de53942555a569a312661836eb32315a181a7..a1c39a2fcb59cb00c0179e4dfdb159e4c4ac671d 100644 --- a/civicrm/api/v3/examples/MailSettings/GetOptions.php +++ b/civicrm/api/v3/examples/MailSettings/GetOptions.php @@ -59,17 +59,17 @@ function mail_settings_getoptions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/Clone.php b/civicrm/api/v3/examples/Mailing/Clone.php index 7d5c86c2c57f511bd7fbc95e8913fec8bf39937e..46b12fa62bd916cf9db5ba83b5bafadc0aaaedb3 100644 --- a/civicrm/api/v3/examples/Mailing/Clone.php +++ b/civicrm/api/v3/examples/Mailing/Clone.php @@ -7,7 +7,7 @@ */ function mailing_clone_example() { $params = [ - 'id' => 21, + 'id' => 27, ]; try{ @@ -41,10 +41,10 @@ function mailing_clone_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 22, + 'id' => 28, 'values' => [ - '22' => [ - 'id' => '22', + '28' => [ + 'id' => '28', 'domain_id' => '1', 'header_id' => '1', 'footer_id' => '2', @@ -63,7 +63,7 @@ function mailing_clone_expectedresult() { 'body_text' => 'This is {contact.display_name}. https://civicrm.org {domain.address}{action.optOutUrl}', - 'body_html' => '<p>This is {contact.display_name}.</p><p><a href=\'https://civicrm.org/\'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>', + 'body_html' => '<link href=\'https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Zilla+Slab:500,700\' rel=\'stylesheet\' type=\'text/css\'><p><a href=\"http://{action.forward}\">Forward this email</a><a href=\"{action.forward}\">Forward this email with no protocol</a></p<p>This is {contact.display_name}.</p><p><a href=\'https://civicrm.org/\'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>', 'url_tracking' => '1', 'forward_replies' => 0, 'auto_responder' => 0, @@ -71,15 +71,16 @@ https://civicrm.org 'is_completed' => '', 'msg_template_id' => '', 'override_verp' => '1', - 'created_id' => '147', + 'created_id' => '154', 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', 'scheduled_id' => '', 'scheduled_date' => '', 'approver_id' => '', 'approval_date' => '', 'approval_status_id' => '', 'approval_note' => '', - 'is_archived' => '', + 'is_archived' => 0, 'visibility' => 'Public Pages', 'campaign_id' => '', 'dedupe_email' => '1', @@ -102,17 +103,17 @@ https://civicrm.org * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/Create.php b/civicrm/api/v3/examples/Mailing/Create.php index 026d9fc2c1136ef86f91f68bccf867c401f8a1f0..6562c989a03e56ceeaad28f7ddb951f5d6287a2a 100644 --- a/civicrm/api/v3/examples/Mailing/Create.php +++ b/civicrm/api/v3/examples/Mailing/Create.php @@ -11,17 +11,17 @@ function mailing_create_example() { 'body_text' => 'This is {contact.display_name}. https://civicrm.org {domain.address}{action.optOutUrl}', - 'body_html' => '<p>This is {contact.display_name}.</p><p><a href=\'https://civicrm.org/\'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>', + 'body_html' => '<link href=\'https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Zilla+Slab:500,700\' rel=\'stylesheet\' type=\'text/css\'><p><a href=\"http://{action.forward}\">Forward this email</a><a href=\"{action.forward}\">Forward this email with no protocol</a></p<p>This is {contact.display_name}.</p><p><a href=\'https://civicrm.org/\'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>', 'name' => 'mailing name', - 'created_id' => 3, + 'created_id' => 15, 'header_id' => '', 'footer_id' => '', 'groups' => [ 'include' => [ - '0' => 2, + '0' => 13, ], 'exclude' => [ - '0' => 3, + '0' => 14, ], ], 'mailings' => [ @@ -31,7 +31,6 @@ https://civicrm.org 'options' => [ 'force_rollback' => 1, ], - 'api.mailing_job.create' => 1, 'api.MailingRecipients.get' => [ 'mailing_id' => '$value.id', 'api.contact.getvalue' => [ @@ -74,10 +73,10 @@ function mailing_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 9, 'values' => [ - '1' => [ - 'id' => '1', + '9' => [ + 'id' => '9', 'domain_id' => '1', 'header_id' => '', 'footer_id' => '', @@ -90,69 +89,49 @@ function mailing_create_expectedresult() { 'from_name' => 'FIXME', 'from_email' => 'info@EXAMPLE.ORG', 'replyto_email' => 'info@EXAMPLE.ORG', - 'template_type' => '', + 'template_type' => 'traditional', 'template_options' => '', 'subject' => 'Hello {contact.display_name}', 'body_text' => 'This is {contact.display_name}. https://civicrm.org {domain.address}{action.optOutUrl}', - 'body_html' => '<p>This is {contact.display_name}.</p><p><a href=\'https://civicrm.org/\'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>', + 'body_html' => '<link href=\'https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700|Zilla+Slab:500,700\' rel=\'stylesheet\' type=\'text/css\'><p><a href=\"http://{action.forward}\">Forward this email</a><a href=\"{action.forward}\">Forward this email with no protocol</a></p<p>This is {contact.display_name}.</p><p><a href=\'https://civicrm.org/\'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>', 'url_tracking' => '1', - 'forward_replies' => '', - 'auto_responder' => '', + 'forward_replies' => 0, + 'auto_responder' => 0, 'open_tracking' => '1', 'is_completed' => '', 'msg_template_id' => '', 'override_verp' => '1', - 'created_id' => '3', + 'created_id' => '15', 'created_date' => '2013-07-28 08:49:19', + 'modified_date' => '2012-11-14 16:02:35', 'scheduled_id' => '', 'scheduled_date' => '', 'approver_id' => '', 'approval_date' => '', 'approval_status_id' => '', 'approval_note' => '', - 'is_archived' => '', + 'is_archived' => 0, 'visibility' => 'Public Pages', 'campaign_id' => '', 'dedupe_email' => '1', 'sms_provider_id' => '', 'hash' => '', 'location_type_id' => '', - 'email_selection_method' => '', + 'email_selection_method' => 'automatic', 'language' => '', - 'api.mailing_job.create' => [ - 'is_error' => 0, - 'version' => 3, - 'count' => 1, - 'id' => 1, - 'values' => [ - '0' => [ - 'id' => '1', - 'mailing_id' => '1', - 'scheduled_date' => '20130728085413', - 'start_date' => '', - 'end_date' => '', - 'status' => 'Scheduled', - 'is_test' => 0, - 'job_type' => '', - 'parent_id' => '', - 'job_offset' => '', - 'job_limit' => '', - ], - ], - ], 'api.MailingRecipients.get' => [ 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 4, 'values' => [ '0' => [ - 'id' => '1', - 'mailing_id' => '1', - 'contact_id' => '4', - 'email_id' => '4', + 'id' => '4', + 'mailing_id' => '9', + 'contact_id' => '16', + 'email_id' => '16', 'api.contact.getvalue' => 'Mr. Includer Person II', 'api.email.getvalue' => 'include.me@example.org', ], @@ -172,17 +151,17 @@ https://civicrm.org * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/Delete.php b/civicrm/api/v3/examples/Mailing/Delete.php index b2df37d02a208f9537bd6a542feabae0f1e44072..b0070b6eb47e1ac8a7e28000ee072a4885ba213d 100644 --- a/civicrm/api/v3/examples/Mailing/Delete.php +++ b/civicrm/api/v3/examples/Mailing/Delete.php @@ -7,7 +7,7 @@ */ function mailing_delete_example() { $params = [ - 'id' => 20, + 'id' => 26, ]; try{ @@ -54,17 +54,17 @@ function mailing_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/GetTokens.php b/civicrm/api/v3/examples/Mailing/GetTokens.php index 856e27952707b582bc06289722a1e8d4115cabc4..bc343a42370cd871275f684aeece211d374cd38f 100644 --- a/civicrm/api/v3/examples/Mailing/GetTokens.php +++ b/civicrm/api/v3/examples/Mailing/GetTokens.php @@ -46,7 +46,7 @@ function mailing_gettokens_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 82, + 'count' => 88, 'values' => [ '{action.unsubscribe}' => 'Unsubscribe via email', '{action.unsubscribeUrl}' => 'Unsubscribe via web page', @@ -88,6 +88,9 @@ function mailing_gettokens_expectedresult() { '{contact.individual_suffix}' => 'Individual Suffix', '{contact.formal_title}' => 'Formal Title', '{contact.communication_style}' => 'Communication Style', + '{contact.email_greeting_id}' => 'Email Greeting ID', + '{contact.postal_greeting_id}' => 'Postal Greeting ID', + '{contact.addressee_id}' => 'Addressee ID', '{contact.job_title}' => 'Job Title', '{contact.gender}' => 'Gender', '{contact.birth_date}' => 'Birth Date', @@ -113,6 +116,7 @@ function mailing_gettokens_expectedresult() { '{contact.postal_code}' => 'Postal Code', '{contact.geo_code_1}' => 'Latitude', '{contact.geo_code_2}' => 'Longitude', + '{contact.manual_geo_code}' => 'Is Manually Geocoded', '{contact.address_name}' => 'Address Name', '{contact.master_id}' => 'Master Address Belongs To', '{contact.county}' => 'County', @@ -120,6 +124,7 @@ function mailing_gettokens_expectedresult() { '{contact.country}' => 'Country', '{contact.phone}' => 'Phone', '{contact.phone_ext}' => 'Phone Extension', + '{contact.phone_type_id}' => 'Phone Type', '{contact.email}' => 'Email', '{contact.on_hold}' => 'On Hold', '{contact.signature_text}' => 'Signature Text', @@ -144,17 +149,17 @@ function mailing_gettokens_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mailing/Submit.php b/civicrm/api/v3/examples/Mailing/Submit.php index d2971de198c3fbb7b87c5aedc267fbfc7a9194a5..059ac070e757e318086a7f75a281e96c0a159c9c 100644 --- a/civicrm/api/v3/examples/Mailing/Submit.php +++ b/civicrm/api/v3/examples/Mailing/Submit.php @@ -9,7 +9,7 @@ function mailing_submit_example() { $params = [ 'scheduled_date' => '2014-12-13 10:00:00', 'approval_date' => '2014-12-13 00:00:00', - 'id' => 18, + 'id' => 22, ]; try{ @@ -43,13 +43,13 @@ function mailing_submit_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 18, + 'id' => 22, 'values' => [ - '18' => [ - 'id' => '18', + '22' => [ + 'id' => '22', 'domain_id' => '1', 'header_id' => '', - 'footer_id' => '27', + 'footer_id' => '31', 'reply_id' => '8', 'unsubscribe_id' => '5', 'resubscribe_id' => '6', @@ -73,11 +73,12 @@ https://civicrm.org 'is_completed' => '', 'msg_template_id' => '', 'override_verp' => '1', - 'created_id' => '40', + 'created_id' => '45', 'created_date' => '2013-07-28 08:49:19', - 'scheduled_id' => '41', + 'modified_date' => '2012-11-14 16:02:35', + 'scheduled_id' => '46', 'scheduled_date' => '20130728085413', - 'approver_id' => '41', + 'approver_id' => '46', 'approval_date' => '20130728085413', 'approval_status_id' => '1', 'approval_note' => '', @@ -104,17 +105,17 @@ https://civicrm.org * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailingAB/Create.php b/civicrm/api/v3/examples/MailingAB/Create.php index 735ad9ca37efb6ceae2eb840e0f75d4813f4658b..8a53d6ca71403ee0b606421e7ba40413f85157fc 100644 --- a/civicrm/api/v3/examples/MailingAB/Create.php +++ b/civicrm/api/v3/examples/MailingAB/Create.php @@ -60,7 +60,7 @@ function mailing_a_b_create_expectedresult() { 'testing_criteria' => 'subject', 'winner_criteria' => 'open', 'specific_url' => '', - 'declare_winning_time' => '20170209023708', + 'declare_winning_time' => '20190822192332', 'group_percentage' => '10', 'created_id' => '3', 'created_date' => '2013-07-28 08:49:19', @@ -78,17 +78,17 @@ function mailing_a_b_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingABTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MailingEventSubscribe/Create.php b/civicrm/api/v3/examples/MailingEventSubscribe/Create.php index a36db91cb57234e722ac178df8c4dc47b2723446..01a5127b752eac178f8e7ae6702ab0f78293eb40 100644 --- a/civicrm/api/v3/examples/MailingEventSubscribe/Create.php +++ b/civicrm/api/v3/examples/MailingEventSubscribe/Create.php @@ -65,17 +65,17 @@ function mailing_event_subscribe_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mapping/Create.php b/civicrm/api/v3/examples/Mapping/Create.php index cfeb6060a5a006723b4ecc70b26255327d288707..4d5258489b12c0441aafa5c46c0a867329db923e 100644 --- a/civicrm/api/v3/examples/Mapping/Create.php +++ b/civicrm/api/v3/examples/Mapping/Create.php @@ -64,17 +64,17 @@ function mapping_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mapping/Delete.php b/civicrm/api/v3/examples/Mapping/Delete.php index 41b355bb331e92a66d4b6397d8997238bb5240e1..33529d7cb3861fc1d7b5f17bd85ef4f7e4d8ea22 100644 --- a/civicrm/api/v3/examples/Mapping/Delete.php +++ b/civicrm/api/v3/examples/Mapping/Delete.php @@ -54,17 +54,17 @@ function mapping_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Mapping/Get.php b/civicrm/api/v3/examples/Mapping/Get.php index 2235f5075edaebb7353ec71e78206c8b8903480d..96161bb1d3585641df0340006c3499f81de155c5 100644 --- a/civicrm/api/v3/examples/Mapping/Get.php +++ b/civicrm/api/v3/examples/Mapping/Get.php @@ -64,17 +64,17 @@ function mapping_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MappingField/Create.php b/civicrm/api/v3/examples/MappingField/Create.php index 093863a69b9fa78365a536681a7ebb31afa34035..2841970b27864f779cf503719a861a038c94ea79 100644 --- a/civicrm/api/v3/examples/MappingField/Create.php +++ b/civicrm/api/v3/examples/MappingField/Create.php @@ -76,17 +76,17 @@ function mapping_field_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MappingField/Delete.php b/civicrm/api/v3/examples/MappingField/Delete.php index ddc050529d257f7b1142cf17f2db36386bf671d6..0dad4e6fd5c30d4e2ce80520c75226216c7ed2c6 100644 --- a/civicrm/api/v3/examples/MappingField/Delete.php +++ b/civicrm/api/v3/examples/MappingField/Delete.php @@ -54,17 +54,17 @@ function mapping_field_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MappingField/Get.php b/civicrm/api/v3/examples/MappingField/Get.php index 8fac202097cdd2cfb93e7d094e3512d22e7eda81..a2fa16de315086a676185092aed6fa7be452e109 100644 --- a/civicrm/api/v3/examples/MappingField/Get.php +++ b/civicrm/api/v3/examples/MappingField/Get.php @@ -68,17 +68,17 @@ function mapping_field_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MappingFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/Create.php b/civicrm/api/v3/examples/Membership/Create.php index 7285304133fc900728ccdbd344d457df502b18d8..091043fb855a5cd37b34f32a773400bd457a2036 100644 --- a/civicrm/api/v3/examples/Membership/Create.php +++ b/civicrm/api/v3/examples/Membership/Create.php @@ -7,14 +7,14 @@ */ function membership_create_example() { $params = [ - 'contact_id' => 79, - 'membership_type_id' => 47, + 'contact_id' => 3, + 'membership_type_id' => 1, 'join_date' => '2006-01-21', 'start_date' => '2006-01-21', 'end_date' => '2006-12-21', 'source' => 'Payment', 'is_override' => 1, - 'status_id' => 30, + 'status_id' => 31, ]; try{ @@ -52,14 +52,15 @@ function membership_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '79', - 'membership_type_id' => '47', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '20060121000000', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '30', + 'status_id' => '31', 'is_override' => '1', + 'status_override_end_date' => '', 'owner_membership_id' => '', 'max_related' => '', 'is_test' => 0, @@ -80,17 +81,17 @@ function membership_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/CreateWithCustomData.php b/civicrm/api/v3/examples/Membership/CreateWithCustomData.php index 13651a3c9522b5c0068198626031d3e9683ab017..8a108197c9d629657b75c8e780c7cc0f71fb762b 100644 --- a/civicrm/api/v3/examples/Membership/CreateWithCustomData.php +++ b/civicrm/api/v3/examples/Membership/CreateWithCustomData.php @@ -7,14 +7,14 @@ */ function membership_create_example() { $params = [ - 'contact_id' => 91, - 'membership_type_id' => 55, + 'contact_id' => 3, + 'membership_type_id' => 1, 'join_date' => '2009-01-21', 'start_date' => '2009-01-21', 'end_date' => '2009-12-21', 'source' => 'Payment', 'is_override' => 1, - 'status_id' => 34, + 'status_id' => 35, 'custom_1' => 'custom string', ]; @@ -53,14 +53,15 @@ function membership_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '91', - 'membership_type_id' => '55', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '20090121000000', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '34', + 'status_id' => '35', 'is_override' => '1', + 'status_override_end_date' => '', 'owner_membership_id' => '', 'max_related' => '', 'is_test' => 0, @@ -81,17 +82,17 @@ function membership_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/Delete.php b/civicrm/api/v3/examples/Membership/Delete.php index 75e906612257d08ead69fefbc37c42312bf4f3ff..fdc16636eb45a1d65faf7684cf27f187dbcc8f26 100644 --- a/civicrm/api/v3/examples/Membership/Delete.php +++ b/civicrm/api/v3/examples/Membership/Delete.php @@ -55,17 +55,17 @@ function membership_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/FilterIsCurrent.php b/civicrm/api/v3/examples/Membership/FilterIsCurrent.php index 6ab53bdccfdc71d9a1d39b3c35cb856078fdfc9c..fba84157ee99b505d0f70b605dcb5cbc23f006c5 100644 --- a/civicrm/api/v3/examples/Membership/FilterIsCurrent.php +++ b/civicrm/api/v3/examples/Membership/FilterIsCurrent.php @@ -9,7 +9,7 @@ */ function membership_get_example() { $params = [ - 'contact_id' => 47, + 'contact_id' => 3, 'filters' => [ 'is_current' => 1, ], @@ -50,13 +50,13 @@ function membership_get_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '47', - 'membership_type_id' => '29', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '2009-01-21', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '22', + 'status_id' => '23', 'is_override' => '1', 'is_test' => 0, 'is_pay_later' => 0, @@ -76,17 +76,17 @@ function membership_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/Get.php b/civicrm/api/v3/examples/Membership/Get.php index cb6c5aa4bbb82ec4e57cfd9c985f60fce43edf28..1fb614344e7396a02ebca00178d460627f57d97a 100644 --- a/civicrm/api/v3/examples/Membership/Get.php +++ b/civicrm/api/v3/examples/Membership/Get.php @@ -7,7 +7,7 @@ */ function membership_get_example() { $params = [ - 'membership_type_id' => 23, + 'membership_type_id' => 1, ]; try{ @@ -45,13 +45,13 @@ function membership_get_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '38', - 'membership_type_id' => '23', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '2009-01-21', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '19', + 'status_id' => '20', 'is_override' => '1', 'is_test' => 0, 'is_pay_later' => 0, @@ -73,17 +73,17 @@ function membership_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/SearchWithCustomData.php b/civicrm/api/v3/examples/Membership/SearchWithCustomData.php index be147d722d3c707345dedab2ed3bcfbf1d536972..b287131e78fb09add8455fc2bd3ada06a11bc4aa 100644 --- a/civicrm/api/v3/examples/Membership/SearchWithCustomData.php +++ b/civicrm/api/v3/examples/Membership/SearchWithCustomData.php @@ -7,14 +7,14 @@ */ function membership_create_example() { $params = [ - 'contact_id' => 94, - 'membership_type_id' => 57, + 'contact_id' => 3, + 'membership_type_id' => 1, 'join_date' => '2009-01-21', 'start_date' => '2009-01-21', 'end_date' => '2009-12-21', 'source' => 'Payment', 'is_override' => 1, - 'status_id' => 35, + 'status_id' => 36, ]; try{ @@ -52,14 +52,15 @@ function membership_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '94', - 'membership_type_id' => '57', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '20090121000000', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '35', + 'status_id' => '36', 'is_override' => '1', + 'status_override_end_date' => '', 'owner_membership_id' => '', 'max_related' => '', 'is_test' => 0, @@ -80,17 +81,17 @@ function membership_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Membership/UpdateCustomData.php b/civicrm/api/v3/examples/Membership/UpdateCustomData.php index 2a10b8e713a1c6a6ddd888a72e6fdaf492b2589c..243c5968ca91c888d42a0e2470e00a8883043b3b 100644 --- a/civicrm/api/v3/examples/Membership/UpdateCustomData.php +++ b/civicrm/api/v3/examples/Membership/UpdateCustomData.php @@ -7,14 +7,14 @@ */ function membership_create_example() { $params = [ - 'contact_id' => 112, - 'membership_type_id' => 69, + 'contact_id' => 3, + 'membership_type_id' => 1, 'join_date' => '2009-01-21', 'start_date' => '2009-01-21', 'end_date' => '2009-12-21', 'source' => 'Payment', 'is_override' => 1, - 'status_id' => 41, + 'status_id' => 42, 'custom_1' => 'custom string', ]; @@ -53,14 +53,15 @@ function membership_create_expectedresult() { 'values' => [ '1' => [ 'id' => '1', - 'contact_id' => '112', - 'membership_type_id' => '69', + 'contact_id' => '3', + 'membership_type_id' => '1', 'join_date' => '20090121000000', 'start_date' => '2013-07-29 00:00:00', 'end_date' => '2013-08-04 00:00:00', 'source' => 'Payment', - 'status_id' => '41', + 'status_id' => '42', 'is_override' => '1', + 'status_override_end_date' => '', 'owner_membership_id' => '', 'max_related' => '', 'is_test' => 0, @@ -81,17 +82,17 @@ function membership_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipPayment/Create.php b/civicrm/api/v3/examples/MembershipPayment/Create.php index 1df477999ae84a50112a78a1526d3db484c1de65..5cf4a9ee2776c1503e0f3189f4eceb27794b8140 100644 --- a/civicrm/api/v3/examples/MembershipPayment/Create.php +++ b/civicrm/api/v3/examples/MembershipPayment/Create.php @@ -62,17 +62,17 @@ function membership_payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipPayment/Get.php b/civicrm/api/v3/examples/MembershipPayment/Get.php index 86dfa26b05e9f689c8d84c2354a9d0dd595e7fe4..fa8c03591c175dfd136d42c7c541eeefb9f229cd 100644 --- a/civicrm/api/v3/examples/MembershipPayment/Get.php +++ b/civicrm/api/v3/examples/MembershipPayment/Get.php @@ -62,17 +62,17 @@ function membership_payment_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipStatus/Create.php b/civicrm/api/v3/examples/MembershipStatus/Create.php index 614c84415c0d9e4982869cec549de05fc6e46e08..62b129aa521324b30087df70a7172bb37ab595e0 100644 --- a/civicrm/api/v3/examples/MembershipStatus/Create.php +++ b/civicrm/api/v3/examples/MembershipStatus/Create.php @@ -73,17 +73,17 @@ function membership_status_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipStatusTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipStatus/Get.php b/civicrm/api/v3/examples/MembershipStatus/Get.php index 396a9a68ca2a42fd9b8ebbae7c4513f415057f55..f31da82b9149a4e85a29a61e32ff918860e0f374 100644 --- a/civicrm/api/v3/examples/MembershipStatus/Get.php +++ b/civicrm/api/v3/examples/MembershipStatus/Get.php @@ -68,17 +68,17 @@ function membership_status_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipStatusTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipType/Create.php b/civicrm/api/v3/examples/MembershipType/Create.php index f78351a9008d6fdbeacea40083b7eac91447d9fc..b3adad90709ec133fc72b0c6fffaeb11528f993a 100644 --- a/civicrm/api/v3/examples/MembershipType/Create.php +++ b/civicrm/api/v3/examples/MembershipType/Create.php @@ -89,17 +89,17 @@ function membership_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipType/Delete.php b/civicrm/api/v3/examples/MembershipType/Delete.php index 59200470d94b3e93e8107a01515b073dce506c00..810c7b062dbb11009e178769479d85c8ca4b677c 100644 --- a/civicrm/api/v3/examples/MembershipType/Delete.php +++ b/civicrm/api/v3/examples/MembershipType/Delete.php @@ -7,7 +7,7 @@ */ function membership_type_delete_example() { $params = [ - 'id' => 4, + 'id' => 5, ]; try{ @@ -54,17 +54,17 @@ function membership_type_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MembershipType/Get.php b/civicrm/api/v3/examples/MembershipType/Get.php index 232ad99518fb9fd328e91ea1afa69dfd8cfcf2d0..35770ea494d1e3be35faccd0b847bff62210d5e8 100644 --- a/civicrm/api/v3/examples/MembershipType/Get.php +++ b/civicrm/api/v3/examples/MembershipType/Get.php @@ -49,7 +49,7 @@ function membership_type_get_expectedresult() { 'name' => 'General', 'member_of_contact_id' => '4', 'financial_type_id' => '2', - 'minimum_fee' => '0.00', + 'minimum_fee' => '0.000000000', 'duration_unit' => 'year', 'duration_interval' => '1', 'period_type' => 'rolling', @@ -71,17 +71,17 @@ function membership_type_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MembershipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MessageTemplate/Create.php b/civicrm/api/v3/examples/MessageTemplate/Create.php index 16a8b53f259bcdaed0e875193f04b03b7d7961c3..293e6da69f3cc40a2cf3d9645f9e08b25c24b92c 100644 --- a/civicrm/api/v3/examples/MessageTemplate/Create.php +++ b/civicrm/api/v3/examples/MessageTemplate/Create.php @@ -7,11 +7,11 @@ */ function message_template_create_example() { $params = [ - 'msg_title' => 'msg_title_284', - 'msg_subject' => 'msg_subject_284', - 'msg_text' => 'msg_text_284', - 'msg_html' => 'msg_html_284', - 'workflow_id' => 284, + 'msg_title' => 'msg_title_471', + 'msg_subject' => 'msg_subject_471', + 'msg_text' => 'msg_text_471', + 'msg_html' => 'msg_html_471', + 'workflow_id' => 471, 'is_default' => '1', 'is_reserved' => 1, ]; @@ -51,12 +51,12 @@ function message_template_create_expectedresult() { 'values' => [ '69' => [ 'id' => '69', - 'msg_title' => 'msg_title_284', - 'msg_subject' => 'msg_subject_284', - 'msg_text' => 'msg_text_284', - 'msg_html' => 'msg_html_284', + 'msg_title' => 'msg_title_471', + 'msg_subject' => 'msg_subject_471', + 'msg_text' => 'msg_text_471', + 'msg_html' => 'msg_html_471', 'is_active' => '1', - 'workflow_id' => '284', + 'workflow_id' => '471', 'is_default' => '1', 'is_reserved' => '1', 'is_sms' => '', @@ -75,17 +75,17 @@ function message_template_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MessageTemplate/Delete.php b/civicrm/api/v3/examples/MessageTemplate/Delete.php index 70f769ff0dda02135219e28ae1c9a822274bb331..5829e0df6c940c5e6a8a26d649889913b8ac3cc1 100644 --- a/civicrm/api/v3/examples/MessageTemplate/Delete.php +++ b/civicrm/api/v3/examples/MessageTemplate/Delete.php @@ -54,17 +54,17 @@ function message_template_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/MessageTemplate/Get.php b/civicrm/api/v3/examples/MessageTemplate/Get.php index d29e2073f7ec6a0a1bfff9fd2023ec5d78b65362..985ecbba48eb00eff9f798ed4c15eb079d2b3480 100644 --- a/civicrm/api/v3/examples/MessageTemplate/Get.php +++ b/civicrm/api/v3/examples/MessageTemplate/Get.php @@ -7,11 +7,11 @@ */ function message_template_get_example() { $params = [ - 'msg_title' => 'msg_title_285', - 'msg_subject' => 'msg_subject_285', - 'msg_text' => 'msg_text_285', - 'msg_html' => 'msg_html_285', - 'workflow_id' => 285, + 'msg_title' => 'msg_title_472', + 'msg_subject' => 'msg_subject_472', + 'msg_text' => 'msg_text_472', + 'msg_html' => 'msg_html_472', + 'workflow_id' => 472, 'is_default' => '1', 'is_reserved' => 1, ]; @@ -51,16 +51,16 @@ function message_template_get_expectedresult() { 'values' => [ '70' => [ 'id' => '70', - 'msg_title' => 'msg_title_285', - 'msg_subject' => 'msg_subject_285', - 'msg_text' => 'msg_text_285', - 'msg_html' => 'msg_html_285', + 'msg_title' => 'msg_title_472', + 'msg_subject' => 'msg_subject_472', + 'msg_text' => 'msg_text_472', + 'msg_html' => 'msg_html_472', 'is_active' => '1', - 'workflow_id' => '285', + 'workflow_id' => '472', 'is_default' => '1', 'is_reserved' => '1', - 'is_sms' => '1', - 'pdf_format_id' => '285', + 'is_sms' => 0, + 'pdf_format_id' => '472', ], ], ]; @@ -75,17 +75,17 @@ function message_template_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MessageTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Note/Create.php b/civicrm/api/v3/examples/Note/Create.php index 89166d5ee3107c468c93469685f5107c55defeb2..8e3cd49991fbd9da79502185140a8600fa1f9c47 100644 --- a/civicrm/api/v3/examples/Note/Create.php +++ b/civicrm/api/v3/examples/Note/Create.php @@ -8,9 +8,9 @@ function note_create_example() { $params = [ 'entity_table' => 'civicrm_contact', - 'entity_id' => 9, + 'entity_id' => 15, 'note' => 'Hello!!! m testing Note', - 'contact_id' => 9, + 'contact_id' => 15, 'modified_date' => '2011-01-31', 'subject' => 'Test Note', ]; @@ -46,14 +46,14 @@ function note_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 8, + 'id' => 14, 'values' => [ - '8' => [ - 'id' => '8', + '14' => [ + 'id' => '14', 'entity_table' => 'civicrm_contact', - 'entity_id' => '9', + 'entity_id' => '15', 'note' => 'Hello!!! m testing Note', - 'contact_id' => '9', + 'contact_id' => '15', 'modified_date' => '2012-11-14 16:02:35', 'subject' => 'Test Note', 'privacy' => 0, @@ -71,17 +71,17 @@ function note_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Note/Delete.php b/civicrm/api/v3/examples/Note/Delete.php index 7fdca70af565b0614b7cbbb7ee5bd06165ff9f55..cec6389e29c1ab3774b3e8e5c3573419af573f92 100644 --- a/civicrm/api/v3/examples/Note/Delete.php +++ b/civicrm/api/v3/examples/Note/Delete.php @@ -7,7 +7,7 @@ */ function note_delete_example() { $params = [ - 'id' => 19, + 'id' => 32, ]; try{ @@ -54,17 +54,17 @@ function note_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Note/Get.php b/civicrm/api/v3/examples/Note/Get.php index f045d610abd8a3cc89eb5f700cfd18c8bb37daff..17e84a67a2e9128cb5e9e3af628df699465a95fe 100644 --- a/civicrm/api/v3/examples/Note/Get.php +++ b/civicrm/api/v3/examples/Note/Get.php @@ -8,7 +8,7 @@ function note_get_example() { $params = [ 'entity_table' => 'civicrm_contact', - 'entity_id' => 3, + 'entity_id' => 5, ]; try{ @@ -55,17 +55,17 @@ function note_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/NoteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OpenID/Create.php b/civicrm/api/v3/examples/OpenID/Create.php index 39cfeb016187e662abd4ec739db7787974a88cf8..03244878a43e4ee6787f06f766d6aca3e7fa74d9 100644 --- a/civicrm/api/v3/examples/OpenID/Create.php +++ b/civicrm/api/v3/examples/OpenID/Create.php @@ -7,9 +7,8 @@ */ function open_i_d_create_example() { $params = [ - 'contact_id' => 3, + 'contact_id' => 5, 'openid' => 'My OpenID handle', - 'location_type_id' => 1, ]; try{ @@ -43,11 +42,11 @@ function open_i_d_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 1, + 'id' => 2, 'values' => [ - '1' => [ - 'id' => '1', - 'contact_id' => '3', + '2' => [ + 'id' => '2', + 'contact_id' => '5', 'location_type_id' => '1', 'openid' => 'My OpenID handle', 'allowed_to_login' => '', @@ -61,22 +60,22 @@ function open_i_d_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreateOpenID" +* The test that created it is called "testCreateOpenIDDefaultLocation" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OpenIDTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OpenID/Delete.php b/civicrm/api/v3/examples/OpenID/Delete.php index 291dbbc592b3a07d17a89a895d86e75d09d14429..8c7318d8365bcc95ea5a825b3cd64111b583e17e 100644 --- a/civicrm/api/v3/examples/OpenID/Delete.php +++ b/civicrm/api/v3/examples/OpenID/Delete.php @@ -7,7 +7,7 @@ */ function open_i_d_delete_example() { $params = [ - 'id' => 3, + 'id' => 4, ]; try{ @@ -54,17 +54,17 @@ function open_i_d_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OpenIDTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OpenID/Get.php b/civicrm/api/v3/examples/OpenID/Get.php index 4ebf7f556dba3e349aafbd7066e4c416394e4be2..9a2da402ed120a5d76499f5c870eb7da35f54b2e 100644 --- a/civicrm/api/v3/examples/OpenID/Get.php +++ b/civicrm/api/v3/examples/OpenID/Get.php @@ -7,7 +7,7 @@ */ function open_i_d_get_example() { $params = [ - 'contact_id' => 4, + 'contact_id' => 7, 'openid' => 'My OpenID handle', 'location_type_id' => 1, ]; @@ -43,11 +43,11 @@ function open_i_d_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 3, 'values' => [ - '2' => [ - 'id' => '2', - 'contact_id' => '4', + '3' => [ + 'id' => '3', + 'contact_id' => '7', 'location_type_id' => '1', 'openid' => 'My OpenID handle', 'allowed_to_login' => 0, @@ -66,17 +66,17 @@ function open_i_d_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OpenIDTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionGroup/Create.php b/civicrm/api/v3/examples/OptionGroup/Create.php index b44190696a358959413f28352c483823ff18f370..109b81d4d21eb51336d7bb1c2ad3b9e7acbbd652 100644 --- a/civicrm/api/v3/examples/OptionGroup/Create.php +++ b/civicrm/api/v3/examples/OptionGroup/Create.php @@ -51,10 +51,10 @@ function option_group_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 92, + 'id' => 96, 'values' => [ '0' => [ - 'id' => '92', + 'id' => '96', 'name' => 'civicrm_event.amount.560', 'title' => '', 'description' => '', @@ -62,7 +62,7 @@ function option_group_create_expectedresult() { 'is_reserved' => '1', 'is_active' => '1', 'is_locked' => '', - 'api.OptionValue.create' => 849, + 'api.OptionValue.create' => 869, ], ], ]; @@ -77,17 +77,17 @@ function option_group_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionGroup/Delete.php b/civicrm/api/v3/examples/OptionGroup/Delete.php index 953f4eb76053216ecffc726ca655fd4ff2d91789..7871a5b8b2e22b956c0cb397286d09aa7620661d 100644 --- a/civicrm/api/v3/examples/OptionGroup/Delete.php +++ b/civicrm/api/v3/examples/OptionGroup/Delete.php @@ -7,7 +7,7 @@ */ function option_group_delete_example() { $params = [ - 'id' => 97, + 'id' => 101, ]; try{ @@ -54,17 +54,17 @@ function option_group_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionGroup/Get.php b/civicrm/api/v3/examples/OptionGroup/Get.php index 396906a3fcdeb9ee3b94bb452b9c72cceabaab7c..a17a22183d3ecd3e156dfe345c90bc9b063d103a 100644 --- a/civicrm/api/v3/examples/OptionGroup/Get.php +++ b/civicrm/api/v3/examples/OptionGroup/Get.php @@ -64,17 +64,17 @@ function option_group_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionValue/Get.php b/civicrm/api/v3/examples/OptionValue/Get.php index 9fc467248ece490d33e9586654b60b08dfae6ad8..f7158fc0695bb0943b753044c66733f904a34308 100644 --- a/civicrm/api/v3/examples/OptionValue/Get.php +++ b/civicrm/api/v3/examples/OptionValue/Get.php @@ -115,17 +115,17 @@ function option_value_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/OptionValue/SortOption.php b/civicrm/api/v3/examples/OptionValue/SortOption.php index bc4bbcd61b4b3a40d1e8d745a0fdbfd99248da7b..ae9e2611cc7b73c2736fc4abd7f626616a90a0d5 100644 --- a/civicrm/api/v3/examples/OptionValue/SortOption.php +++ b/civicrm/api/v3/examples/OptionValue/SortOption.php @@ -66,17 +66,17 @@ function option_value_getsingle_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OptionValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/Cancel.php b/civicrm/api/v3/examples/Order/Cancel.php index eef34ecfae5b3c6a4181562cab6b6bcd660e68d7..2f4327d0d9139fb8f92a8b4186f6291343c9d762 100644 --- a/civicrm/api/v3/examples/Order/Cancel.php +++ b/civicrm/api/v3/examples/Order/Cancel.php @@ -56,6 +56,7 @@ function order_cancel_expectedresult() { 'net_amount' => '100.00', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -70,7 +71,7 @@ function order_cancel_expectedresult() { 'address_id' => '', 'check_number' => '', 'campaign_id' => '', - 'creditnote_id' => 'CN_1', + 'creditnote_id' => '1', 'tax_amount' => '', 'revenue_recognition_date' => '', 'contribution_type_id' => '1', @@ -88,17 +89,17 @@ function order_cancel_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/Create.php b/civicrm/api/v3/examples/Order/Create.php index 8ab83214d14655d6d19f591060473d60cb819187..05b76b87a23e361a11ec2d76d35cd0c8ddf269b7 100644 --- a/civicrm/api/v3/examples/Order/Create.php +++ b/civicrm/api/v3/examples/Order/Create.php @@ -10,7 +10,7 @@ function order_create_example() { 'contact_id' => 8, 'receive_date' => '2010-01-20', 'total_amount' => 200, - 'financial_type_id' => 1, + 'financial_type_id' => 'Event Fee', 'contribution_status_id' => 1, 'line_items' => [ '0' => [ @@ -21,8 +21,8 @@ function order_create_example() { 'label' => 'Price Field 2', 'field_title' => 'Price Field 2', 'qty' => 1, - 'unit_price' => '200', - 'line_total' => '200', + 'unit_price' => '200.000000000', + 'line_total' => '200.000000000', 'financial_type_id' => '4', 'entity_table' => 'civicrm_membership', 'membership_type_id' => 1, @@ -78,7 +78,7 @@ function order_create_expectedresult() { '1' => [ 'id' => '1', 'contact_id' => '8', - 'financial_type_id' => '1', + 'financial_type_id' => '4', 'contribution_page_id' => '', 'payment_instrument_id' => '4', 'receive_date' => '20100120000000', @@ -88,6 +88,7 @@ function order_create_expectedresult() { 'net_amount' => '200', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -105,7 +106,7 @@ function order_create_expectedresult() { 'creditnote_id' => '', 'tax_amount' => '', 'revenue_recognition_date' => '', - 'contribution_type_id' => '1', + 'contribution_type_id' => '4', ], ], ]; @@ -120,17 +121,17 @@ function order_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/CreateOrderParticipant.php b/civicrm/api/v3/examples/Order/CreateOrderParticipant.php index 6baee2a7293f98532a2c09bfcabc0ce6bc21e0e3..9915cf6d7209d48293a03a97e66f81faec234f20 100644 --- a/civicrm/api/v3/examples/Order/CreateOrderParticipant.php +++ b/civicrm/api/v3/examples/Order/CreateOrderParticipant.php @@ -23,8 +23,8 @@ function order_create_example() { 'label' => 'Price Field 1', 'field_title' => 'Price Field 1', 'qty' => 1, - 'unit_price' => '100', - 'line_total' => '100', + 'unit_price' => '100.000000000', + 'line_total' => '100.000000000', 'financial_type_id' => '4', 'entity_table' => 'civicrm_participant', ], @@ -34,8 +34,8 @@ function order_create_example() { 'label' => 'Price Field 2', 'field_title' => 'Price Field 2', 'qty' => 1, - 'unit_price' => '200', - 'line_total' => '200', + 'unit_price' => '200.000000000', + 'line_total' => '200.000000000', 'financial_type_id' => '4', 'entity_table' => 'civicrm_participant', ], @@ -98,6 +98,7 @@ function order_create_expectedresult() { 'net_amount' => '300', 'trxn_id' => '', 'invoice_id' => '', + 'invoice_number' => '', 'currency' => 'USD', 'cancel_date' => '', 'cancel_reason' => '', @@ -130,17 +131,17 @@ function order_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/Delete.php b/civicrm/api/v3/examples/Order/Delete.php index a1ba94375e71947f026623b036ec805c324919b8..8c63b2bb6fb32385178b4b9df48937cde8d1af24 100644 --- a/civicrm/api/v3/examples/Order/Delete.php +++ b/civicrm/api/v3/examples/Order/Delete.php @@ -57,17 +57,17 @@ function order_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Order/Get.php b/civicrm/api/v3/examples/Order/Get.php index 32ef1a23b76d727bbf5713d5a5e12ca6f19477ad..c5af0531544515629d5aa7217b45d57960094e6f 100644 --- a/civicrm/api/v3/examples/Order/Get.php +++ b/civicrm/api/v3/examples/Order/Get.php @@ -51,6 +51,10 @@ function order_get_expectedresult() { 'display_name' => 'Mr. Anthony Anderson II', 'contribution_id' => '1', 'currency' => 'USD', + 'contribution_recur_id' => '', + 'contribution_status_id' => '1', + 'contribution_campaign_id' => '', + 'payment_instrument_id' => '4', 'receive_date' => '2010-01-20 00:00:00', 'non_deductible_amount' => '0.00', 'total_amount' => '100.00', @@ -58,39 +62,30 @@ function order_get_expectedresult() { 'net_amount' => '100.00', 'trxn_id' => '', 'invoice_id' => '', - 'cancel_date' => '', + 'invoice_number' => '', + 'contribution_cancel_date' => '', 'cancel_reason' => '', 'receipt_date' => '', 'thankyou_date' => '', 'contribution_source' => '', 'amount_level' => '', - 'contribution_recur_id' => '', 'is_test' => 0, 'is_pay_later' => 0, - 'contribution_status_id' => '1', 'contribution_check_number' => '', - 'contribution_campaign_id' => '', - 'financial_type_id' => '1', - 'financial_type' => 'Donation', - 'product_id' => '', - 'product_name' => '', - 'sku' => '', - 'contribution_product_id' => '', - 'product_option' => '', - 'fulfilled_date' => '', - 'contribution_start_date' => '', - 'contribution_end_date' => '', 'financial_account_id' => '1', 'accounting_code' => '4200', 'campaign_id' => '', 'contribution_campaign_title' => '', + 'financial_type_id' => '1', 'contribution_note' => '', 'contribution_batch' => '', - 'contribution_status' => 'Completed', + 'contribution_recur_status' => 'Completed', 'payment_instrument' => 'Check', - 'payment_instrument_id' => '4', - 'instrument_id' => '4', + 'contribution_status' => 'Completed', + 'financial_type' => 'Donation', 'check_number' => '', + 'instrument_id' => '4', + 'cancel_date' => '', 'id' => '1', 'contribution_type_id' => '1', 'line_items' => [ @@ -124,17 +119,17 @@ function order_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/OrderTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Participant/Create.php b/civicrm/api/v3/examples/Participant/Create.php index a6a714208d33a3dcb188895a95cd7be637260780..27dd8c000d4495f1f447c26d949a18e2fa479cd0 100644 --- a/civicrm/api/v3/examples/Participant/Create.php +++ b/civicrm/api/v3/examples/Participant/Create.php @@ -8,7 +8,7 @@ function participant_create_example() { $params = [ 'contact_id' => 2, - 'event_id' => 2, + 'event_id' => 3, 'status_id' => 1, 'role_id' => 1, 'register_date' => '2007-07-21 00:00:00', @@ -52,7 +52,7 @@ function participant_create_expectedresult() { '4' => [ 'id' => '4', 'contact_id' => '2', - 'event_id' => '2', + 'event_id' => '3', 'status_id' => '1', 'role_id' => '1', 'register_date' => '20070721000000', @@ -83,17 +83,17 @@ function participant_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Participant/Get.php b/civicrm/api/v3/examples/Participant/Get.php index 0734b19708a4288bbbdf02b386566f0947bd84e7..d883a170610c892b4870a024fbba6abd5d6370da 100644 --- a/civicrm/api/v3/examples/Participant/Get.php +++ b/civicrm/api/v3/examples/Participant/Get.php @@ -53,6 +53,7 @@ function participant_get_expectedresult() { 'event_title' => 'Annual CiviCRM meet', 'event_start_date' => '2013-07-29 00:00:00', 'event_end_date' => '2013-08-04 00:00:00', + 'default_role_id' => '1', 'participant_id' => '1', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -85,17 +86,17 @@ function participant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Participant/NestedDelete.php b/civicrm/api/v3/examples/Participant/NestedDelete.php index 8f098e52c344170e0f072a090f921fdd13605b16..599bf723a1728b75209ccc9e3b2995a7fa97362a 100644 --- a/civicrm/api/v3/examples/Participant/NestedDelete.php +++ b/civicrm/api/v3/examples/Participant/NestedDelete.php @@ -51,10 +51,11 @@ function participant_get_expectedresult() { 'contact_sub_type' => '', 'sort_name' => 'Anderson, Anthony', 'display_name' => 'Mr. Anthony Anderson II', - 'event_id' => '41', + 'event_id' => '42', 'event_title' => 'Annual CiviCRM meet', 'event_start_date' => '2013-07-29 00:00:00', 'event_end_date' => '2013-08-04 00:00:00', + 'default_role_id' => '1', 'participant_id' => '2', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -86,10 +87,11 @@ function participant_get_expectedresult() { 'contact_sub_type' => '', 'sort_name' => 'Anderson, Anthony', 'display_name' => 'Mr. Anthony Anderson II', - 'event_id' => '41', + 'event_id' => '42', 'event_title' => 'Annual CiviCRM meet', 'event_start_date' => '2013-07-29 00:00:00', 'event_end_date' => '2013-08-04 00:00:00', + 'default_role_id' => '1', 'participant_id' => '3', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -128,17 +130,17 @@ function participant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Participant/NestedEventGet.php b/civicrm/api/v3/examples/Participant/NestedEventGet.php index 75bd573d5e4661624abcfd29b7b064aafce521dd..526905947aa7064f27f4fe8aceb47e514712d0ab 100644 --- a/civicrm/api/v3/examples/Participant/NestedEventGet.php +++ b/civicrm/api/v3/examples/Participant/NestedEventGet.php @@ -56,6 +56,7 @@ function participant_get_expectedresult() { 'event_title' => 'Annual CiviCRM meet', 'event_start_date' => '2013-07-29 00:00:00', 'event_end_date' => '2013-08-04 00:00:00', + 'default_role_id' => '1', 'participant_id' => '1', 'participant_fee_level' => '', 'participant_fee_amount' => '', @@ -104,7 +105,7 @@ function participant_get_expectedresult() { 'is_active' => '1', 'is_show_location' => 0, 'default_role_id' => '1', - 'is_email_confirm' => 0, + 'is_email_confirm' => '1', 'is_pay_later' => 0, 'is_partial_payment' => 0, 'is_multiple_registrations' => 0, @@ -134,17 +135,17 @@ function participant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantPayment/Create.php b/civicrm/api/v3/examples/ParticipantPayment/Create.php index 9374697c0265e0c6f5dad05ea0a523224501c91d..afb8dc3e8477381d16a0990ca65e9053be7dabd1 100644 --- a/civicrm/api/v3/examples/ParticipantPayment/Create.php +++ b/civicrm/api/v3/examples/ParticipantPayment/Create.php @@ -62,17 +62,17 @@ function participant_payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantPayment/Delete.php b/civicrm/api/v3/examples/ParticipantPayment/Delete.php index 4bf80353acefc5721a56f3b6eb0d29814a61e9f2..fd07bbc3774e8f3dcbb4b2b5fdc035cdaf7e7960 100644 --- a/civicrm/api/v3/examples/ParticipantPayment/Delete.php +++ b/civicrm/api/v3/examples/ParticipantPayment/Delete.php @@ -7,7 +7,7 @@ */ function participant_payment_delete_example() { $params = [ - 'id' => 5, + 'id' => 6, ]; try{ @@ -54,17 +54,17 @@ function participant_payment_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantPayment/Get.php b/civicrm/api/v3/examples/ParticipantPayment/Get.php index be2f52c535a932845802c659acdd8d286512d6fb..c0b8e4b714de56a471912847947bcceacecaf01e 100644 --- a/civicrm/api/v3/examples/ParticipantPayment/Get.php +++ b/civicrm/api/v3/examples/ParticipantPayment/Get.php @@ -7,8 +7,8 @@ */ function participant_payment_get_example() { $params = [ - 'participant_id' => 64, - 'contribution_id' => 6, + 'participant_id' => 68, + 'contribution_id' => 7, ]; try{ @@ -42,12 +42,12 @@ function participant_payment_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 6, + 'id' => 7, 'values' => [ - '6' => [ - 'id' => '6', - 'participant_id' => '64', - 'contribution_id' => '6', + '7' => [ + 'id' => '7', + 'participant_id' => '68', + 'contribution_id' => '7', ], ], ]; @@ -62,17 +62,17 @@ function participant_payment_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantPaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantStatusType/Create.php b/civicrm/api/v3/examples/ParticipantStatusType/Create.php index 44a13f74183f1638e4e94b207dff1a1308574c27..474c521007ab2d8be1919d2ae0d1e89dc43adac9 100644 --- a/civicrm/api/v3/examples/ParticipantStatusType/Create.php +++ b/civicrm/api/v3/examples/ParticipantStatusType/Create.php @@ -74,17 +74,17 @@ function participant_status_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantStatusType/Delete.php b/civicrm/api/v3/examples/ParticipantStatusType/Delete.php index 4c1567d175f659095a09c73c192a08dcde0c69f6..77d001b4b5846c588cab2069d7bbcf4ae344c6d0 100644 --- a/civicrm/api/v3/examples/ParticipantStatusType/Delete.php +++ b/civicrm/api/v3/examples/ParticipantStatusType/Delete.php @@ -54,17 +54,17 @@ function participant_status_type_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ParticipantStatusType/Get.php b/civicrm/api/v3/examples/ParticipantStatusType/Get.php index 70bd8a9d244f72326c216facb647c643c0bbd561..40b6e21dc259ae9519e9cb2c4bfd0f23cacb3474 100644 --- a/civicrm/api/v3/examples/ParticipantStatusType/Get.php +++ b/civicrm/api/v3/examples/ParticipantStatusType/Get.php @@ -74,17 +74,17 @@ function participant_status_type_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ParticipantStatusTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/Cancel.php b/civicrm/api/v3/examples/Payment/Cancel.php index c9232203237f52ac527ca2947c0e335d3ed233ae..3b20cb8820f7c5b348f24a5b5e52c951232a3ce8 100644 --- a/civicrm/api/v3/examples/Payment/Cancel.php +++ b/civicrm/api/v3/examples/Payment/Cancel.php @@ -45,15 +45,15 @@ function payment_cancel_expectedresult() { 'id' => 3, 'values' => [ '3' => [ - 'id' => 3, + 'id' => '3', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', - 'trxn_date' => '20170207024650', + 'trxn_date' => '20190820192757', 'total_amount' => '-150', 'fee_amount' => '0.00', - 'net_amount' => '150.00', + 'net_amount' => '-150', 'currency' => 'USD', - 'is_payment' => 1, + 'is_payment' => '1', 'trxn_id' => '', 'trxn_result_code' => '', 'status_id' => '7', @@ -72,17 +72,17 @@ function payment_cancel_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/Create.php b/civicrm/api/v3/examples/Payment/Create.php index 335945660b5e0987cd8a35ba1b3e78e9aae83734..98fc75e87700d1784eac356c12a0fdd9bc888ffc 100644 --- a/civicrm/api/v3/examples/Payment/Create.php +++ b/civicrm/api/v3/examples/Payment/Create.php @@ -48,7 +48,7 @@ function payment_create_expectedresult() { 'id' => '3', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', - 'trxn_date' => '20170207024646', + 'trxn_date' => '20190820192755', 'total_amount' => '50', 'fee_amount' => '', 'net_amount' => '50', @@ -72,17 +72,17 @@ function payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/CreatePaymentWithLineItems.php b/civicrm/api/v3/examples/Payment/CreatePaymentWithLineItems.php index 7d2c3fdb154745f1ba27740b92290e48e6577790..a1351e8b0257bf86e8e2ca2ef326e149fce5b895 100644 --- a/civicrm/api/v3/examples/Payment/CreatePaymentWithLineItems.php +++ b/civicrm/api/v3/examples/Payment/CreatePaymentWithLineItems.php @@ -58,7 +58,7 @@ function payment_create_expectedresult() { 'id' => '3', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', - 'trxn_date' => '20170207024648', + 'trxn_date' => '20190820192756', 'total_amount' => '50', 'fee_amount' => '', 'net_amount' => '50', @@ -82,17 +82,17 @@ function payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/Delete.php b/civicrm/api/v3/examples/Payment/Delete.php index 99c75f8b2ca525a84a914a27ec56ce6562098ece..dea29275c004d1c31565c04056d929b5f6021394 100644 --- a/civicrm/api/v3/examples/Payment/Delete.php +++ b/civicrm/api/v3/examples/Payment/Delete.php @@ -55,17 +55,17 @@ function payment_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/Get.php b/civicrm/api/v3/examples/Payment/Get.php index d21df61552dd8e06844bbe1d9250c7827908e230..45b2bfc958fe2bc2616ebc0b6283d55a08146e44 100644 --- a/civicrm/api/v3/examples/Payment/Get.php +++ b/civicrm/api/v3/examples/Payment/Get.php @@ -71,17 +71,17 @@ function payment_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Payment/UpdatePayment.php b/civicrm/api/v3/examples/Payment/UpdatePayment.php index 38b15474bf53a40acd9f44867e32034f1c8801ce..7ac7eb09c57109a46542ae46bb6b82dd50d569ff 100644 --- a/civicrm/api/v3/examples/Payment/UpdatePayment.php +++ b/civicrm/api/v3/examples/Payment/UpdatePayment.php @@ -52,7 +52,7 @@ function payment_create_expectedresult() { 'id' => '5', 'from_financial_account_id' => '7', 'to_financial_account_id' => '6', - 'trxn_date' => '20170207024653', + 'trxn_date' => '20190820192758', 'total_amount' => '100', 'fee_amount' => '', 'net_amount' => '100', @@ -76,17 +76,17 @@ function payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentProcessor/Create.php b/civicrm/api/v3/examples/PaymentProcessor/Create.php index cb1794f201f9b08f52f280d16399a7eca14daa3f..d3483bdb93c13ec2ee8e3b8a7d0a40ba884285ed 100644 --- a/civicrm/api/v3/examples/PaymentProcessor/Create.php +++ b/civicrm/api/v3/examples/PaymentProcessor/Create.php @@ -45,15 +45,16 @@ function payment_processor_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 1, 'values' => [ - '2' => [ - 'id' => '2', + '1' => [ + 'id' => '1', 'domain_id' => '1', 'name' => 'API Test PP', + 'title' => '', 'description' => '', 'payment_processor_type_id' => '1', - 'is_active' => '', + 'is_active' => '1', 'is_default' => 0, 'is_test' => 0, 'user_name' => '', @@ -84,17 +85,17 @@ function payment_processor_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentProcessor/Delete.php b/civicrm/api/v3/examples/PaymentProcessor/Delete.php index 4ee4993aa159c78bedc5d32ac9f79cec2974880b..5c3ec5bf52017946d21a3b46d9f0d19ae81a2d45 100644 --- a/civicrm/api/v3/examples/PaymentProcessor/Delete.php +++ b/civicrm/api/v3/examples/PaymentProcessor/Delete.php @@ -7,7 +7,7 @@ */ function payment_processor_delete_example() { $params = [ - 'id' => 2, + 'id' => 3, ]; try{ @@ -54,17 +54,17 @@ function payment_processor_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentProcessorType/Create.php b/civicrm/api/v3/examples/PaymentProcessorType/Create.php index 80acce733057a1088831e785af407dec66d58254..e0baa78f23f25c8d2f4cebb235b81dd4ce349a41 100644 --- a/civicrm/api/v3/examples/PaymentProcessorType/Create.php +++ b/civicrm/api/v3/examples/PaymentProcessorType/Create.php @@ -86,17 +86,17 @@ function payment_processor_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentProcessorType/Delete.php b/civicrm/api/v3/examples/PaymentProcessorType/Delete.php index 3126ca7a3dc691ec13125447bd7a147f6b7f128b..e8e755d26333cfb4d9e7115eb435aaf976313435 100644 --- a/civicrm/api/v3/examples/PaymentProcessorType/Delete.php +++ b/civicrm/api/v3/examples/PaymentProcessorType/Delete.php @@ -54,17 +54,17 @@ function payment_processor_type_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentProcessorTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentToken/Create.php b/civicrm/api/v3/examples/PaymentToken/Create.php index 5df14cd19e0666f3b907db4b9f4e187386c468a5..18c9c5da7899514d23ac9eb193d61410cab165e5 100644 --- a/civicrm/api/v3/examples/PaymentToken/Create.php +++ b/civicrm/api/v3/examples/PaymentToken/Create.php @@ -77,17 +77,17 @@ function payment_token_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTokenTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentToken/Delete.php b/civicrm/api/v3/examples/PaymentToken/Delete.php index c7f368838fb4d45ab2c5870987435eb6bdb1195b..84e51e40021149976eb1abaed4cf1fbd77ccb5fd 100644 --- a/civicrm/api/v3/examples/PaymentToken/Delete.php +++ b/civicrm/api/v3/examples/PaymentToken/Delete.php @@ -54,17 +54,17 @@ function payment_token_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTokenTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PaymentToken/Get.php b/civicrm/api/v3/examples/PaymentToken/Get.php index 43ae1e720242740f25d7094e7d99bb5899d0875a..d08f098493965e1fb036c82bbbd9b232139c7efc 100644 --- a/civicrm/api/v3/examples/PaymentToken/Get.php +++ b/civicrm/api/v3/examples/PaymentToken/Get.php @@ -67,17 +67,17 @@ function payment_token_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PaymentTokenTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pcp/ChainedGetDelete.php b/civicrm/api/v3/examples/Pcp/ChainedGetDelete.php new file mode 100644 index 0000000000000000000000000000000000000000..c5634e4addab0d4944b1042502afb6b7b949ea9c --- /dev/null +++ b/civicrm/api/v3/examples/Pcp/ChainedGetDelete.php @@ -0,0 +1,114 @@ +<?php +/** + * Test Generated example demonstrating the Pcp.get API. + * + * Demonstrates get + delete in the same call. + * + * @return array + * API result array + */ +function pcp_get_example() { + $params = [ + 'title' => 'Pcp title', + 'api.Pcp.delete' => 1, + ]; + + try{ + $result = civicrm_api3('Pcp', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function pcp_get_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 2, + 'values' => [ + '3' => [ + 'id' => '3', + 'contact_id' => '1', + 'status_id' => 0, + 'title' => 'Pcp title', + 'page_id' => '1', + 'page_type' => 'contribute', + 'pcp_block_id' => '1', + 'is_thermometer' => 0, + 'is_honor_roll' => 0, + 'currency' => 'USD', + 'is_active' => 0, + 'is_notify' => 0, + 'api.Pcp.delete' => [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ], + ], + '5' => [ + 'id' => '5', + 'contact_id' => '1', + 'status_id' => 0, + 'title' => 'Pcp title', + 'page_id' => '1', + 'page_type' => 'contribute', + 'pcp_block_id' => '1', + 'is_thermometer' => 0, + 'is_honor_roll' => 0, + 'currency' => 'USD', + 'is_active' => 0, + 'is_notify' => 0, + 'api.Pcp.delete' => [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ], + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testGetPcpChainDelete" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PcpTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Pcp/Create.php b/civicrm/api/v3/examples/Pcp/Create.php index dc659cce382c0c455cdf220962b44e34929c6dd6..85da4f8b9dad434101405551946954d0678ed055 100644 --- a/civicrm/api/v3/examples/Pcp/Create.php +++ b/civicrm/api/v3/examples/Pcp/Create.php @@ -77,17 +77,17 @@ function pcp_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PcpTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pcp/Delete.php b/civicrm/api/v3/examples/Pcp/Delete.php new file mode 100644 index 0000000000000000000000000000000000000000..a623f9b68a93c1f76f3a52f63d5f876f03c47cd3 --- /dev/null +++ b/civicrm/api/v3/examples/Pcp/Delete.php @@ -0,0 +1,70 @@ +<?php +/** + * Test Generated example demonstrating the Pcp.delete API. + * + * @return array + * API result array + */ +function pcp_delete_example() { + $params = [ + 'id' => 4, + ]; + + try{ + $result = civicrm_api3('Pcp', 'delete', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function pcp_delete_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'values' => 1, + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testDeletePcp" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PcpTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Pcp/Get.php b/civicrm/api/v3/examples/Pcp/Get.php new file mode 100644 index 0000000000000000000000000000000000000000..d1f4a266a06459149324ed7459b95e1794ecd14e --- /dev/null +++ b/civicrm/api/v3/examples/Pcp/Get.php @@ -0,0 +1,89 @@ +<?php +/** + * Test Generated example demonstrating the Pcp.get API. + * + * @return array + * API result array + */ +function pcp_get_example() { + $params = [ + 'title' => 'Pcp title', + 'contact_id' => 1, + 'page_id' => 1, + 'pcp_block_id' => 1, + ]; + + try{ + $result = civicrm_api3('Pcp', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function pcp_get_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 3, + 'values' => [ + '3' => [ + 'id' => '3', + 'contact_id' => '1', + 'status_id' => 0, + 'title' => 'Pcp title', + 'page_id' => '1', + 'page_type' => 'contribute', + 'pcp_block_id' => '1', + 'is_thermometer' => 0, + 'is_honor_roll' => 0, + 'currency' => 'USD', + 'is_active' => 0, + 'is_notify' => 0, + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testGetPcp" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PcpTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Phone/Create.php b/civicrm/api/v3/examples/Phone/Create.php index 8f2a0c217839f32431f5ba7d4184b1b973812084..3fd8e7b230a9759ba759a2d0f8e4beeda9e1c135 100644 --- a/civicrm/api/v3/examples/Phone/Create.php +++ b/civicrm/api/v3/examples/Phone/Create.php @@ -7,8 +7,7 @@ */ function phone_create_example() { $params = [ - 'contact_id' => 3, - 'location_type_id' => 6, + 'contact_id' => 5, 'phone' => '(123) 456-7890', 'is_primary' => 1, 'phone_type_id' => 1, @@ -45,12 +44,12 @@ function phone_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 2, + 'id' => 3, 'values' => [ - '2' => [ - 'id' => '2', - 'contact_id' => '3', - 'location_type_id' => '6', + '3' => [ + 'id' => '3', + 'contact_id' => '5', + 'location_type_id' => '1', 'is_primary' => '1', 'is_billing' => '', 'mobile_provider_id' => '', @@ -67,22 +66,22 @@ function phone_create_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testCreatePhone" +* The test that created it is called "testCreatePhoneDefaultLocation" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Phone/Delete.php b/civicrm/api/v3/examples/Phone/Delete.php index 07bb8a2353489dd5f7854b6a14cd3e7f81a08d89..beff5e9e333a5dd09d9e1621e947f44357c472fe 100644 --- a/civicrm/api/v3/examples/Phone/Delete.php +++ b/civicrm/api/v3/examples/Phone/Delete.php @@ -7,7 +7,7 @@ */ function phone_delete_example() { $params = [ - 'id' => 3, + 'id' => 4, ]; try{ @@ -54,17 +54,17 @@ function phone_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Phone/Get.php b/civicrm/api/v3/examples/Phone/Get.php index 40571916fc0118cca51263c0872149f3f60204b9..57d25de2dd1f35ab7734f54c2c2dc4d8958cf040 100644 --- a/civicrm/api/v3/examples/Phone/Get.php +++ b/civicrm/api/v3/examples/Phone/Get.php @@ -7,7 +7,7 @@ */ function phone_get_example() { $params = [ - 'contact_id' => 7, + 'contact_id' => 12, 'phone' => '(123) 456-7890', ]; @@ -42,12 +42,12 @@ function phone_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 4, + 'id' => 5, 'values' => [ - '4' => [ - 'id' => '4', - 'contact_id' => '7', - 'location_type_id' => '10', + '5' => [ + 'id' => '5', + 'contact_id' => '12', + 'location_type_id' => '15', 'is_primary' => '1', 'is_billing' => 0, 'phone' => '(123) 456-7890', @@ -67,17 +67,17 @@ function phone_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PhoneTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Phone/GetOptions.php b/civicrm/api/v3/examples/Phone/GetOptions.php index 1b7cd959b9dd3e628dc62959643933bff9213c99..3ac7d56b31a9db84cf30bc3d7c916ac110b97a2e 100644 --- a/civicrm/api/v3/examples/Phone/GetOptions.php +++ b/civicrm/api/v3/examples/Phone/GetOptions.php @@ -60,17 +60,17 @@ function phone_getoptions_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ConstantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pledge/Create.php b/civicrm/api/v3/examples/Pledge/Create.php index e524f20c89be2d22d2fde036c41179f27248c7ab..3ffb6b2d56fe9f6f5386c6fa6d4062fefb818599 100644 --- a/civicrm/api/v3/examples/Pledge/Create.php +++ b/civicrm/api/v3/examples/Pledge/Create.php @@ -7,10 +7,10 @@ */ function pledge_create_example() { $params = [ - 'contact_id' => 11, - 'pledge_create_date' => '20170207', - 'start_date' => '20170207', - 'scheduled_date' => '20170209', + 'contact_id' => 12, + 'pledge_create_date' => '20190820', + 'start_date' => '20190820', + 'scheduled_date' => '20190822', 'amount' => '100', 'pledge_status_id' => '2', 'pledge_financial_type_id' => '1', @@ -57,7 +57,7 @@ function pledge_create_expectedresult() { 'values' => [ '0' => [ 'id' => '1', - 'contact_id' => '11', + 'contact_id' => '12', 'financial_type_id' => '1', 'contribution_page_id' => '', 'amount' => '100', @@ -79,6 +79,7 @@ function pledge_create_expectedresult() { 'status_id' => '2', 'is_test' => '', 'campaign_id' => '', + 'contribution_type_id' => '1', ], ], ]; @@ -93,17 +94,17 @@ function pledge_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pledge/Delete.php b/civicrm/api/v3/examples/Pledge/Delete.php index 7b6e86458f41d774657c51b9a5c72189a298c509..d11698ce1bdab87d79bfead3f1b3ff02cf4e8085 100644 --- a/civicrm/api/v3/examples/Pledge/Delete.php +++ b/civicrm/api/v3/examples/Pledge/Delete.php @@ -57,17 +57,17 @@ function pledge_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pledge/Get.php b/civicrm/api/v3/examples/Pledge/Get.php index 7f75449bd05f3e2f481cc2de836b146ff7251d44..b664e2b647204223dc79c4f8352a7dc62b989467 100644 --- a/civicrm/api/v3/examples/Pledge/Get.php +++ b/civicrm/api/v3/examples/Pledge/Get.php @@ -51,11 +51,11 @@ function pledge_get_expectedresult() { 'display_name' => 'Mr. Anthony Anderson II', 'pledge_id' => '1', 'pledge_amount' => '100.00', - 'pledge_create_date' => '2017-02-07 00:00:00', - 'pledge_start_date' => '2017-02-07 00:00:00', + 'pledge_create_date' => '2019-08-20 00:00:00', + 'pledge_start_date' => '2019-08-20 00:00:00', 'pledge_status' => 'Pending', 'pledge_total_paid' => '', - 'pledge_next_pay_date' => '2017-02-09 00:00:00', + 'pledge_next_pay_date' => '2019-08-22 00:00:00', 'pledge_next_pay_amount' => '20.00', 'pledge_outstanding_amount' => '', 'pledge_financial_type' => 'Donation', @@ -80,17 +80,17 @@ function pledge_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Pledge/GetFilterHighDate.php b/civicrm/api/v3/examples/Pledge/GetFilterHighDate.php index c567d852e9bb82d5432cdd2b5f62468245112446..d7dcb34cf9e00ba481e47277fa444e3e61cb9930 100644 --- a/civicrm/api/v3/examples/Pledge/GetFilterHighDate.php +++ b/civicrm/api/v3/examples/Pledge/GetFilterHighDate.php @@ -9,7 +9,7 @@ */ function pledge_get_example() { $params = [ - 'pledge_start_date_high' => '20170205024740', + 'pledge_start_date_high' => '20190818192828', ]; try{ @@ -53,11 +53,11 @@ function pledge_get_expectedresult() { 'display_name' => 'Mr. Anthony Anderson II', 'pledge_id' => '2', 'pledge_amount' => '100.00', - 'pledge_create_date' => '2017-02-07 00:00:00', - 'pledge_start_date' => '2016-03-04 00:00:00', + 'pledge_create_date' => '2019-08-20 00:00:00', + 'pledge_start_date' => '2018-03-02 00:00:00', 'pledge_status' => 'Overdue', 'pledge_total_paid' => '', - 'pledge_next_pay_date' => '2016-03-04 00:00:00', + 'pledge_next_pay_date' => '2018-03-02 00:00:00', 'pledge_next_pay_amount' => '20.00', 'pledge_outstanding_amount' => '20.00', 'pledge_financial_type' => 'Donation', @@ -82,17 +82,17 @@ function pledge_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PledgePayment/Create.php b/civicrm/api/v3/examples/PledgePayment/Create.php index 07070f6a61e7f7626f29d4695fec4910fb80a408..b2c50bfaac34dad47f16a83aa0cd9d0f3d1a647a 100644 --- a/civicrm/api/v3/examples/PledgePayment/Create.php +++ b/civicrm/api/v3/examples/PledgePayment/Create.php @@ -7,7 +7,7 @@ */ function pledge_payment_create_example() { $params = [ - 'contact_id' => 1, + 'contact_id' => 3, 'pledge_id' => 1, 'contribution_id' => 1, 'status_id' => 1, @@ -72,17 +72,17 @@ function pledge_payment_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PledgePayment/Delete.php b/civicrm/api/v3/examples/PledgePayment/Delete.php index ce498be4ef1cd6bd0c52193ba54d8d2af30f2827..7f5f8bb244ee28ce6a75629bb30ba1ed2f301b07 100644 --- a/civicrm/api/v3/examples/PledgePayment/Delete.php +++ b/civicrm/api/v3/examples/PledgePayment/Delete.php @@ -57,17 +57,17 @@ function pledge_payment_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PledgePayment/Get.php b/civicrm/api/v3/examples/PledgePayment/Get.php index 3d42d7ba845f03db8e354416bc43396f93e915ca..826d83948f1ee85f15d0f5283831686c93c5f1d2 100644 --- a/civicrm/api/v3/examples/PledgePayment/Get.php +++ b/civicrm/api/v3/examples/PledgePayment/Get.php @@ -98,17 +98,17 @@ function pledge_payment_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PledgePayment/Update.php b/civicrm/api/v3/examples/PledgePayment/Update.php index b9dc6999d758b38d4e175c4aa98b67dbf3ce0e6b..cf60c64a131f592ea2d55eaab9a060a851f4b8c1 100644 --- a/civicrm/api/v3/examples/PledgePayment/Update.php +++ b/civicrm/api/v3/examples/PledgePayment/Update.php @@ -69,17 +69,17 @@ function pledge_payment_update_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PledgePaymentTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceField/Create.php b/civicrm/api/v3/examples/PriceField/Create.php index c25152293b452a18825bec83d7cd007d0d9ee037..05ec60e5f9468747aedbd4a5313dc4699a727afe 100644 --- a/civicrm/api/v3/examples/PriceField/Create.php +++ b/civicrm/api/v3/examples/PriceField/Create.php @@ -80,17 +80,17 @@ function price_field_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceField/Delete.php b/civicrm/api/v3/examples/PriceField/Delete.php index 51213fe012801775990ae0ea06e4c211df4202b5..483b6426e4da03293a07ecd028c050c746d7ea64 100644 --- a/civicrm/api/v3/examples/PriceField/Delete.php +++ b/civicrm/api/v3/examples/PriceField/Delete.php @@ -54,17 +54,17 @@ function price_field_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceField/Get.php b/civicrm/api/v3/examples/PriceField/Get.php index 5ea6fe86b808c89b7c8bc6608d50278a2f2b66bb..0562018818dfdaaa621a26b9b3863281a952174f 100644 --- a/civicrm/api/v3/examples/PriceField/Get.php +++ b/civicrm/api/v3/examples/PriceField/Get.php @@ -70,17 +70,17 @@ function price_field_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceFieldValue/Create.php b/civicrm/api/v3/examples/PriceFieldValue/Create.php index e6332aa8a05f7626b192cdeea60ecfe80e63469b..7eb90fc41b43fb38b2b909a4549862329cc3f243 100644 --- a/civicrm/api/v3/examples/PriceFieldValue/Create.php +++ b/civicrm/api/v3/examples/PriceFieldValue/Create.php @@ -68,6 +68,7 @@ function price_field_value_create_expectedresult() { 'is_active' => '1', 'financial_type_id' => '2', 'non_deductible_amount' => '', + 'visibility_id' => '', 'contribution_type_id' => '2', ], ], @@ -83,17 +84,17 @@ function price_field_value_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceFieldValue/Delete.php b/civicrm/api/v3/examples/PriceFieldValue/Delete.php index b258473c78cb6783b768041dfc06178efe4be352..58af271e840482158d3daf6fc76190f5b1287548 100644 --- a/civicrm/api/v3/examples/PriceFieldValue/Delete.php +++ b/civicrm/api/v3/examples/PriceFieldValue/Delete.php @@ -54,17 +54,17 @@ function price_field_value_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceFieldValue/Get.php b/civicrm/api/v3/examples/PriceFieldValue/Get.php index 6a949c384e9e88fdc43c144bc64a368aab4af7e4..5889b0a7a3953401f618bb7ec0d0aac7eb5299b8 100644 --- a/civicrm/api/v3/examples/PriceFieldValue/Get.php +++ b/civicrm/api/v3/examples/PriceFieldValue/Get.php @@ -48,12 +48,13 @@ function price_field_value_get_expectedresult() { 'price_field_id' => '1', 'name' => 'contribution_amount', 'label' => 'Contribution Amount', - 'amount' => '1', + 'amount' => '1.000000000', 'weight' => '1', 'is_default' => 0, 'is_active' => '1', 'financial_type_id' => '1', 'non_deductible_amount' => '0.00', + 'visibility_id' => '1', 'contribution_type_id' => '1', ], ], @@ -69,17 +70,17 @@ function price_field_value_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceFieldValueTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceSet/Create.php b/civicrm/api/v3/examples/PriceSet/Create.php index be4f7fd9bcf9c963edc4dd73de11e64a230e8c1f..bb18c6768f6ab5908d7c67beb0840dc885f76dfb 100644 --- a/civicrm/api/v3/examples/PriceSet/Create.php +++ b/civicrm/api/v3/examples/PriceSet/Create.php @@ -45,10 +45,10 @@ function price_set_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 18, + 'id' => 20, 'values' => [ - '18' => [ - 'id' => '18', + '20' => [ + 'id' => '20', 'domain_id' => '', 'name' => 'event price', 'title' => 'event price', @@ -75,17 +75,17 @@ function price_set_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceSet/Delete.php b/civicrm/api/v3/examples/PriceSet/Delete.php index e4f96909d3b3c21e7c9991279f5a958309f14b38..7ad89e8168a7939c2effe63fb10d07fc45fcc30a 100644 --- a/civicrm/api/v3/examples/PriceSet/Delete.php +++ b/civicrm/api/v3/examples/PriceSet/Delete.php @@ -7,7 +7,7 @@ */ function price_set_delete_example() { $params = [ - 'id' => 19, + 'id' => 21, ]; try{ @@ -54,17 +54,17 @@ function price_set_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/PriceSet/Get.php b/civicrm/api/v3/examples/PriceSet/Get.php index be0f4fd52e74b5e66f353ee2346a84dc65ffa331..adfb4b89c39643879f4a75fd326e0b0b1589ed15 100644 --- a/civicrm/api/v3/examples/PriceSet/Get.php +++ b/civicrm/api/v3/examples/PriceSet/Get.php @@ -67,17 +67,17 @@ function price_set_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/PriceSetTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Profile/Apply.php b/civicrm/api/v3/examples/Profile/Apply.php index c3d881b4b83a3d1ffa2413063b504bbd8b5efa2c..54279e7b13c94bb67f77655d53da969316d4f56e 100644 --- a/civicrm/api/v3/examples/Profile/Apply.php +++ b/civicrm/api/v3/examples/Profile/Apply.php @@ -7,8 +7,8 @@ */ function profile_apply_example() { $params = [ - 'profile_id' => 31, - 'contact_id' => 3, + 'profile_id' => 30, + 'contact_id' => 5, 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email-Primary' => 'abc2.xyz2@gmail.com', @@ -51,10 +51,10 @@ function profile_apply_expectedresult() { 'values' => [ 'contact_type' => 'Individual', 'contact_sub_type' => '', - 'contact_id' => 3, + 'contact_id' => 5, 'version' => 3, 'debug' => 1, - 'profile_id' => 31, + 'profile_id' => 30, 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email' => [ @@ -93,17 +93,17 @@ function profile_apply_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Profile/Get.php b/civicrm/api/v3/examples/Profile/Get.php index 0e9e07c7019b058b6822042a1937f3c6892f819a..a8f3e4f34164c895e790f857c890d1904ef4aa69 100644 --- a/civicrm/api/v3/examples/Profile/Get.php +++ b/civicrm/api/v3/examples/Profile/Get.php @@ -12,7 +12,7 @@ function profile_get_example() { '1' => 1, '2' => 'Billing', ], - 'contact_id' => 3, + 'contact_id' => 5, ]; try{ @@ -91,17 +91,17 @@ function profile_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Profile/GetFields.php b/civicrm/api/v3/examples/Profile/GetFields.php index 588e90a21ae1e7667b25555ae69e8b92e2187abc..b95c81efca8d805ada8a6a803ab4246d7c832fe8 100644 --- a/civicrm/api/v3/examples/Profile/GetFields.php +++ b/civicrm/api/v3/examples/Profile/GetFields.php @@ -10,7 +10,7 @@ function profile_getfields_example() { $params = [ 'action' => 'submit', - 'profile_id' => 27, + 'profile_id' => 22, ]; try{ @@ -46,9 +46,15 @@ function profile_getfields_expectedresult() { 'count' => 9, 'values' => [ 'custom_1' => [ + 'id' => '1', 'label' => '_addCustomFieldToProfile', - 'groupTitle' => '_addCustomFie', + 'headerPattern' => '//', + 'title' => 'first_name', + 'custom_field_id' => '1', + 'groupTitle' => '_addCustomFieldToProfile', 'data_type' => 'String', + 'name' => 'custom_1', + 'type' => 2, 'html_type' => 'Text', 'default_value' => 'defaultValue', 'text_length' => '', @@ -66,9 +72,9 @@ function profile_getfields_expectedresult() { 'is_required' => 0, 'table_name' => 'civicrm_value__addcustomfie_1', 'column_name' => '_addcustomfieldtoprofile_1', - 'name' => 'custom_1', - 'title' => 'first_name', - 'type' => 2, + 'where' => 'civicrm_value__addcustomfie_1._addcustomfieldtoprofile_1', + 'extends_table' => 'civicrm_contact', + 'search_table' => 'contact_a', 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -91,11 +97,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_address', 'entity' => 'address', 'bao' => 'CRM_Core_BAO_Address', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 6, ], + 'is_core_field' => TRUE, 'api.required' => 0, 'help_pre' => '', 'help_post' => '', @@ -107,9 +115,12 @@ function profile_getfields_expectedresult() { 'type' => 1, 'title' => 'State Province', 'description' => 'Which State_Province does this address belong to.', + 'where' => 'civicrm_address.state_province_id', 'table_name' => 'civicrm_address', 'entity' => 'address', 'bao' => 'CRM_Core_BAO_Address', + 'localizable' => 0, + 'localize_context' => 'province', 'FKClassName' => 'CRM_Core_DAO_StateProvince', 'html' => [ 'type' => 'ChainSelect', @@ -121,6 +132,7 @@ function profile_getfields_expectedresult() { 'keyColumn' => 'id', 'labelColumn' => 'name', ], + 'is_core_field' => TRUE, 'FKApiName' => 'StateProvince', 'api.required' => '1', 'help_pre' => '', @@ -133,9 +145,12 @@ function profile_getfields_expectedresult() { 'type' => 1, 'title' => 'Country', 'description' => 'Which Country does this address belong to.', + 'where' => 'civicrm_address.country_id', 'table_name' => 'civicrm_address', 'entity' => 'address', 'bao' => 'CRM_Core_BAO_Address', + 'localizable' => 0, + 'localize_context' => 'country', 'FKClassName' => 'CRM_Core_DAO_Country', 'html' => [ 'type' => 'Select', @@ -147,7 +162,9 @@ function profile_getfields_expectedresult() { 'keyColumn' => 'id', 'labelColumn' => 'name', 'nameColumn' => 'iso_code', + 'abbrColumn' => 'iso_code', ], + 'is_core_field' => TRUE, 'FKApiName' => 'Country', 'api.required' => '1', 'help_pre' => '', @@ -170,11 +187,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_phone', 'entity' => 'phone', 'bao' => 'CRM_Core_BAO_Phone', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 32, 'size' => 20, ], + 'is_core_field' => TRUE, 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -197,11 +216,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_email', 'entity' => 'email', 'bao' => 'CRM_Core_BAO_Email', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 254, 'size' => 30, ], + 'is_core_field' => TRUE, 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -225,11 +246,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -251,11 +274,13 @@ function profile_getfields_expectedresult() { 'table_name' => 'civicrm_contact', 'entity' => 'contact', 'bao' => 'CRM_Contact_BAO_Contact', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 64, 'size' => 30, ], + 'is_core_field' => TRUE, 'api.required' => '1', 'help_pre' => '', 'help_post' => '', @@ -280,17 +305,17 @@ function profile_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Profile/Submit.php b/civicrm/api/v3/examples/Profile/Submit.php index 35f3b2f770d5e7902f3fb078991fca708f6fea06..3f2d700720a7e107384ff51734e8b1a37e884c32 100644 --- a/civicrm/api/v3/examples/Profile/Submit.php +++ b/civicrm/api/v3/examples/Profile/Submit.php @@ -7,8 +7,8 @@ */ function profile_submit_example() { $params = [ - 'profile_id' => 29, - 'contact_id' => 3, + 'profile_id' => 24, + 'contact_id' => 5, 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email-primary' => 'abc2.xyz2@gmail.com', @@ -48,10 +48,10 @@ function profile_submit_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 3, + 'id' => 5, 'values' => [ - '3' => [ - 'id' => '3', + '5' => [ + 'id' => '5', 'contact_type' => 'Individual', 'contact_sub_type' => '', 'do_not_email' => 0, @@ -78,7 +78,7 @@ function profile_submit_expectedresult() { 'prefix_id' => '3', 'suffix_id' => '3', 'formal_title' => '', - 'communication_style_id' => '', + 'communication_style_id' => '1', 'email_greeting_id' => '1', 'email_greeting_custom' => '', 'email_greeting_display' => 'Dear abc1', @@ -114,17 +114,17 @@ function profile_submit_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ProfileTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/RelationshipType/Create.php b/civicrm/api/v3/examples/RelationshipType/Create.php index d2e71aa285c11bfbc47fd556d2324c0262606e9b..e83a875ed662b504df7ae87850fe97a069a48787 100644 --- a/civicrm/api/v3/examples/RelationshipType/Create.php +++ b/civicrm/api/v3/examples/RelationshipType/Create.php @@ -76,17 +76,17 @@ function relationship_type_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/RelationshipType/Delete.php b/civicrm/api/v3/examples/RelationshipType/Delete.php index ec8c1aad7d8ac8f0a0deb5f8cd9ad1269dc70a8b..4f2afdd612877d8f2f79d179bf617e835f56c740 100644 --- a/civicrm/api/v3/examples/RelationshipType/Delete.php +++ b/civicrm/api/v3/examples/RelationshipType/Delete.php @@ -54,17 +54,17 @@ function relationship_type_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/RelationshipTypeTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ReportTemplate/Getrows.php b/civicrm/api/v3/examples/ReportTemplate/Getrows.php index 48804cb7a504ee8d144e0fc45dc947a28417e1a8..97e0948a9db8311d8c76d1bb0cbdf2f4d8b6baef 100644 --- a/civicrm/api/v3/examples/ReportTemplate/Getrows.php +++ b/civicrm/api/v3/examples/ReportTemplate/Getrows.php @@ -2,14 +2,14 @@ /** * Test Generated example demonstrating the ReportTemplate.getrows API. * - * Retrieve rows from a report template (optionally providing the instance_id). + * Retrieve rows from a mailing opened report template. * * @return array * API result array */ function report_template_getrows_example() { $params = [ - 'report_id' => 'contact/summary', + 'report_id' => 'Mailing/opened', 'options' => [ 'metadata' => [ '0' => 'labels', @@ -48,25 +48,71 @@ function report_template_getrows_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 2, + 'count' => 5, 'values' => [ '0' => [ - 'civicrm_contact_sort_name' => 'Second Domain', - 'civicrm_contact_id' => '2', - 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/report/contact/detail&reset=1&force=1&id_op=eq&id_value=2', - 'civicrm_contact_sort_name_hover' => 'View Contact Detail Report for this contact', + 'civicrm_contact_id' => '102', + 'civicrm_contact_sort_name' => 'One, Test', + 'civicrm_mailing_mailing_name' => 'Second Test Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'Second Test Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello again, {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '17', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:23:22', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=102', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', ], '1' => [ - 'civicrm_contact_sort_name' => 'Unit Test Organization', - 'civicrm_contact_id' => '1', - 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/report/contact/detail&reset=1&force=1&id_op=eq&id_value=1', - 'civicrm_contact_sort_name_hover' => 'View Contact Detail Report for this contact', + 'civicrm_contact_id' => '109', + 'civicrm_contact_sort_name' => 'Five, Test', + 'civicrm_mailing_mailing_name' => 'First Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'First Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '9', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:19:03', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=109', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', + ], + '2' => [ + 'civicrm_contact_id' => '110', + 'civicrm_contact_sort_name' => 'Six, Test', + 'civicrm_mailing_mailing_name' => 'First Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'First Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '5', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:17:54', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=110', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', + ], + '3' => [ + 'civicrm_contact_id' => '111', + 'civicrm_contact_sort_name' => 'Seven, Test', + 'civicrm_mailing_mailing_name' => 'First Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'First Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '15', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:20:59', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=111', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', + ], + '4' => [ + 'civicrm_contact_id' => '112', + 'civicrm_contact_sort_name' => 'Eight, Test', + 'civicrm_mailing_mailing_name' => 'First Mailing Events', + 'civicrm_mailing_mailing_name_alias' => 'First Mailing Events', + 'civicrm_mailing_mailing_subject' => 'Hello {contact.display_name}', + 'civicrm_mailing_event_opened_id' => '11', + 'civicrm_mailing_event_opened_time_stamp' => '2011-05-26 13:19:44', + 'civicrm_contact_sort_name_link' => '/index.php?q=civicrm/contact/view&reset=1&cid=112', + 'civicrm_contact_sort_name_hover' => 'View Contact details for this contact.', ], ], 'metadata' => [ 'title' => 'ERROR: Title is not Set', 'labels' => [ 'civicrm_contact_sort_name' => 'Contact Name', + 'civicrm_mailing_mailing_name' => 'Mailing Name', + 'civicrm_mailing_mailing_subject' => 'Mailing Subject', + 'civicrm_mailing_event_opened_time_stamp' => 'Open Date', ], ], ]; @@ -76,22 +122,22 @@ function report_template_getrows_expectedresult() { /* * This example has been generated from the API test suite. -* The test that created it is called "testReportTemplateGetRowsContactSummary" +* The test that created it is called "testReportTemplateGetRowsMailingUniqueOpened" * and can be found at: * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ReportTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/ReportTemplate/Getstatistics.php b/civicrm/api/v3/examples/ReportTemplate/Getstatistics.php index cfb3de58223d82dbefbb64642d16f08932ca3ca0..40f22af22bf25cd7a6c050adc3321350a05ecfed 100644 --- a/civicrm/api/v3/examples/ReportTemplate/Getstatistics.php +++ b/civicrm/api/v3/examples/ReportTemplate/Getstatistics.php @@ -42,8 +42,16 @@ function report_template_getstatistics_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 0, - 'values' => '', + 'count' => 1, + 'id' => 'counts', + 'values' => [ + 'counts' => [ + 'rowCount' => [ + 'title' => 'Row(s) Listed', + 'value' => 0, + ], + ], + ], ]; return $expectedResult; @@ -56,17 +64,17 @@ function report_template_getstatistics_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/ReportTemplateTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/SavedSearch/Create.php b/civicrm/api/v3/examples/SavedSearch/Create.php index 149e9f6b032b1d62f7064a0233bc9a9543e517c0..4667b1f8089c721f50619a33ec8469d82f7b44f4 100644 --- a/civicrm/api/v3/examples/SavedSearch/Create.php +++ b/civicrm/api/v3/examples/SavedSearch/Create.php @@ -82,9 +82,9 @@ function saved_search_create_expectedresult() { 'saved_search_id' => '3', 'is_active' => '1', 'visibility' => 'User and User Admin Only', - 'where_clause' => ' ( ( `civicrm_group_contact_cache_1`.group_id IN (\"1\") ) ) ', - 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:31:\"`civicrm_group_contact_cache_1`\";s:132:\" LEFT JOIN civicrm_group_contact_cache `civicrm_group_contact_cache_1` ON contact_a.id = `civicrm_group_contact_cache_1`.contact_id \";}', - 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:31:\"`civicrm_group_contact_cache_1`\";s:132:\" LEFT JOIN civicrm_group_contact_cache `civicrm_group_contact_cache_1` ON contact_a.id = `civicrm_group_contact_cache_1`.contact_id \";}', + 'where_clause' => ' ( ( ( civicrm_group_contact_cache_5d5bbe284d3e9.group_id IN (\"1\") ) ) ) ', + 'select_tables' => 'a:8:{s:15:\"civicrm_contact\";i:1;s:15:\"civicrm_address\";i:1;s:15:\"civicrm_country\";i:1;s:13:\"civicrm_email\";i:1;s:13:\"civicrm_phone\";i:1;s:10:\"civicrm_im\";i:1;s:19:\"civicrm_worldregion\";i:1;s:41:\"civicrm_group_contact_cache_5d5bbe284d3e9\";s:152:\" LEFT JOIN civicrm_group_contact_cache civicrm_group_contact_cache_5d5bbe284d3e9 ON contact_a.id = civicrm_group_contact_cache_5d5bbe284d3e9.contact_id \";}', + 'where_tables' => 'a:2:{s:15:\"civicrm_contact\";i:1;s:41:\"civicrm_group_contact_cache_5d5bbe284d3e9\";s:152:\" LEFT JOIN civicrm_group_contact_cache civicrm_group_contact_cache_5d5bbe284d3e9 ON contact_a.id = civicrm_group_contact_cache_5d5bbe284d3e9.contact_id \";}', 'group_type' => '', 'cache_date' => '', 'refresh_date' => '', @@ -111,17 +111,17 @@ function saved_search_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SavedSearchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/SavedSearch/Delete.php b/civicrm/api/v3/examples/SavedSearch/Delete.php index e2ed2a0ad274468ff6db73bc95dc4c94969336cc..00bbed7150dcf077502355777b4415f4a2971e47 100644 --- a/civicrm/api/v3/examples/SavedSearch/Delete.php +++ b/civicrm/api/v3/examples/SavedSearch/Delete.php @@ -54,17 +54,17 @@ function saved_search_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SavedSearchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/SavedSearch/Get.php b/civicrm/api/v3/examples/SavedSearch/Get.php index cb8f5c3f3e344dd22064bd7efc16365f1b7c572c..302240797a41a9d3a8c13e3691fe7fcb41627ef4 100644 --- a/civicrm/api/v3/examples/SavedSearch/Get.php +++ b/civicrm/api/v3/examples/SavedSearch/Get.php @@ -63,17 +63,17 @@ function saved_search_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SavedSearchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/Create.php b/civicrm/api/v3/examples/Setting/Create.php index 88a1afc59d947f45b8503852720a49817692c79c..fc2b6b9bf267a0ec1f82b07a677ea53178a8e2b4 100644 --- a/civicrm/api/v3/examples/Setting/Create.php +++ b/civicrm/api/v3/examples/Setting/Create.php @@ -60,17 +60,17 @@ function setting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/CreateAllDomains.php b/civicrm/api/v3/examples/Setting/CreateAllDomains.php index 7cfef55b75779acf1a88c1147b63fae97c3341f0..d25e1610452887985aad49a17346a015257d7d8b 100644 --- a/civicrm/api/v3/examples/Setting/CreateAllDomains.php +++ b/civicrm/api/v3/examples/Setting/CreateAllDomains.php @@ -67,17 +67,17 @@ function setting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/CreateSettingCurrentDomain.php b/civicrm/api/v3/examples/Setting/CreateSettingCurrentDomain.php index d600ec4c8009c694e4d6d1f63f88d62c773896c8..038295ee25cd12a76b89f76606fa6c3fa65c47de 100644 --- a/civicrm/api/v3/examples/Setting/CreateSettingCurrentDomain.php +++ b/civicrm/api/v3/examples/Setting/CreateSettingCurrentDomain.php @@ -61,17 +61,17 @@ function setting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/CreateSpecifiedDomains.php b/civicrm/api/v3/examples/Setting/CreateSpecifiedDomains.php index c7167e9131913c3f3c4098d2a6a01e1c390ec0e0..d344556e719939339405367a029a9593b8c6376a 100644 --- a/civicrm/api/v3/examples/Setting/CreateSpecifiedDomains.php +++ b/civicrm/api/v3/examples/Setting/CreateSpecifiedDomains.php @@ -67,17 +67,17 @@ function setting_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/Get.php b/civicrm/api/v3/examples/Setting/Get.php index 74d9c9a03b85e45ebab003580be1469a2a497db1..d25be60d68f804422fd146172995bf9bc66f4004 100644 --- a/civicrm/api/v3/examples/Setting/Get.php +++ b/civicrm/api/v3/examples/Setting/Get.php @@ -60,17 +60,17 @@ function setting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetAllDomains.php b/civicrm/api/v3/examples/Setting/GetAllDomains.php index 185f51b869acc83da15c09f91be4bca92f39965c..7a0f6b26f1bfacde7ed8da1f6e725d7f404c7239 100644 --- a/civicrm/api/v3/examples/Setting/GetAllDomains.php +++ b/civicrm/api/v3/examples/Setting/GetAllDomains.php @@ -67,17 +67,17 @@ function setting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetDefaults.php b/civicrm/api/v3/examples/Setting/GetDefaults.php index 6b50ddf06943f79435983040a4976ffb751554b0..cda1629a636f786e49dc758d8543ef01c0dc44d2 100644 --- a/civicrm/api/v3/examples/Setting/GetDefaults.php +++ b/civicrm/api/v3/examples/Setting/GetDefaults.php @@ -67,17 +67,17 @@ function setting_getdefaults_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetFields.php b/civicrm/api/v3/examples/Setting/GetFields.php index e41b514ec5f5b20f12f54ea68b9be2f11db590f6..c188d7d591c37db102add6210b0e566ce5b629a1 100644 --- a/civicrm/api/v3/examples/Setting/GetFields.php +++ b/civicrm/api/v3/examples/Setting/GetFields.php @@ -40,17 +40,20 @@ function setting_getfields_expectedresult() { $expectedResult = [ 'is_error' => 0, 'version' => 3, - 'count' => 157, + 'count' => 173, 'values' => [ 'address_standardization_provider' => [ 'group_name' => 'Address Preferences', 'group' => 'address', 'name' => 'address_standardization_provider', 'type' => 'String', - 'html_type' => 'Select', + 'html_type' => 'select', 'default' => '', 'add' => '4.1', 'title' => 'Address Standardization Provider.', + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::addressProvider', + ], 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -61,10 +64,10 @@ function setting_getfields_expectedresult() { 'group' => 'address', 'name' => 'address_standardization_userid', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.1', - 'title' => 'Web service user ID', + 'title' => 'Provider service user ID', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -75,10 +78,10 @@ function setting_getfields_expectedresult() { 'group' => 'address', 'name' => 'address_standardization_url', 'type' => 'Text', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.1', - 'title' => 'Web Service URL', + 'title' => 'Provider Service URL', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -104,28 +107,38 @@ function setting_getfields_expectedresult() { 'group' => 'campaign', 'name' => 'tag_unconfirmed', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'Unconfirmed', 'add' => '4.1', 'title' => 'Tag for Unconfirmed Petition Signers', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + 'description' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + 'help_text' => '', + 'settings_pages' => [ + 'campaign' => [ + 'weight' => 10, + ], + ], ], 'petition_contacts' => [ 'group_name' => 'Campaign Preferences', 'group' => 'campaign', 'name' => 'petition_contacts', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'Petition Contacts', 'add' => '4.1', 'title' => 'Petition Signers Group', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => 'If set, new contacts that are created when signing a petition are assigned a tag of this name.', + 'description' => 'All contacts that have signed a CiviCampaign petition will be added to this group. The group will be created if it does not exist (it is required for email verification).', + 'help_text' => '', + 'settings_pages' => [ + 'campaign' => [ + 'weight' => 20, + ], + ], ], 'civicaseRedactActivityEmail' => [ 'group_name' => 'CiviCRM Preferences', @@ -184,11 +197,27 @@ function setting_getfields_expectedresult() { 'description' => 'How to sort activity-types on the \"Manage Case\" screen? (Set \"Default\" to load setting from the legacy \"Settings.xml\" file.)', 'help_text' => '', ], + 'civicaseActivityRevisions' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'civicaseActivityRevisions', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => '', + 'html_type' => 'radio', + 'add' => '4.7', + 'title' => 'Enable Embedded Activity Revisions', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Enable tracking of activity revisions embedded within the \"civicrm_activity\" table. Alternatively, see \"Administer => System Settings => Misc => Logging\".', + 'help_text' => '', + ], 'cvv_backoffice_required' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'cvv_backoffice_required', 'type' => 'Boolean', + 'html_type' => 'radio', 'quick_form_type' => 'YesNo', 'default' => '1', 'add' => '4.1', @@ -223,7 +252,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'invoicing', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -231,14 +260,15 @@ function setting_getfields_expectedresult() { 'title' => 'Enable Tax and Invoicing', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => '', + 'on_change' => [ + '0' => 'CRM_Invoicing_Utils::onToggle', + ], ], 'acl_financial_type' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'acl_financial_type', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -248,12 +278,15 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => '', 'help_text' => '', + 'help' => [ + 'id' => 'acl_financial_type', + ], ], 'deferred_revenue_enabled' => [ 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'deferred_revenue_enabled', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -269,10 +302,10 @@ function setting_getfields_expectedresult() { 'group' => 'contribute', 'name' => 'default_invoice_page', 'type' => 'Integer', - 'quick_form_type' => 'Element', + 'quick_form_type' => 'Select', 'default' => '', 'pseudoconstant' => [ - 'name' => 'contributionPage', + 'callback' => 'CRM_Contribute_PseudoConstant::contributionPage', ], 'html_type' => 'select', 'add' => '4.7', @@ -286,7 +319,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'always_post_to_accounts_receivable', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -301,7 +334,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Contribute Preferences', 'group' => 'contribute', 'name' => 'update_contribution_on_membership_type_change', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'quick_form_type' => 'Element', 'default' => 0, @@ -326,8 +359,9 @@ function setting_getfields_expectedresult() { 'title' => 'Viewing Contacts', 'is_domain' => '1', 'is_contact' => 0, - 'description' => '', + 'description' => 'Select the tabs that should be displayed when viewing a contact record. EXAMPLE: If your organization does not keep track of \'Relationships\', then un-check this option to simplify the screen display. Tabs for Contributions, Pledges, Memberships, Events, Grants and Cases are also hidden if the corresponding component is not enabled. Go to Administer > System Settings > Enable Components to modify the components which are available for your site.', 'help_text' => '', + 'serialize' => 1, ], 'contact_edit_options' => [ 'group_name' => 'CiviCRM Preferences', @@ -343,11 +377,13 @@ function setting_getfields_expectedresult() { 'title' => 'Editing Contacts', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', + 'description' => 'Select the sections that should be included when adding or editing a contact record. EXAMPLE: If your organization does not record Gender and Birth Date for individuals, then simplify the form by un-checking this option. Drag interface allows you to change the order of the panes displayed on contact add/edit screen.', 'help_text' => '', + 'serialize' => 1, ], 'advanced_search_options' => [ 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', 'name' => 'advanced_search_options', 'type' => 'String', 'html_type' => 'checkboxes', @@ -359,8 +395,8 @@ function setting_getfields_expectedresult() { 'title' => 'Contact Search', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => '', + 'description' => 'Select the sections that should be included in the Basic and Advanced Search forms. EXAMPLE: If you don\'t track Relationships - then you do not need this section included in the advanced search form. Simplify the form by un-checking this option.', + 'serialize' => 1, ], 'user_dashboard_options' => [ 'group_name' => 'CiviCRM Preferences', @@ -376,32 +412,34 @@ function setting_getfields_expectedresult() { 'title' => 'Contact Dashboard', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', + 'description' => 'Select the sections that should be included in the Contact Dashboard. EXAMPLE: If you don\'t want constituents to view their own contribution history, un-check that option.', 'help_text' => '', + 'serialize' => 1, ], 'address_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'address_options', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'optionGroupName' => 'address_options', ], 'default' => '123456891011', 'add' => '4.1', - 'title' => 'Addressing Options', + 'title' => 'Address Fields', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', 'help_text' => '', + 'serialize' => 1, ], 'address_format' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'address_format', 'type' => 'String', - 'html_type' => 'TextArea', + 'html_type' => 'textarea', 'default' => '{contact.address_name} {contact.street_address} {contact.supplemental_address_1} @@ -410,7 +448,7 @@ function setting_getfields_expectedresult() { {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', 'add' => '4.1', - 'title' => 'Address Format', + 'title' => 'Address Display Format', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -421,7 +459,7 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'mailing_format', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'textarea', 'default' => '{contact.addressee} {contact.street_address} {contact.supplemental_address_1} @@ -430,7 +468,7 @@ function setting_getfields_expectedresult() { {contact.city}{, }{contact.state_province}{ }{contact.postal_code} {contact.country}', 'add' => '4.1', - 'title' => 'Mailing Format', + 'title' => 'Mailing Label Format', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -441,28 +479,26 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'display_name_format', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'textarea', 'default' => '{contact.individual_prefix}{ }{contact.first_name}{ }{contact.last_name}{ }{contact.individual_suffix}', 'add' => '4.1', - 'title' => 'Display Name Format', + 'title' => 'Individual Display Name Format', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => '', + 'description' => 'Display name format for individual contact display names.', ], 'sort_name_format' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'sort_name_format', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'textarea', 'default' => '{contact.last_name}{, }{contact.first_name}', 'add' => '4.1', - 'title' => 'Sort Name Format', + 'title' => 'Individual Sort Name Format', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', - 'help_text' => '', + 'description' => 'Sort name format for individual contact display names.', ], 'remote_profile_submissions' => [ 'group_name' => 'CiviCRM Preferences', @@ -485,13 +521,13 @@ function setting_getfields_expectedresult() { 'name' => 'allow_alert_autodismissal', 'type' => 'Boolean', 'quick_form_type' => 'YesNo', - 'default' => '1', + 'default' => TRUE, 'html_type' => 'radio', 'add' => '4.7', 'title' => 'Allow alerts to auto-dismiss?', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'If disabled, alert messages in CiviCRM will never be automatically dismissed after 10 seconds.', + 'description' => 'If disabled, CiviCRM will not automatically dismiss any alerts after 10 seconds.', 'help_text' => '', ], 'editor_id' => [ @@ -499,10 +535,14 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'editor_id', 'type' => 'String', - 'html_type' => 'Select', + 'html_type' => 'select', 'default' => 'CKEditor', 'add' => '4.1', 'title' => 'Wysiwig Editor', + 'pseudoconstant' => [ + 'optionGroupName' => 'wysiwyg_editor', + 'keyColumn' => 'name', + ], 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -513,24 +553,29 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'contact_ajax_check_similar', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'radio', 'default' => '1', 'add' => '4.1', - 'title' => 'Ajax Check Similar', + 'title' => 'Check for Similar Contacts', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', 'help_text' => '', + 'options' => [ + '1' => 'While Typing', + '0' => 'When Saving', + '2' => 'Never', + ], ], 'ajaxPopupsEnabled' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'ajaxPopupsEnabled', 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', + 'html_type' => 'checkbox', 'default' => 1, 'add' => '4.5', - 'title' => 'Ajax Popups Enabled', + 'title' => 'Enable Popup Forms', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -540,8 +585,8 @@ function setting_getfields_expectedresult() { 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'activity_assignee_notification', - 'type' => 'String', - 'html_type' => 'Text', + 'type' => 'Boolean', + 'html_type' => 'checkbox', 'default' => '1', 'add' => '4.1', 'title' => 'Notify Activity Assignees', @@ -554,8 +599,8 @@ function setting_getfields_expectedresult() { 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'activity_assignee_notification_ics', - 'type' => 'String', - 'html_type' => 'Text', + 'type' => 'Boolean', + 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.3', 'title' => 'Include ICal Invite to Activity Assignees', @@ -569,7 +614,7 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'contact_autocomplete_options', 'type' => 'String', - 'quick_form_type' => 'CheckBox', + 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Search::getContactAutocompleteOptions', ], @@ -580,13 +625,15 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Selected fields will be displayed in back-office autocomplete dropdown search results (Quick Search, etc.). Contact Name is always included.', 'help_text' => '', + 'serialize' => 1, + 'validate_callback' => 'CRM_Admin_Form_Setting_Search::enableOptionOne', ], 'contact_reference_options' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'contact_reference_options', 'type' => 'String', - 'quick_form_type' => 'CheckBox', + 'html_type' => 'checkboxes', 'pseudoconstant' => [ 'callback' => 'CRM_Admin_Form_Setting_Search::getContactReferenceOptions', ], @@ -597,6 +644,8 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Selected fields will be displayed in autocomplete dropdown search results for \'Contact Reference\' custom fields. Contact Name is always included. NOTE: You must assign \'access contact reference fields\' permission to the anonymous role if you want to use custom contact reference fields in profiles on public pages. For most situations, you should use the \'Limit List to Group\' setting when configuring a contact reference field which will be used in public forms to prevent exposing your entire contact list.', 'help_text' => '', + 'serialize' => 1, + 'validate_callback' => 'CRM_Admin_Form_Setting_Search::enableOptionOne', ], 'contact_smart_group_display' => [ 'group_name' => 'CiviCRM Preferences', @@ -609,8 +658,11 @@ function setting_getfields_expectedresult() { 'title' => 'Viewing Smart Groups', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', + 'description' => 'Controls display of the smart groups that a contact is part of in each contact\'s \"Groups\" tab. \"Show on Demand\" provides the best performance, and is recommended for most sites.', 'help_text' => '', + 'pseudoconstant' => [ + 'optionGroupName' => 'contact_smart_group_display', + ], ], 'smart_group_cache_refresh_mode' => [ 'group_name' => 'CiviCRM Preferences', @@ -661,7 +713,7 @@ function setting_getfields_expectedresult() { 'title' => 'Maximum Attachments', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'Maximum number of files (documents, images, etc.) which can attached to emails or activities.', + 'description' => 'Maximum number of files (documents, images, etc.) which can be attached to emails or activities.', 'help_text' => '', ], 'maxFileSize' => [ @@ -680,7 +732,7 @@ function setting_getfields_expectedresult() { 'title' => 'Maximum File Size (in MB)', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'Maximum Size of file (documents, images, etc.) which can attached to emails or activities.<br />Note: php.ini should support this file size.', + 'description' => 'Maximum Size of file (documents, images, etc.) which can be attached to emails or activities.<br />Note: php.ini should support this file size.', 'help_text' => '', ], 'contact_undelete' => [ @@ -770,7 +822,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 256, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.3', 'title' => 'Path to wkhtmltopdf executable', @@ -789,7 +841,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 64, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.3', 'title' => 'Recaptcha Options', @@ -808,7 +860,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 64, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.3', 'title' => 'Recaptcha Site Key', @@ -817,6 +869,21 @@ function setting_getfields_expectedresult() { 'description' => '', 'help_text' => '', ], + 'forceRecaptcha' => [ + 'add' => '4.7', + 'help_text' => '', + 'is_domain' => 1, + 'is_contact' => 0, + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'forceRecaptcha', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'html_type' => '', + 'default' => 0, + 'title' => 'Force reCAPTCHA on Contribution pages', + 'description' => 'If enabled, reCAPTCHA will show on all contribution pages.', + ], 'recaptchaPrivateKey' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', @@ -827,7 +894,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 64, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '', 'add' => '4.3', 'title' => 'Recaptcha Secret Key', @@ -846,7 +913,7 @@ function setting_getfields_expectedresult() { 'size' => 2, 'maxlength' => 8, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 7, 'add' => '4.3', 'title' => 'Checksum Lifespan', @@ -865,7 +932,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 128, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '*default*', 'add' => '4.3', 'title' => 'Blog Feed URL', @@ -884,7 +951,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 128, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '*default*', 'add' => '4.3', 'title' => 'Community Messages URL', @@ -903,7 +970,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 128, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => '*default*', 'add' => '4.3', 'title' => 'Getting Started URL', @@ -990,13 +1057,7 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'enable_components', 'type' => 'Array', - 'quick_form_type' => 'Element', - 'html_type' => 'advmultiselect', - 'html_attributes' => [ - 'size' => 5, - 'style' => 'width:150px', - 'class' => 'advmultiselect', - ], + 'html_type' => 'checkboxes', 'default' => '', 'add' => '4.4', 'title' => 'Enable Components', @@ -1009,6 +1070,9 @@ function setting_getfields_expectedresult() { '1' => 'CRM_Core_Component::flushEnabledComponents', '2' => 'call://resources/resetCacheCode', ], + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::getComponentSelectValues', + ], ], 'disable_core_css' => [ 'group_name' => 'CiviCRM Preferences', @@ -1117,7 +1181,7 @@ function setting_getfields_expectedresult() { 'size' => '32', 'maxlength' => '64', ], - 'default' => '', + 'default' => 'users', 'title' => 'CMS Users Table Name', 'description' => '', ], @@ -1231,29 +1295,160 @@ function setting_getfields_expectedresult() { 'group' => 'core', 'name' => 'syncCMSEmail', 'type' => 'Boolean', + 'html_type' => 'YesNo', 'quick_form_type' => 'YesNo', 'default' => 1, 'add' => '4.7', 'title' => 'Sync CMS Email', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'If enabled, then CMS email id will be syncronised with CiviCRM contacts\'s primary email.', + 'description' => 'If enabled, then CMS email id will be synchronised with CiviCRM contacts\'s primary email.', 'help_text' => '', ], 'preserve_activity_tab_filter' => [ 'group_name' => 'CiviCRM Preferences', 'group' => 'core', 'name' => 'preserve_activity_tab_filter', - 'type' => 'String', - 'html_type' => 'Text', + 'type' => 'Boolean', + 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.7', 'title' => 'Preserve activity filters as a user preference', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts', + 'description' => 'When enabled, any filter settings a user selects on the contact\'s Activity tab will be remembered as they visit other contacts.', + ], + 'do_not_notify_assignees_for' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'do_not_notify_assignees_for', + 'type' => 'Array', + 'add' => '4.7', + 'is_domain' => 1, + 'is_contact' => 0, + 'default' => [], + 'title' => 'Do not notify assignees for', + 'description' => 'These activity types will be excluded from automated email notifications to assignees.', + 'html_type' => 'select', + 'html_attributes' => [ + 'multiple' => 1, + 'class' => 'huge crm-select2', + ], + 'pseudoconstant' => [ + 'optionGroupName' => 'activity_type', + ], + 'quick_form_type' => 'Select', + ], + 'menubar_position' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'menubar_position', + 'type' => 'String', + 'html_type' => 'select', + 'default' => 'over-cms-menu', + 'add' => '5.12', + 'title' => 'Menubar position', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Location of the CiviCRM main menu.', + 'help_text' => '', + 'options' => [ + 'over-cms-menu' => 'Replace website menu', + 'below-cms-menu' => 'Below website menu', + 'above-crm-container' => 'Above content area', + 'none' => 'None - disable menu', + ], + ], + 'menubar_color' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'menubar_color', + 'type' => 'String', + 'html_type' => 'color', + 'default' => '#1b1b1b', + 'add' => '5.13', + 'title' => 'Menubar color', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Color of the CiviCRM main menu.', + 'help_text' => '', + 'validate_callback' => 'CRM_Utils_Color::normalize', + ], + 'requestableMimeTypes' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'requestableMimeTypes', + 'type' => 'String', + 'html_type' => 'Text', + 'default' => 'image/jpeg,image/pjpeg,image/gif,image/x-png,image/png,image/jpg,text/html,application/pdf', + 'add' => '5.13', + 'title' => 'Mime Types that can be passed as URL params', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Acceptable Mime Types that can be used as part of file urls', + 'help_text' => '', + ], + 'theme_frontend' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'theme_frontend', + 'type' => 'String', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => [ + 'class' => 'crm-select2', + ], + 'pseudoconstant' => [ + 'callback' => 'call://themes/getAvailable', + ], + 'default' => 'default', + 'add' => '5.16', + 'title' => 'Frontend Theme', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Theme to use on frontend pages', 'help_text' => '', ], + 'theme_backend' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'theme_backend', + 'type' => 'String', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => [ + 'class' => 'crm-select2', + ], + 'pseudoconstant' => [ + 'callback' => 'call://themes/getAvailable', + ], + 'default' => 'default', + 'add' => '5.16', + 'title' => 'Backend Theme', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Theme to use on backend pages', + 'help_text' => '', + ], + 'http_timeout' => [ + 'group_name' => 'CiviCRM Preferences', + 'group' => 'core', + 'name' => 'http_timeout', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => [ + 'size' => 2, + 'maxlength' => 3, + ], + 'default' => 5, + 'add' => '5.14', + 'title' => 'HTTP request timeout', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'How long should HTTP requests through Guzzle application run for in seconds', + 'help_text' => 'Set the number of seconds http requests should run for before terminating', + ], 'assetCache' => [ 'group_name' => 'Developer Preferences', 'group' => 'developer', @@ -1315,6 +1510,26 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Set this value to Yes if you want to display a backtrace listing when a fatal error is encountered. This feature should NOT be enabled for production sites', ], + 'environment' => [ + 'group_name' => 'Developer Preferences', + 'group' => 'developer', + 'name' => 'environment', + 'type' => 'String', + 'html_type' => 'Select', + 'quick_form_type' => 'Select', + 'default' => 'Production', + 'pseudoconstant' => [ + 'optionGroupName' => 'environment', + ], + 'add' => '4.7', + 'title' => 'Environment', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Setting to define the environment in which this CiviCRM instance is running.', + 'on_change' => [ + '0' => 'CRM_Core_BAO_Setting::onChangeEnvironmentSetting', + ], + ], 'fatalErrorHandler' => [ 'group_name' => 'Developer Preferences', 'group' => 'developer', @@ -1335,7 +1550,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'uploadDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1351,7 +1566,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'imageUploadDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1367,7 +1582,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'customFileUploadDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1383,7 +1598,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'customTemplateDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1399,7 +1614,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'customPHPPathDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1415,7 +1630,7 @@ function setting_getfields_expectedresult() { 'group' => 'directory', 'name' => 'extensionsDir', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -1428,23 +1643,37 @@ function setting_getfields_expectedresult() { 'enable_cart' => [ 'name' => 'enable_cart', 'group_name' => 'Event Preferences', + 'settings_pages' => [ + 'event' => [ + 'weight' => 10, + ], + ], 'group' => 'event', 'type' => 'Boolean', - 'quick_form_type' => 'Element', + 'quick_form_type' => 'CheckBox', 'default' => 0, 'add' => '4.1', - 'title' => 'Enable Event Cart', + 'title' => 'Use Shopping Cart Style Event Registration', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'WRITE ME', - 'help_text' => 'WRITE ME', + 'description' => 'This feature allows users to register for more than one event at a time. When enabled, users will add event(s) to a \"cart\" and then pay for them all at once. Enabling this setting will affect online registration for all active events. The code is an alpha state, and you will potentially need to have developer resources to debug and fix sections of the codebase while testing and deploying it', + 'help_text' => '', + 'documentation_link' => [ + 'page' => 'CiviEvent Cart Checkout', + 'resource' => 'wiki', + ], ], 'show_events' => [ 'name' => 'show_events', 'group_name' => 'Event Preferences', 'group' => 'event', + 'settings_pages' => [ + 'event' => [ + 'weight' => 20, + ], + ], 'type' => 'Integer', - 'quick_form_type' => 'Element', + 'quick_form_type' => 'Select', 'default' => 10, 'add' => '4.5', 'title' => 'Dashboard entries', @@ -1453,6 +1682,9 @@ function setting_getfields_expectedresult() { 'is_contact' => 0, 'description' => 'Configure how many events should be shown on the dashboard. This overrides the default value of 10 entries.', 'help_text' => '', + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::getDashboardEntriesCount', + ], ], 'ext_repo_url' => [ 'group_name' => 'Extension Preferences', @@ -1464,7 +1696,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 128, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'https://civicrm.org/extdir/ver={ver}|cms={uf}', 'add' => '4.3', 'title' => 'Extension Repo URL', @@ -1590,11 +1822,11 @@ function setting_getfields_expectedresult() { 'quick_form_type' => 'Select', 'html_type' => 'Select', 'html_attributes' => [], - 'default' => '1228', 'add' => '4.4', 'title' => 'Default Country', 'is_domain' => 1, 'is_contact' => 0, + 'is_required' => '', 'description' => 'This value is selected by default when adding a new contact address.', 'help_text' => '', 'pseudoconstant' => [ @@ -1874,6 +2106,28 @@ function setting_getfields_expectedresult() { 'callback' => 'CRM_Core_I18n::languages', ], ], + 'uiLanguages' => [ + 'group_name' => 'Localization Preferences', + 'group' => 'localization', + 'name' => 'uiLanguages', + 'type' => 'Array', + 'quick_form_type' => 'Select', + 'html_type' => 'select', + 'html_attributes' => [ + 'multiple' => 1, + 'class' => 'crm-select2', + ], + 'default' => '', + 'add' => '5.9', + 'title' => 'Available Languages', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => '', + 'help_text' => 'User Interface languages available to users', + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_I18n::languages', + ], + ], 'lcMessages' => [ 'group_name' => 'Localization Preferences', 'group' => 'localization', @@ -1981,7 +2235,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'profile_double_optin', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => '1', 'add' => '4.1', @@ -1995,7 +2249,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'track_civimail_replies', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.1', @@ -2010,25 +2264,25 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'civimail_workflow', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.1', - 'title' => 'Use CiviMail Workflow', + 'title' => 'Enable workflow support for CiviMail', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'description' => 'Drupal-only. Rules module must be enabled (beta feature - use with caution).', 'help_text' => '', ], 'civimail_server_wide_lock' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'civimail_server_wide_lock', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.1', - 'title' => 'Lock Mails Server-Wide for Mail Sending', + 'title' => 'Enable global server wide lock for CiviMail', 'is_domain' => 1, 'is_contact' => 0, 'description' => '', @@ -2068,21 +2322,21 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'profile_add_to_group_double_optin', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.1', - 'title' => 'Enable Double Opt-in for Profile Group(s) field', + 'title' => 'Enable Double Opt-in for Profiles which use the \"Add to Group\" setting', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'When CiviMail is enabled, users who \"subscribe\" to a group from a profile Group(s) checkbox will receive a confirmation email. They must respond (opt-in) before they are added to the group.', + 'description' => 'When CiviMail is enabled and a profile uses the \"Add to Group\" setting, users who complete the profile form will receive a confirmation email. They must respond (opt-in) before they are added to the group.', 'help_text' => '', ], 'disable_mandatory_tokens_check' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'disable_mandatory_tokens_check', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.4', @@ -2096,7 +2350,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'dedupe_email_default', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 1, 'add' => '4.5', @@ -2110,7 +2364,7 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'hash_mailing_url', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.5', @@ -2124,21 +2378,21 @@ function setting_getfields_expectedresult() { 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'civimail_multiple_bulk_emails', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => 0, 'add' => '4.5', - 'title' => ' Multiple Bulk Emails', + 'title' => 'Enable multiple bulk email address for a contact.', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'If enabled, CiviMail will deliver a copy of the email to each bulk email listed for the contact.', + 'description' => 'CiviMail will deliver a copy of the email to each bulk email listed for the contact. Enabling this setting will also change the options for the \"Email on Hold\" field in Advanced Search.', 'help_text' => '', ], 'include_message_id' => [ 'group_name' => 'Mailing Preferences', 'group' => 'mailing', 'name' => 'include_message_id', - 'type' => 'Integer', + 'type' => 'Boolean', 'html_type' => 'checkbox', 'default' => '', 'add' => '4.5', @@ -2248,7 +2502,8 @@ function setting_getfields_expectedresult() { 'group' => 'mailing', 'name' => 'write_activity_record', 'type' => 'Boolean', - 'quick_form_type' => 'YesNo', + 'html_type' => 'checkbox', + 'quick_form_type' => 'CheckBox', 'default' => '1', 'add' => '4.7', 'title' => 'Enable CiviMail to create activities on delivery', @@ -2275,6 +2530,33 @@ function setting_getfields_expectedresult() { 'description' => 'The number of emails sendable via simple mail. Make sure you understand the implications for your spam reputation and legal requirements for bulk emails before editing. As there is some risk both to your spam reputation and the products if this is misused it is a hidden setting', 'help_text' => 'CiviCRM forces users sending more than this number of mails to use CiviMails. CiviMails have additional precautions: not sending to contacts who do not want bulk mail, adding domain name and opt out links. You should familiarise yourself with the law relevant to you on bulk mailings if changing this setting. For the US https://en.wikipedia.org/wiki/CAN-SPAM_Act_of_2003 is a good place to start.', ], + 'auto_recipient_rebuild' => [ + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'auto_recipient_rebuild', + 'type' => 'Boolean', + 'html_type' => 'checkbox', + 'quick_form_type' => 'CheckBox', + 'default' => '1', + 'title' => 'Enable automatic CiviMail recipient count display', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Enable this setting to rebuild recipient list automatically during composing mail. Disable will allow you to rebuild recipient manually.', + 'help_text' => 'CiviMail automatically fetches recipient list and count whenever mailing groups are included or excluded while composing bulk mail. This phenomena may degrade performance for large sites, so disable this setting to build and fetch recipients for selected groups, manually.', + ], + 'allow_mail_from_logged_in_contact' => [ + 'group_name' => 'Mailing Preferences', + 'group' => 'mailing', + 'name' => 'allow_mail_from_logged_in_contact', + 'type' => 'Boolean', + 'quick_form_type' => 'YesNo', + 'default' => 1, + 'title' => 'Allow mail from logged in contact', + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => 'Allow sending email from the logged in contact\'s email address', + 'help_text' => 'CiviCRM allows you to send email from the domain from email addresses and the logged in contact id addresses by default. Disable this if you only want to allow the domain from addresses to be used.', + ], 'geoAPIKey' => [ 'add' => '4.7', 'help_text' => '', @@ -2360,10 +2642,10 @@ function setting_getfields_expectedresult() { 'group' => 'member', 'name' => 'default_renewal_contribution_page', 'type' => 'Integer', - 'html_type' => 'Select', + 'html_type' => 'select', 'default' => '', 'pseudoconstant' => [ - 'name' => 'contributionPage', + 'callback' => 'CRM_Contribute_PseudoConstant::contributionPage', ], 'add' => '4.1', 'title' => 'Default online membership renewal page', @@ -2376,14 +2658,24 @@ function setting_getfields_expectedresult() { 'group_name' => 'Multi Site Preferences', 'group' => 'multisite', 'name' => 'is_enabled', - 'title' => 'Multisite Is enabled', - 'type' => 'Integer', + 'title' => 'Enable Multi Site Configuration', + 'html_type' => 'checkbox', + 'type' => 'Boolean', 'default' => 0, 'add' => '4.1', 'is_domain' => 1, 'is_contact' => 0, - 'description' => 'Multisite is enabled', + 'description' => 'Make CiviCRM aware of multiple domains. You should configure a domain group if enabled', + 'documentation_link' => [ + 'page' => 'Multi Site Installation', + 'resource' => 'wiki', + ], 'help_text' => '', + 'settings_pages' => [ + 'multisite' => [ + 'weight' => 10, + ], + ], ], 'domain_group_id' => [ 'group_name' => 'Multi Site Preferences', @@ -2391,12 +2683,24 @@ function setting_getfields_expectedresult() { 'name' => 'domain_group_id', 'title' => 'Multisite Domain Group', 'type' => 'Integer', + 'html_type' => 'entity_reference', + 'entity_reference_options' => [ + 'entity' => 'Group', + 'select' => [ + 'minimumInputLength' => 0, + ], + ], 'default' => 0, 'add' => '4.1', 'is_domain' => 1, 'is_contact' => 0, - 'description' => '', + 'description' => 'Contacts created on this site are added to this group', 'help_text' => '', + 'settings_pages' => [ + 'multisite' => [ + 'weight' => 20, + ], + ], ], 'event_price_set_domain_id' => [ 'group_name' => 'Multi Site Preferences', @@ -2430,11 +2734,7 @@ function setting_getfields_expectedresult() { 'name' => 'search_autocomplete_count', 'type' => 'Integer', 'quick_form_type' => 'Element', - 'html_type' => 'text', - 'html_attributes' => [ - 'size' => 2, - 'maxlength' => 2, - ], + 'html_type' => 'number', 'default' => 10, 'add' => '4.3', 'title' => 'Autocomplete Results', @@ -2473,7 +2773,7 @@ function setting_getfields_expectedresult() { 'size' => 64, 'maxlength' => 64, ], - 'html_type' => 'Text', + 'html_type' => 'text', 'default' => 'simple', 'add' => '4.5', 'title' => 'How to handle full-tet queries', @@ -2558,7 +2858,7 @@ function setting_getfields_expectedresult() { 'name' => 'smartGroupCacheTimeout', 'type' => 'Integer', 'quick_form_type' => 'Element', - 'html_type' => 'text', + 'html_type' => 'number', 'default' => 5, 'add' => '4.6', 'title' => 'Smart group cache timeout', @@ -2588,6 +2888,25 @@ function setting_getfields_expectedresult() { 'description' => 'If set, this will be the default profile used for contact search.', 'help_text' => '', ], + 'prevNextBackend' => [ + 'group_name' => 'Search Preferences', + 'group' => 'Search Preferences', + 'name' => 'prevNextBackend', + 'type' => 'String', + 'quick_form_type' => 'Select', + 'html_type' => 'Select', + 'html_attributes' => [], + 'default' => 'default', + 'add' => '5.9', + 'title' => 'PrevNext Cache', + 'is_domain' => 1, + 'is_contact' => 0, + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_BAO_PrevNextCache::getPrevNextBackends', + ], + 'description' => 'When performing a search, how should the search-results be cached?', + 'help_text' => '', + ], 'searchPrimaryDetailsOnly' => [ 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', @@ -2602,6 +2921,37 @@ function setting_getfields_expectedresult() { 'description' => 'If enabled, only primary details (eg contact\'s primary email, phone, etc) will be included in Basic and Advanced Search results. Disabling this feature will allow users to match contacts using any email, phone etc detail.', 'help_text' => '', ], + 'quicksearch_options' => [ + 'group_name' => 'Search Preferences', + 'group' => 'Search Preferences', + 'name' => 'quicksearch_options', + 'type' => 'string', + 'serialize' => 1, + 'html_type' => 'checkboxes', + 'sortable' => TRUE, + 'pseudoconstant' => [ + 'callback' => 'CRM_Core_SelectValues::quicksearchOptions', + ], + 'default' => [ + '0' => 'sort_name', + '1' => 'contact_id', + '2' => 'external_identifier', + '3' => 'first_name', + '4' => 'last_name', + '5' => 'email', + '6' => 'phone_numeric', + '7' => 'street_address', + '8' => 'city', + '9' => 'postal_code', + '10' => 'job_title', + ], + 'add' => '5.8', + 'title' => 'Quicksearch options', + 'is_domain' => '1', + 'is_contact' => 0, + 'description' => 'Which fields can be searched on in the menubar quicksearch box? Don\'t see your custom field here? Make sure it is marked as Searchable.', + 'help_text' => '', + ], 'userFrameworkResourceURL' => [ 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', 'group' => 'url', @@ -2609,7 +2959,7 @@ function setting_getfields_expectedresult() { 'name' => 'userFrameworkResourceURL', 'title' => 'CiviCRM Resource URL', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -2626,7 +2976,7 @@ function setting_getfields_expectedresult() { 'title' => 'Image Upload URL', 'name' => 'imageUploadURL', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -2643,7 +2993,7 @@ function setting_getfields_expectedresult() { 'name' => 'customCSSURL', 'title' => 'Custom CSS URL', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -2660,7 +3010,7 @@ function setting_getfields_expectedresult() { 'title' => 'Extension Resource URL', 'name' => 'extensionsURL', 'type' => 'String', - 'html_type' => 'Text', + 'html_type' => 'text', 'quick_form_type' => 'Element', 'default' => '', 'add' => '4.1', @@ -2683,17 +3033,17 @@ function setting_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetSettingCurrentDomain.php b/civicrm/api/v3/examples/Setting/GetSettingCurrentDomain.php index de514afdc27f6bda70f3fcfbcb52dfb123df0e01..bc808c71efd1e243172ab0b6a2910f47b9d1bcc2 100644 --- a/civicrm/api/v3/examples/Setting/GetSettingCurrentDomain.php +++ b/civicrm/api/v3/examples/Setting/GetSettingCurrentDomain.php @@ -61,17 +61,17 @@ function setting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetSpecifiedDomains.php b/civicrm/api/v3/examples/Setting/GetSpecifiedDomains.php index 9de1adaef0f5859f7957ac5892c44ad98dbd530f..1257cc53dee409ea6a1759b9972babf6b5ee7555 100644 --- a/civicrm/api/v3/examples/Setting/GetSpecifiedDomains.php +++ b/civicrm/api/v3/examples/Setting/GetSpecifiedDomains.php @@ -69,17 +69,17 @@ function setting_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/GetValue.php b/civicrm/api/v3/examples/Setting/GetValue.php index a5534bcac960f65713222109b3d557f678bbe8be..ef75b6a9e93b483627429561b02e6c60ebd0982e 100644 --- a/civicrm/api/v3/examples/Setting/GetValue.php +++ b/civicrm/api/v3/examples/Setting/GetValue.php @@ -52,17 +52,17 @@ function setting_getvalue_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Setting/Revert.php b/civicrm/api/v3/examples/Setting/Revert.php index de5aa88ffa35363c4bd3e1f6989d5ed4317e4974..7535db2a82f7fb67213ac7435a38a61ad356d65a 100644 --- a/civicrm/api/v3/examples/Setting/Revert.php +++ b/civicrm/api/v3/examples/Setting/Revert.php @@ -73,17 +73,17 @@ function setting_revert_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SettingTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StateProvince/Create.php b/civicrm/api/v3/examples/StateProvince/Create.php index f84cd70bf28a4bacf6e60ba9bc5f845784bbf2a7..d2a3e6c487062a9aa7dcc44abf9b8f43f7717759 100644 --- a/civicrm/api/v3/examples/StateProvince/Create.php +++ b/civicrm/api/v3/examples/StateProvince/Create.php @@ -43,10 +43,10 @@ function state_province_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 13947, + 'id' => 14033, 'values' => [ - '13947' => [ - 'id' => '13947', + '14033' => [ + 'id' => '14033', 'name' => 'Wessex', 'abbreviation' => 'WEX', 'country_id' => '1226', @@ -64,17 +64,17 @@ function state_province_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StateProvinceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StateProvince/Delete.php b/civicrm/api/v3/examples/StateProvince/Delete.php index 38863c43c8c4a4cbc9b71ad385f27bea88cb5df6..9628de2efb80748844407dcb75b701645f495a6b 100644 --- a/civicrm/api/v3/examples/StateProvince/Delete.php +++ b/civicrm/api/v3/examples/StateProvince/Delete.php @@ -7,7 +7,7 @@ */ function state_province_delete_example() { $params = [ - 'id' => 13948, + 'id' => 14034, ]; try{ @@ -54,17 +54,17 @@ function state_province_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StateProvinceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StateProvince/Get.php b/civicrm/api/v3/examples/StateProvince/Get.php index 7cdf17e9cabdb5437c0a76c93fab52c578ec8f34..3d3508aadc6d49d0a9f50533b48b8e9b54deb492 100644 --- a/civicrm/api/v3/examples/StateProvince/Get.php +++ b/civicrm/api/v3/examples/StateProvince/Get.php @@ -41,10 +41,10 @@ function state_province_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 13949, + 'id' => 14035, 'values' => [ - '13949' => [ - 'id' => '13949', + '14035' => [ + 'id' => '14035', 'name' => 'Wessex', 'abbreviation' => 'WEX', 'country_id' => '1226', @@ -62,17 +62,17 @@ function state_province_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StateProvinceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StatusPreference/Create.php b/civicrm/api/v3/examples/StatusPreference/Create.php index d217d25a1572b6db09b0945546dad9fb2474a3b5..a18cc05451e92c7c3e0349f494526f51835ff631 100644 --- a/civicrm/api/v3/examples/StatusPreference/Create.php +++ b/civicrm/api/v3/examples/StatusPreference/Create.php @@ -69,17 +69,17 @@ function status_preference_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StatusPreferenceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StatusPreference/Delete.php b/civicrm/api/v3/examples/StatusPreference/Delete.php index 14afaefcda88f229ea7472f388569f5eef4daeea..3a7916de06e43c7e8df11b24de9d4cad6598f7c3 100644 --- a/civicrm/api/v3/examples/StatusPreference/Delete.php +++ b/civicrm/api/v3/examples/StatusPreference/Delete.php @@ -54,17 +54,17 @@ function status_preference_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StatusPreferenceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/StatusPreference/Get.php b/civicrm/api/v3/examples/StatusPreference/Get.php index 8393a062f2e2423c639207986ee5082784dff9ec..63c7503263276d467f5e1d55e969bc513e5789e6 100644 --- a/civicrm/api/v3/examples/StatusPreference/Get.php +++ b/civicrm/api/v3/examples/StatusPreference/Get.php @@ -63,17 +63,17 @@ function status_preference_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/StatusPreferenceTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Survey/ChainedGetDelete.php b/civicrm/api/v3/examples/Survey/ChainedGetDelete.php index 222a49d2516d38c19ef77fd65b80d2898d597bd2..a0b99eaede24dfbc0cf7d2f9664a9eb27731a224 100644 --- a/civicrm/api/v3/examples/Survey/ChainedGetDelete.php +++ b/civicrm/api/v3/examples/Survey/ChainedGetDelete.php @@ -77,17 +77,17 @@ function survey_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Survey/Create.php b/civicrm/api/v3/examples/Survey/Create.php index e4a4b55394b2d226e7e3728b4978d324eb9b1af8..98ef5d32474e694e2803ecf128cc57d33a11216e 100644 --- a/civicrm/api/v3/examples/Survey/Create.php +++ b/civicrm/api/v3/examples/Survey/Create.php @@ -81,17 +81,17 @@ function survey_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Survey/Delete.php b/civicrm/api/v3/examples/Survey/Delete.php index acc86f7fa6c41fbb8871bcd9edf01f466a1a6686..af49e79597b549a5ceb9030e25f27ee531f2ab25 100644 --- a/civicrm/api/v3/examples/Survey/Delete.php +++ b/civicrm/api/v3/examples/Survey/Delete.php @@ -54,17 +54,17 @@ function survey_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Survey/Get.php b/civicrm/api/v3/examples/Survey/Get.php index ca7cbdd56c88db7b41915fbec6d65f7a84b80d0e..a175e1473f40a9fcb84ca4abf983f0f9df07a9f4 100644 --- a/civicrm/api/v3/examples/Survey/Get.php +++ b/civicrm/api/v3/examples/Survey/Get.php @@ -71,17 +71,17 @@ function survey_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/SurveyRespondant/Get.php b/civicrm/api/v3/examples/SurveyRespondant/Get.php index 5fc87be96a592a9ee1a7a096fd4912d3ab8e230e..e54521f3aaf9c73dc815ebb5c51a972d79ae861d 100644 --- a/civicrm/api/v3/examples/SurveyRespondant/Get.php +++ b/civicrm/api/v3/examples/SurveyRespondant/Get.php @@ -59,17 +59,17 @@ function survey_respondant_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SurveyRespondantTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/System/Flush.php b/civicrm/api/v3/examples/System/Flush.php index e702ee259b137707024a2c32dcb8c92d61f5ff0b..34b2ce28f4665b40a2f8bdbcf7cdc5f4e752958f 100644 --- a/civicrm/api/v3/examples/System/Flush.php +++ b/civicrm/api/v3/examples/System/Flush.php @@ -54,17 +54,17 @@ function system_flush_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/SystemTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/Create.php b/civicrm/api/v3/examples/Tag/Create.php index fbdc03fb9e1ae024e42aebafffb2729371411841..3905455770cc4db02edf2929071e71253f025a50 100644 --- a/civicrm/api/v3/examples/Tag/Create.php +++ b/civicrm/api/v3/examples/Tag/Create.php @@ -42,16 +42,16 @@ function tag_create_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 12, + 'id' => 17, 'values' => [ - '12' => [ - 'id' => '12', + '17' => [ + 'id' => '17', 'name' => 'Super Heros', 'description' => 'Outside undie-wearers', 'parent_id' => '', - 'is_selectable' => '', - 'is_reserved' => '', - 'is_tagset' => '', + 'is_selectable' => '1', + 'is_reserved' => 0, + 'is_tagset' => 0, 'used_for' => 'civicrm_contact', 'created_id' => '', 'color' => '', @@ -70,17 +70,17 @@ function tag_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/Delete.php b/civicrm/api/v3/examples/Tag/Delete.php index cd6dd09b6a10ff49d7ea4281e79aae5f85da3b5b..2f8867db1fa107ddf5e0f5ddb632764b8f112a36 100644 --- a/civicrm/api/v3/examples/Tag/Delete.php +++ b/civicrm/api/v3/examples/Tag/Delete.php @@ -7,7 +7,7 @@ */ function tag_delete_example() { $params = [ - 'id' => '17', + 'id' => '24', ]; try{ @@ -54,17 +54,17 @@ function tag_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/Get.php b/civicrm/api/v3/examples/Tag/Get.php index 4c4ac2faf0c1186c0aa128737ac82673392a5a7b..c3d91f9dc21f5196f90b8e020097b5acfb7a0a77 100644 --- a/civicrm/api/v3/examples/Tag/Get.php +++ b/civicrm/api/v3/examples/Tag/Get.php @@ -7,7 +7,7 @@ */ function tag_get_example() { $params = [ - 'id' => '7', + 'id' => '8', 'name' => 'New Tag3', ]; @@ -42,10 +42,10 @@ function tag_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 7, + 'id' => 8, 'values' => [ - '7' => [ - 'id' => '7', + '8' => [ + 'id' => '8', 'name' => 'New Tag3', 'description' => 'This is description for Our New Tag ', 'is_selectable' => '1', @@ -67,17 +67,17 @@ function tag_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/GetFields.php b/civicrm/api/v3/examples/Tag/GetFields.php index 8636fb926de5706f568f27908a1e4fa55952e642..acf9b173f7e1706ea1c5a5dfbd266c6492ff81d2 100644 --- a/civicrm/api/v3/examples/Tag/GetFields.php +++ b/civicrm/api/v3/examples/Tag/GetFields.php @@ -50,9 +50,12 @@ function tag_getfields_expectedresult() { 'title' => 'Tag ID', 'description' => 'Tag ID', 'required' => TRUE, + 'where' => 'civicrm_tag.id', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'tag', ], @@ -65,9 +68,12 @@ function tag_getfields_expectedresult() { 'required' => TRUE, 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_tag.name', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.required' => 1, ], 'description' => [ @@ -77,20 +83,26 @@ function tag_getfields_expectedresult() { 'description' => 'Optional verbose description of the tag.', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_tag.description', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'parent_id' => [ 'name' => 'parent_id', 'type' => 1, 'title' => 'Parent Tag', 'description' => 'Optional parent id for this tag.', + 'where' => 'civicrm_tag.parent_id', 'default' => 'NULL', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, 'FKClassName' => 'CRM_Core_DAO_Tag', + 'is_core_field' => TRUE, 'FKApiName' => 'Tag', ], 'is_selectable' => [ @@ -98,26 +110,35 @@ function tag_getfields_expectedresult() { 'type' => 16, 'title' => 'Display Tag?', 'description' => 'Is this tag selectable / displayed', + 'where' => 'civicrm_tag.is_selectable', 'default' => '1', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'is_reserved' => [ 'name' => 'is_reserved', 'type' => 16, 'title' => 'Reserved', + 'where' => 'civicrm_tag.is_reserved', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'is_tagset' => [ 'name' => 'is_tagset', 'type' => 16, 'title' => 'Tagset', + 'where' => 'civicrm_tag.is_tagset', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'used_for' => [ 'name' => 'used_for', @@ -125,10 +146,13 @@ function tag_getfields_expectedresult() { 'title' => 'Used For', 'maxlength' => 64, 'size' => 30, + 'where' => 'civicrm_tag.used_for', 'default' => 'NULL', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'serialize' => 5, 'html' => [ 'type' => 'Select', 'maxlength' => 64, @@ -138,6 +162,7 @@ function tag_getfields_expectedresult() { 'optionGroupName' => 'tag_used_for', 'optionEditPath' => 'civicrm/admin/options/tag_used_for', ], + 'is_core_field' => TRUE, 'api.default' => 'civicrm_contact', ], 'created_id' => [ @@ -145,10 +170,13 @@ function tag_getfields_expectedresult() { 'type' => 1, 'title' => 'Tag Created By', 'description' => 'FK to civicrm_contact, who created this tag', + 'where' => 'civicrm_tag.created_id', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], 'color' => [ @@ -158,19 +186,25 @@ function tag_getfields_expectedresult() { 'description' => 'Hex color value e.g. #ffffff', 'maxlength' => 255, 'size' => 45, + 'where' => 'civicrm_tag.color', 'default' => 'NULL', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], 'created_date' => [ 'name' => 'created_date', 'type' => 12, 'title' => 'Tag Created Date', 'description' => 'Date and time that tag was created.', + 'where' => 'civicrm_tag.created_date', 'table_name' => 'civicrm_tag', 'entity' => 'Tag', 'bao' => 'CRM_Core_BAO_Tag', + 'localizable' => 0, + 'is_core_field' => TRUE, ], ], ]; @@ -185,17 +219,17 @@ function tag_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/GetList.php b/civicrm/api/v3/examples/Tag/GetList.php index 6c5b4b0394285a6a9062a11c6b0c06611d144f32..a1fc21953479f64295bd0a2f91506d8d72038428 100644 --- a/civicrm/api/v3/examples/Tag/GetList.php +++ b/civicrm/api/v3/examples/Tag/GetList.php @@ -49,7 +49,7 @@ function tag_getlist_expectedresult() { 'id' => 0, 'values' => [ '0' => [ - 'id' => '19', + 'id' => '27', 'label' => 'New Tag3', 'description' => [ '0' => 'This is description for Our New Tag ', @@ -73,17 +73,17 @@ function tag_getlist_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Tag/GetReturnArray.php b/civicrm/api/v3/examples/Tag/GetReturnArray.php index b4c541ce664fa265e04990e68d07e0dfa8e58384..88bb104708840841d9310947967efa9655fcfaac 100644 --- a/civicrm/api/v3/examples/Tag/GetReturnArray.php +++ b/civicrm/api/v3/examples/Tag/GetReturnArray.php @@ -9,7 +9,7 @@ */ function tag_get_example() { $params = [ - 'id' => '8', + 'id' => '10', 'name' => 'New Tag3', 'return' => [ '0' => 'name', @@ -47,10 +47,10 @@ function tag_get_expectedresult() { 'is_error' => 0, 'version' => 3, 'count' => 1, - 'id' => 8, + 'id' => 10, 'values' => [ - '8' => [ - 'id' => '8', + '10' => [ + 'id' => '10', 'name' => 'New Tag3', ], ], @@ -66,17 +66,17 @@ function tag_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/TagTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFField/Create.php b/civicrm/api/v3/examples/UFField/Create.php index 7dfa389705d5ad7a159e0fe078d82777f60ff7a8..a4eb8f0eedcb200a75566d3350ce13cf0333c6af 100644 --- a/civicrm/api/v3/examples/UFField/Create.php +++ b/civicrm/api/v3/examples/UFField/Create.php @@ -86,17 +86,17 @@ function uf_field_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFField/Delete.php b/civicrm/api/v3/examples/UFField/Delete.php index c84edce6b069a3039aed6ce7f1621c52ee0a791b..b25806af7542fe1bafdec6c4eb6971b09c1e0d19 100644 --- a/civicrm/api/v3/examples/UFField/Delete.php +++ b/civicrm/api/v3/examples/UFField/Delete.php @@ -54,17 +54,17 @@ function uf_field_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFField/Get.php b/civicrm/api/v3/examples/UFField/Get.php index 91bfa7db7c9fecb3295b57df31f91773be278120..fc537cc71d95d7ca199cf9f719947bc731370cd4 100644 --- a/civicrm/api/v3/examples/UFField/Get.php +++ b/civicrm/api/v3/examples/UFField/Get.php @@ -71,17 +71,17 @@ function uf_field_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFField/Replace.php b/civicrm/api/v3/examples/UFField/Replace.php index dd32472a619ae1110a38b6bc87c2e5419c72f038..f0230b225e4f1cde0a1a08745ecb8a21bc195459 100644 --- a/civicrm/api/v3/examples/UFField/Replace.php +++ b/civicrm/api/v3/examples/UFField/Replace.php @@ -152,17 +152,17 @@ function uf_field_replace_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFFieldTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFGroup/Create.php b/civicrm/api/v3/examples/UFGroup/Create.php index b514ca44c41b1f1b49b053c5fc6960acfc9c95ec..f4096f2ac134523d0ae9089a5eacaf0e877af349 100644 --- a/civicrm/api/v3/examples/UFGroup/Create.php +++ b/civicrm/api/v3/examples/UFGroup/Create.php @@ -67,6 +67,7 @@ function uf_group_create_expectedresult() { 'is_active' => 0, 'group_type' => 'Individual,Contact', 'title' => 'Test Group', + 'frontend_title' => '', 'description' => '', 'help_pre' => 'help pre', 'help_post' => 'help post', @@ -86,6 +87,9 @@ function uf_group_create_expectedresult() { 'created_id' => '1', 'created_date' => '2013-07-28 08:49:19', 'is_proximity_search' => '', + 'cancel_button_text' => '', + 'submit_button_text' => '', + 'add_cancel_button' => '', ], ], ]; @@ -100,17 +104,17 @@ function uf_group_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFGroup/Delete.php b/civicrm/api/v3/examples/UFGroup/Delete.php index 58ee2e9cdbce819d18502680a52f3cf6f58cb077..b5560002db65fc92287ea6aeb4ecff0660eb3879 100644 --- a/civicrm/api/v3/examples/UFGroup/Delete.php +++ b/civicrm/api/v3/examples/UFGroup/Delete.php @@ -54,17 +54,17 @@ function uf_group_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFGroup/Get.php b/civicrm/api/v3/examples/UFGroup/Get.php index 2843f27ca2e3ab776ffa2a76116ff7bfd96a94b8..e7abf9556275f313995c33c30d452b0203104320 100644 --- a/civicrm/api/v3/examples/UFGroup/Get.php +++ b/civicrm/api/v3/examples/UFGroup/Get.php @@ -66,6 +66,7 @@ function uf_group_get_expectedresult() { 'created_id' => '1', 'created_date' => '2013-07-28 08:49:19', 'is_proximity_search' => 0, + 'add_cancel_button' => '1', ], ], ]; @@ -80,17 +81,17 @@ function uf_group_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFGroupTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFJoin/Create.php b/civicrm/api/v3/examples/UFJoin/Create.php index 386b09b76c2a1cea554a9ac2351d5ab7dba2e844..4b388f10ac509299b7214608f0685029e092799f 100644 --- a/civicrm/api/v3/examples/UFJoin/Create.php +++ b/civicrm/api/v3/examples/UFJoin/Create.php @@ -72,17 +72,17 @@ function uf_join_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFJoinTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFJoin/Get.php b/civicrm/api/v3/examples/UFJoin/Get.php index 129626b35457af49967c657fed48cf9d8c066965..88246c4694fdc47f77063c0c2cdca0bd51699015 100644 --- a/civicrm/api/v3/examples/UFJoin/Get.php +++ b/civicrm/api/v3/examples/UFJoin/Get.php @@ -67,17 +67,17 @@ function uf_join_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFJoinTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/UFMatch/Get.php b/civicrm/api/v3/examples/UFMatch/Get.php index 1c77731cb6e0e6722c615fae48f8646a61f9f100..9f68b0c692eb085192a91f634c06dd5bd7c485c1 100644 --- a/civicrm/api/v3/examples/UFMatch/Get.php +++ b/civicrm/api/v3/examples/UFMatch/Get.php @@ -62,17 +62,17 @@ function uf_match_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UFMatchTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/User/Get.php b/civicrm/api/v3/examples/User/Get.php new file mode 100644 index 0000000000000000000000000000000000000000..9c71f5b1b896f400552432382db58c5295bfb3c9 --- /dev/null +++ b/civicrm/api/v3/examples/User/Get.php @@ -0,0 +1,78 @@ +<?php +/** + * Test Generated example demonstrating the User.get API. + * + * @return array + * API result array + */ +function user_get_example() { + $params = [ + 'contact_id' => 3, + 'sequential' => 1, + ]; + + try{ + $result = civicrm_api3('User', 'get', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function user_get_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 1, + 'id' => 6, + 'values' => [ + '0' => [ + 'id' => '6', + 'name' => 'superman', + 'contact_id' => '3', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testUserGet" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UserTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/User/GetFields.php b/civicrm/api/v3/examples/User/GetFields.php new file mode 100644 index 0000000000000000000000000000000000000000..d390e46af1d27b6b2b7e8574c6060714c4781921 --- /dev/null +++ b/civicrm/api/v3/examples/User/GetFields.php @@ -0,0 +1,87 @@ +<?php +/** + * Test Generated example demonstrating the User.getfields API. + * + * @return array + * API result array + */ +function user_getfields_example() { + $params = [ + 'action' => 'get', + ]; + + try{ + $result = civicrm_api3('User', 'getfields', $params); + } + catch (CiviCRM_API3_Exception $e) { + // Handle error here. + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return [ + 'is_error' => 1, + 'error_message' => $errorMessage, + 'error_code' => $errorCode, + 'error_data' => $errorData, + ]; + } + + return $result; +} + +/** + * Function returns array of result expected from previous function. + * + * @return array + * API result array + */ +function user_getfields_expectedresult() { + + $expectedResult = [ + 'is_error' => 0, + 'version' => 3, + 'count' => 3, + 'values' => [ + 'contact_id' => [ + 'title' => 'Contact ID', + 'type' => 1, + 'api.required' => 1, + 'name' => 'contact_id', + ], + 'id' => [ + 'title' => 'CMS User ID', + 'type' => 1, + 'name' => 'id', + ], + 'name' => [ + 'title' => 'Username', + 'type' => 2, + 'name' => 'name', + ], + ], + ]; + + return $expectedResult; +} + +/* +* This example has been generated from the API test suite. +* The test that created it is called "testGetFields" +* and can be found at: +* https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/UserTest.php +* +* You can see the outcome of the API tests at +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ +* +* To Learn about the API read +* https://docs.civicrm.org/dev/en/latest/api/ +* +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. +* +* Read more about testing here +* https://docs.civicrm.org/dev/en/latest/testing/ +* +* API Standards documentation: +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ +*/ diff --git a/civicrm/api/v3/examples/Website/Create.php b/civicrm/api/v3/examples/Website/Create.php index ca680c73394c2081f4c05159be0f6394ec89b407..66874a22274ecc144889a757202f66c8aafa6ef1 100644 --- a/civicrm/api/v3/examples/Website/Create.php +++ b/civicrm/api/v3/examples/Website/Create.php @@ -64,17 +64,17 @@ function website_create_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Website/Delete.php b/civicrm/api/v3/examples/Website/Delete.php index 2b99ad2c6b55b004203fc284b38ec04c71ac845f..4a0d85693b6ea4eb72f0d1f2d9f4d1e9b22b591c 100644 --- a/civicrm/api/v3/examples/Website/Delete.php +++ b/civicrm/api/v3/examples/Website/Delete.php @@ -54,17 +54,17 @@ function website_delete_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Website/Get.php b/civicrm/api/v3/examples/Website/Get.php index c4a8ee27abef8a5b11172d0b6162a21b8a3d2dfc..4c2470c789cdb2f6822e7d1fac0a71443383d37b 100644 --- a/civicrm/api/v3/examples/Website/Get.php +++ b/civicrm/api/v3/examples/Website/Get.php @@ -7,7 +7,7 @@ */ function website_get_example() { $params = [ - 'contact_id' => 4, + 'contact_id' => 5, 'url' => 'website.com', 'website_type_id' => 1, ]; @@ -47,7 +47,7 @@ function website_get_expectedresult() { 'values' => [ '2' => [ 'id' => '2', - 'contact_id' => '4', + 'contact_id' => '5', 'url' => 'website.com', 'website_type_id' => '1', ], @@ -64,17 +64,17 @@ function website_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Website/GetFields.php b/civicrm/api/v3/examples/Website/GetFields.php index 32abee5b590df7feeffd0298ffb468831e04d796..a4a5f78056a69ce5ef299e8b828b3f556a701fda 100644 --- a/civicrm/api/v3/examples/Website/GetFields.php +++ b/civicrm/api/v3/examples/Website/GetFields.php @@ -48,9 +48,12 @@ function website_getfields_expectedresult() { 'title' => 'Website ID', 'description' => 'Unique Website ID', 'required' => TRUE, + 'where' => 'civicrm_website.id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, + 'is_core_field' => TRUE, 'api.aliases' => [ '0' => 'website_id', ], @@ -60,10 +63,13 @@ function website_getfields_expectedresult() { 'type' => 1, 'title' => 'Contact', 'description' => 'FK to Contact ID', + 'where' => 'civicrm_website.contact_id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => TRUE, 'FKApiName' => 'Contact', ], 'url' => [ @@ -81,20 +87,24 @@ function website_getfields_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => 128, 'size' => 30, ], + 'is_core_field' => TRUE, ], 'website_type_id' => [ 'name' => 'website_type_id', 'type' => 1, 'title' => 'Website Type', 'description' => 'Which Website type does this website belong to.', + 'where' => 'civicrm_website.website_type_id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => 6, @@ -104,6 +114,7 @@ function website_getfields_expectedresult() { 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', ], + 'is_core_field' => TRUE, ], ], ]; @@ -118,17 +129,17 @@ function website_getfields_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/api/v3/examples/Website/GetWithMetadata.php b/civicrm/api/v3/examples/Website/GetWithMetadata.php index b77fac5a8bc2275da8493d8af10b3f229d60322e..2cf480b8f2587470546afc571cd08e969e64647a 100644 --- a/civicrm/api/v3/examples/Website/GetWithMetadata.php +++ b/civicrm/api/v3/examples/Website/GetWithMetadata.php @@ -56,9 +56,12 @@ function website_get_expectedresult() { 'title' => 'Website ID', 'description' => 'Unique Website ID', 'required' => '1', + 'where' => 'civicrm_website.id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, + 'is_core_field' => '1', 'api.aliases' => [ '0' => 'website_id', ], @@ -68,10 +71,13 @@ function website_get_expectedresult() { 'type' => '1', 'title' => 'Contact', 'description' => 'FK to Contact ID', + 'where' => 'civicrm_website.contact_id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'FKClassName' => 'CRM_Contact_DAO_Contact', + 'is_core_field' => '1', 'FKApiName' => 'Contact', ], 'url' => [ @@ -89,20 +95,24 @@ function website_get_expectedresult() { 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'html' => [ 'type' => 'Text', 'maxlength' => '128', 'size' => '30', ], + 'is_core_field' => '1', ], 'website_type_id' => [ 'name' => 'website_type_id', 'type' => '1', 'title' => 'Website Type', 'description' => 'Which Website type does this website belong to.', + 'where' => 'civicrm_website.website_type_id', 'table_name' => 'civicrm_website', 'entity' => 'Website', 'bao' => 'CRM_Core_BAO_Website', + 'localizable' => 0, 'html' => [ 'type' => 'Select', 'size' => '6', @@ -112,6 +122,7 @@ function website_get_expectedresult() { 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', ], + 'is_core_field' => '1', ], ], ], @@ -127,17 +138,17 @@ function website_get_expectedresult() { * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/WebsiteTest.php * * You can see the outcome of the API tests at -* https://test.civicrm.org/job/CiviCRM-master-git/ +* https://test.civicrm.org/job/CiviCRM-Core-Matrix/ * * To Learn about the API read -* http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API +* https://docs.civicrm.org/dev/en/latest/api/ * -* Browse the api on your own site with the api explorer -* http://MYSITE.ORG/path/to/civicrm/api +* Browse the API on your own site with the API Explorer. It is in the main +* CiviCRM menu, under: Support > Development > API Explorer. * * Read more about testing here -* http://wiki.civicrm.org/confluence/display/CRM/Testing +* https://docs.civicrm.org/dev/en/latest/testing/ * * API Standards documentation: -* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards +* https://docs.civicrm.org/dev/en/latest/framework/api-architecture/ */ diff --git a/civicrm/bower.json b/civicrm/bower.json deleted file mode 100644 index 75e67552ef9e45a1fb85bc5491478d3526c406ee..0000000000000000000000000000000000000000 --- a/civicrm/bower.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "civicrm", - "description": "CiviCRM", - "version": "5.0.0", - "license": "AGPL-3.0", - "private": true, - "dependencies": { - "angular": "~1.5.0", - "angular-file-upload": ">=1.1.5 <=1.1.6", - "angular-jquery-dialog-service": "totten/angular-jquery-dialog-service#civicrm", - "angular-mocks": "~1.5.0", - "angular-route": "~1.5.0", - "angular-ui-sortable": "0.12.x", - "angular-ui-utils": "0.1.x", - "angular-unsavedChanges": "~0.1.1", - "qunit": "~1.10", - "d3": "3.4.11", - "d3-3.5.x": "d3#~3.5.17", - "dc-2.1.x": "dc.js#~2.1.8", - "crossfilter-1.3.x": "crossfilter2#~1.3.11", - "jquery": "civicrm/jquery#1.12.4-civicrm-1.2", - "jquery-ui": "~1.12", - "lodash-compat": "~3.0", - "google-code-prettify": "~1.0", - "select2": "colemanw/select2#stable/3.5", - "jquery-validation": "~1.13", - "datatables": "~1.10", - "jstree": "~3", - "ckeditor": "~4.9", - "font-awesome": "~4", - "angular-bootstrap": "^2.5.0", - "angular-sanitize": "~1.5.0", - "smartmenus": "~1.1", - "phantomjs-polyfill": "^0.0.2", - "es6-promise": "^4.2.4", - "angular-xeditable": "^0.9.0", - "checklist-model": "~1", - "css-color-names": "~1" - }, - "resolutions": { - "angular": "~1.5.11", - "jquery": "1.12.4-civicrm-1.2" - } -} diff --git a/civicrm/bower_components/angular-bootstrap/.bower.json b/civicrm/bower_components/angular-bootstrap/.bower.json deleted file mode 100644 index f31ec0289a507d480c5fc151bbbb41c1cd9c5451..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-bootstrap/.bower.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "author": { - "name": "https://github.com/angular-ui/bootstrap/graphs/contributors" - }, - "name": "angular-bootstrap", - "keywords": [ - "angular", - "angular-ui", - "bootstrap" - ], - "license": "MIT", - "ignore": [], - "description": "Native AngularJS (Angular) directives for Bootstrap.", - "version": "2.5.0", - "main": [ - "./ui-bootstrap-tpls.js" - ], - "dependencies": { - "angular": ">=1.4.0" - }, - "homepage": "https://github.com/angular-ui/bootstrap-bower", - "_release": "2.5.0", - "_resolution": { - "type": "version", - "tag": "2.5.0", - "commit": "2ab82fe5b072269e897d5d11333e9925888df456" - }, - "_source": "https://github.com/angular-ui/bootstrap-bower.git", - "_target": "^2.5.0", - "_originalSource": "angular-bootstrap" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-bootstrap/.composer-downloads/angular-bootstrap-02435d2082ac71ec4f13fbdf2f4d3e1a.json b/civicrm/bower_components/angular-bootstrap/.composer-downloads/angular-bootstrap-02435d2082ac71ec4f13fbdf2f4d3e1a.json new file mode 100644 index 0000000000000000000000000000000000000000..ae35559dc5b2a02e910fb9d1f49b71881b565b00 --- /dev/null +++ b/civicrm/bower_components/angular-bootstrap/.composer-downloads/angular-bootstrap-02435d2082ac71ec4f13fbdf2f4d3e1a.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-bootstrap", + "url": "https://github.com/angular-ui/bootstrap-bower/archive/2.5.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-file-upload/.bower.json b/civicrm/bower_components/angular-file-upload/.bower.json deleted file mode 100644 index aea5806e0855aada11780fb14fa2156c07e0f735..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-file-upload/.bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "angular-file-upload", - "main": "angular-file-upload.min.js", - "homepage": "https://github.com/nervgh/angular-file-upload", - "ignore": [ - "examples" - ], - "dependencies": { - "angular": "~1.2.11" - }, - "devDependencies": { - "es5-shim": ">=3.4.0" - }, - "keywords": [ - "angular", - "file", - "upload", - "module" - ], - "version": "1.1.6", - "_release": "1.1.6", - "_resolution": { - "type": "version", - "tag": "v1.1.6", - "commit": "1bf43e92ecb1bd46ffe34bbcd10d6173012b1b1d" - }, - "_source": "https://github.com/nervgh/angular-file-upload.git", - "_target": ">=1.1.5 <=1.1.6", - "_originalSource": "angular-file-upload" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-file-upload/.composer-downloads/angular-file-upload-e60440287b4df1cbc04045e77a8c05f5.json b/civicrm/bower_components/angular-file-upload/.composer-downloads/angular-file-upload-e60440287b4df1cbc04045e77a8c05f5.json new file mode 100644 index 0000000000000000000000000000000000000000..c73357d95c901c90bc8ede8b78a6b6eaada15c58 --- /dev/null +++ b/civicrm/bower_components/angular-file-upload/.composer-downloads/angular-file-upload-e60440287b4df1cbc04045e77a8c05f5.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-file-upload", + "url": "https://github.com/nervgh/angular-file-upload/archive/v1.1.6.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-jquery-dialog-service/.bower.json b/civicrm/bower_components/angular-jquery-dialog-service/.bower.json deleted file mode 100644 index d3d7c858358edab33c531bf2e5ebddd5f16a68d4..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-jquery-dialog-service/.bower.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "angular-jquery-dialog-service", - "homepage": "https://github.com/totten/angular-jquery-dialog-service", - "_release": "156e2f592f", - "_resolution": { - "type": "branch", - "branch": "civicrm", - "commit": "156e2f592f8cadd83f89e4b4b84f13fe0c72d21b" - }, - "_source": "https://github.com/totten/angular-jquery-dialog-service.git", - "_target": "civicrm", - "_originalSource": "totten/angular-jquery-dialog-service" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-jquery-dialog-service/.composer-downloads/angular-jquery-dialog-service-1e0a7077e80f08e2a94cb4baa0a72f72.json b/civicrm/bower_components/angular-jquery-dialog-service/.composer-downloads/angular-jquery-dialog-service-1e0a7077e80f08e2a94cb4baa0a72f72.json new file mode 100644 index 0000000000000000000000000000000000000000..3c1ca0c3e00615039aec00d7bd3d4ea29f6ae015 --- /dev/null +++ b/civicrm/bower_components/angular-jquery-dialog-service/.composer-downloads/angular-jquery-dialog-service-1e0a7077e80f08e2a94cb4baa0a72f72.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-jquery-dialog-service", + "url": "https://github.com/totten/angular-jquery-dialog-service/archive/v0.8.0-civicrm-1.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-mocks/.bower.json b/civicrm/bower_components/angular-mocks/.bower.json deleted file mode 100644 index 6aee5b3eaba58cad7c5fdee37185ae24d64698c4..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-mocks/.bower.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "angular-mocks", - "version": "1.5.11", - "license": "MIT", - "main": "./angular-mocks.js", - "ignore": [], - "dependencies": { - "angular": "1.5.11" - }, - "homepage": "https://github.com/angular/bower-angular-mocks", - "_release": "1.5.11", - "_resolution": { - "type": "version", - "tag": "v1.5.11", - "commit": "8f1c89737c8a7e82fd91957cef92f577dad07565" - }, - "_source": "https://github.com/angular/bower-angular-mocks.git", - "_target": "~1.5.0", - "_originalSource": "angular-mocks" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-mocks/.composer-downloads/angular-mocks-f6200e65f802695e672eba66b582c642.json b/civicrm/bower_components/angular-mocks/.composer-downloads/angular-mocks-f6200e65f802695e672eba66b582c642.json new file mode 100644 index 0000000000000000000000000000000000000000..3240c0443e581f96df745b66cc2d6382e8e74c7a --- /dev/null +++ b/civicrm/bower_components/angular-mocks/.composer-downloads/angular-mocks-f6200e65f802695e672eba66b582c642.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-mocks", + "url": "https://github.com/angular/bower-angular-mocks/archive/v1.5.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-route/.bower.json b/civicrm/bower_components/angular-route/.bower.json deleted file mode 100644 index a04afe45ea1634fa12d11ff65f07cc891cfc0327..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-route/.bower.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "angular-route", - "version": "1.5.11", - "license": "MIT", - "main": "./angular-route.js", - "ignore": [], - "dependencies": { - "angular": "1.5.11" - }, - "homepage": "https://github.com/angular/bower-angular-route", - "_release": "1.5.11", - "_resolution": { - "type": "version", - "tag": "v1.5.11", - "commit": "cdb9db456ece8b3f80a638bb7bd69dc2dcd4eee9" - }, - "_source": "https://github.com/angular/bower-angular-route.git", - "_target": "~1.5.0", - "_originalSource": "angular-route" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-route/.composer-downloads/angular-route-e3ac2d15fca8a7bc6c303335035b7ec6.json b/civicrm/bower_components/angular-route/.composer-downloads/angular-route-e3ac2d15fca8a7bc6c303335035b7ec6.json new file mode 100644 index 0000000000000000000000000000000000000000..060e6e74e18399810bf0b795b5bc21ae5093dcd7 --- /dev/null +++ b/civicrm/bower_components/angular-route/.composer-downloads/angular-route-e3ac2d15fca8a7bc6c303335035b7ec6.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-route", + "url": "https://github.com/angular/bower-angular-route/archive/v1.5.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-sanitize/.bower.json b/civicrm/bower_components/angular-sanitize/.bower.json deleted file mode 100644 index b15e0090f1a512872c009444eb9947b6f93b8f57..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-sanitize/.bower.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "angular-sanitize", - "version": "1.5.11", - "license": "MIT", - "main": "./angular-sanitize.js", - "ignore": [], - "dependencies": { - "angular": "1.5.11" - }, - "homepage": "https://github.com/angular/bower-angular-sanitize", - "_release": "1.5.11", - "_resolution": { - "type": "version", - "tag": "v1.5.11", - "commit": "84df06c4ec4f1eef7f9d0b849b9fdf5433c2669c" - }, - "_source": "https://github.com/angular/bower-angular-sanitize.git", - "_target": "~1.5.0", - "_originalSource": "angular-sanitize" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-sanitize/.composer-downloads/angular-sanitize-2e0dffb0d66d69809f64b5824d8df7ec.json b/civicrm/bower_components/angular-sanitize/.composer-downloads/angular-sanitize-2e0dffb0d66d69809f64b5824d8df7ec.json new file mode 100644 index 0000000000000000000000000000000000000000..4811eb258d063bb8ef5a6e36595da05940d0881d --- /dev/null +++ b/civicrm/bower_components/angular-sanitize/.composer-downloads/angular-sanitize-2e0dffb0d66d69809f64b5824d8df7ec.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-sanitize", + "url": "https://github.com/angular/bower-angular-sanitize/archive/v1.5.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-ui-sortable/.bower.json b/civicrm/bower_components/angular-ui-sortable/.bower.json deleted file mode 100644 index 716f51e468e560f8567b66bb1e53d406570dd387..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-ui-sortable/.bower.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "angular-ui-sortable", - "version": "0.12.11", - "main": "./sortable.js", - "dependencies": { - "angular": "~1.2.x", - "jquery-ui": ">=1.9" - }, - "homepage": "https://github.com/angular-ui/ui-sortable", - "_release": "0.12.11", - "_resolution": { - "type": "version", - "tag": "v0.12.11", - "commit": "1db53599b7fd28f6de36ff8a1111bdd47c10aa6d" - }, - "_source": "https://github.com/angular-ui/ui-sortable.git", - "_target": "0.12.x", - "_originalSource": "angular-ui-sortable" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-ui-sortable/.composer-downloads/angular-ui-sortable-c3c4e428641d501819195be170cbe824.json b/civicrm/bower_components/angular-ui-sortable/.composer-downloads/angular-ui-sortable-c3c4e428641d501819195be170cbe824.json new file mode 100644 index 0000000000000000000000000000000000000000..4da6d34f8cf51517cc461d450ec6298be5fbaafe --- /dev/null +++ b/civicrm/bower_components/angular-ui-sortable/.composer-downloads/angular-ui-sortable-c3c4e428641d501819195be170cbe824.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-ui-sortable", + "url": "https://github.com/angular-ui/ui-sortable/archive/v0.12.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-ui-utils/.bower.json b/civicrm/bower_components/angular-ui-utils/.bower.json deleted file mode 100644 index 92a75199a3d036d27f2edcba98f2cad916aa599d..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-ui-utils/.bower.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "angular-ui-utils", - "version": "0.1.1", - "main": "./ui-utils.js", - "dependencies": { - "angular": ">= 1.0.2" - }, - "homepage": "https://github.com/angular-ui/ui-utils", - "_release": "0.1.1", - "_resolution": { - "type": "version", - "tag": "v0.1.1", - "commit": "e25586548ff0a61df63bd4eb8fdc0715b1a87e72" - }, - "_source": "https://github.com/angular-ui/ui-utils.git", - "_target": "0.1.x", - "_originalSource": "angular-ui-utils" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-ui-utils/.composer-downloads/angular-ui-utils-74b1ad1150f4c22741f9e1e45a4f92cd.json b/civicrm/bower_components/angular-ui-utils/.composer-downloads/angular-ui-utils-74b1ad1150f4c22741f9e1e45a4f92cd.json new file mode 100644 index 0000000000000000000000000000000000000000..d127edaf5c1fe6b7f58770a3142737cdab2d70c5 --- /dev/null +++ b/civicrm/bower_components/angular-ui-utils/.composer-downloads/angular-ui-utils-74b1ad1150f4c22741f9e1e45a4f92cd.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-ui-utils", + "url": "https://github.com/angular-ui/ui-utils/archive/v0.1.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-unsavedChanges/.bower.json b/civicrm/bower_components/angular-unsavedChanges/.bower.json deleted file mode 100644 index b33b8a62327fad0007990206c9b1ea255b51c9d2..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-unsavedChanges/.bower.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "angular-unsavedChanges", - "version": "0.1.1", - "homepage": "https://github.com/facultymatt/angular-unsavedChanges", - "authors": [ - "Matt Miller <matt@facultycreative.com>" - ], - "description": "AngularJS directive to warn user of unsaved changes when navigating away from a form.", - "main": "unsavedChanges.js", - "keywords": [ - "form", - "angularjs", - "unsaved", - "changes", - "warning", - "dirty", - "reload" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "angular": "~1.2.5" - }, - "devDependencies": { - "angular-route": "~1.2.2", - "angular-mocks": "~1.2.2", - "angular-scenario": "~1.2.2", - "jquery": "~2.0.3", - "angular-translate": "latest" - }, - "resolutions": { - "angular": "~1.2.5" - }, - "_release": "0.1.1", - "_resolution": { - "type": "version", - "tag": "v0.1.1", - "commit": "9bba1eba672e0e6169ff41ba02db1ce2c1c6acc7" - }, - "_source": "https://github.com/facultymatt/angular-unsavedChanges.git", - "_target": "~0.1.1", - "_originalSource": "angular-unsavedChanges" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-unsavedChanges/.composer-downloads/angular-unsavedChanges-6731bbc27c37c58c64ec4701b2519568.json b/civicrm/bower_components/angular-unsavedChanges/.composer-downloads/angular-unsavedChanges-6731bbc27c37c58c64ec4701b2519568.json new file mode 100644 index 0000000000000000000000000000000000000000..bb30325b4e3f02e101338463f91bdf97a536aa9f --- /dev/null +++ b/civicrm/bower_components/angular-unsavedChanges/.composer-downloads/angular-unsavedChanges-6731bbc27c37c58c64ec4701b2519568.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-unsavedchanges", + "url": "https://github.com/facultymatt/angular-unsavedChanges/archive/v0.1.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular-xeditable/.bower.json b/civicrm/bower_components/angular-xeditable/.bower.json deleted file mode 100644 index ed54a783e8e0425414cc9419b7f41a3fec94972e..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular-xeditable/.bower.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "angular-xeditable", - "version": "0.9.0", - "description": "Edit in place for AngularJS", - "author": "https://github.com/vitalets", - "license": "MIT", - "homepage": "http://vitalets.github.io/angular-xeditable", - "main": [ - "dist/css/xeditable.css", - "dist/js/xeditable.js" - ], - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "playground", - "test", - "libs", - "docs", - "zip", - "src", - "starter", - "Gruntfile.js", - "index.html", - "jsdoc.conf.json", - "package.json" - ], - "dependencies": { - "angular": "~1.x" - }, - "devDependencies": { - "angular": "~1.5.0", - "angular-mocks": "~1.5.0", - "angular-scenario": "~1.5.0", - "angular-sanitize": "~1.5.0", - "jquery": "^2.2.4", - "bootstrap": "^3.3.7", - "moment": "^2.17.1", - "checklist-model": "^0.10.0", - "ng-tags-input": "^3.1.1", - "angular-bootstrap": "^2.5.0", - "angular-ui-select": "^0.16.1", - "jquery-ui": "^1.12.1", - "angular-ui-date": "^1.0.1" - }, - "_release": "0.9.0", - "_resolution": { - "type": "version", - "tag": "0.9.0", - "commit": "a2fd62756d8ad19505814545bcbba5d7f9bba5ce" - }, - "_source": "https://github.com/vitalets/angular-xeditable.git", - "_target": "^0.9.0", - "_originalSource": "angular-xeditable" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular-xeditable/.composer-downloads/angular-xeditable-9b1e32a8b3e1d76027b3a4167ab2ff58.json b/civicrm/bower_components/angular-xeditable/.composer-downloads/angular-xeditable-9b1e32a8b3e1d76027b3a4167ab2ff58.json new file mode 100644 index 0000000000000000000000000000000000000000..013d08f17a427c6a4b22fe17d854d8dda3138d75 --- /dev/null +++ b/civicrm/bower_components/angular-xeditable/.composer-downloads/angular-xeditable-9b1e32a8b3e1d76027b3a4167ab2ff58.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular-xeditable", + "url": "https://github.com/vitalets/angular-xeditable/archive/0.9.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/angular/.bower.json b/civicrm/bower_components/angular/.bower.json deleted file mode 100644 index 23025d8a667dea8bc8e494280092a9b0854384d3..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/angular/.bower.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "angular", - "version": "1.5.11", - "license": "MIT", - "main": "./angular.js", - "ignore": [], - "dependencies": {}, - "homepage": "https://github.com/angular/bower-angular", - "_release": "1.5.11", - "_resolution": { - "type": "version", - "tag": "v1.5.11", - "commit": "0f57428c3ffe2f486264ab7fbee3968dccc7b720" - }, - "_source": "https://github.com/angular/bower-angular.git", - "_target": "1.5.11", - "_originalSource": "angular" -} \ No newline at end of file diff --git a/civicrm/bower_components/angular/.composer-downloads/angular-d18b8624a0f5f721da7b82365fc562dd.json b/civicrm/bower_components/angular/.composer-downloads/angular-d18b8624a0f5f721da7b82365fc562dd.json new file mode 100644 index 0000000000000000000000000000000000000000..3833c8233011c9445621e649ccc02910e6ee9b21 --- /dev/null +++ b/civicrm/bower_components/angular/.composer-downloads/angular-d18b8624a0f5f721da7b82365fc562dd.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:angular", + "url": "https://github.com/angular/bower-angular/archive/v1.5.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/checklist-model/.bower.json b/civicrm/bower_components/checklist-model/.bower.json deleted file mode 100644 index 94fdf460f46f533ee570fca6551b1bdce19ed559..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/checklist-model/.bower.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "checklist-model", - "version": "1.0.0", - "description": "AngularJS directive for list of checkboxes", - "author": "https://github.com/vitalets", - "license": "MIT", - "homepage": "http://vitalets.github.io/checklist-model", - "main": "checklist-model.js", - "ignore": [ - "**/.*", - "node_modules", - "docs", - "Gruntfile.js", - "index.html", - "package.json" - ], - "dependencies": { - "angular": ">=1.0.8" - }, - "devDependencies": {}, - "_release": "1.0.0", - "_resolution": { - "type": "version", - "tag": "1.0.0", - "commit": "a8d28276ec7fa697947074ab7d8c5ec3de0c3bb4" - }, - "_source": "https://github.com/vitalets/checklist-model.git", - "_target": "~1", - "_originalSource": "checklist-model" -} \ No newline at end of file diff --git a/civicrm/bower_components/checklist-model/.composer-downloads/checklist-model-71a4c0cb1382f152af0850bd2adbb843.json b/civicrm/bower_components/checklist-model/.composer-downloads/checklist-model-71a4c0cb1382f152af0850bd2adbb843.json new file mode 100644 index 0000000000000000000000000000000000000000..8222a0d2633fd0efb23d1e6be37394a821e32a8a --- /dev/null +++ b/civicrm/bower_components/checklist-model/.composer-downloads/checklist-model-71a4c0cb1382f152af0850bd2adbb843.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:checklist-model", + "url": "https://github.com/vitalets/checklist-model/archive/1.0.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/ckeditor/.bower.json b/civicrm/bower_components/ckeditor/.bower.json deleted file mode 100644 index c8e8e023fce5b05df8924f23cc8e52727a906c1b..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/ckeditor/.bower.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "ckeditor", - "description": "JavaScript WYSIWYG web text editor.", - "keywords": [ - "ckeditor", - "fckeditor", - "editor", - "wysiwyg", - "html", - "richtext", - "text", - "javascript" - ], - "authors": "CKSource (http://cksource.com/)", - "license": "For licensing, see LICENSE.md or http://ckeditor.com/license.", - "homepage": "http://ckeditor.com", - "main": "./ckeditor.js", - "moduleType": "globals", - "version": "4.9.2", - "_release": "4.9.2", - "_resolution": { - "type": "version", - "tag": "4.9.2", - "commit": "993eb4fba6a70545f6c50da1988d39ecd9cf47a3" - }, - "_source": "https://github.com/ckeditor/ckeditor-releases.git", - "_target": "~4.9", - "_originalSource": "ckeditor" -} \ No newline at end of file diff --git a/civicrm/bower_components/ckeditor/.composer-downloads/ckeditor-55ec7732cc4d2d985134a433fa86a610.json b/civicrm/bower_components/ckeditor/.composer-downloads/ckeditor-55ec7732cc4d2d985134a433fa86a610.json new file mode 100644 index 0000000000000000000000000000000000000000..64a5a8586f6d88a100f149c57c8e9f33e5ea078c --- /dev/null +++ b/civicrm/bower_components/ckeditor/.composer-downloads/ckeditor-55ec7732cc4d2d985134a433fa86a610.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:ckeditor", + "url": "https://github.com/ckeditor/ckeditor-releases/archive/4.9.2.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/crossfilter-1.3.x/.bower.json b/civicrm/bower_components/crossfilter-1.3.x/.bower.json deleted file mode 100644 index 9b5f903498e305bea84dcf3b9ab4027ce633fbc4..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/crossfilter-1.3.x/.bower.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "crossfilter2", - "description": "Fast multidimensional filtering for coordinated views.", - "main": "crossfilter.min.js", - "license": "Apache-2.0", - "keywords": [ - "analytics", - "visualization", - "crossfilter" - ], - "homepage": "https://github.com/crossfilter/crossfilter", - "moduleType": [ - "globals", - "node" - ], - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "src", - "lib", - "test", - "component.json", - "package.json", - "index.js", - "Makefile" - ], - "version": "1.3.14", - "_release": "1.3.14", - "_resolution": { - "type": "version", - "tag": "1.3.14", - "commit": "8066669e84e13a8e3212df6dc20dee63f083cca2" - }, - "_source": "https://github.com/crossfilter/crossfilter.git", - "_target": "~1.3.11", - "_originalSource": "crossfilter2" -} \ No newline at end of file diff --git a/civicrm/bower_components/crossfilter-1.3.x/.composer-downloads/crossfilter-1.3.x-7acfcad9e23c80333653a6e5d55428e5.json b/civicrm/bower_components/crossfilter-1.3.x/.composer-downloads/crossfilter-1.3.x-7acfcad9e23c80333653a6e5d55428e5.json new file mode 100644 index 0000000000000000000000000000000000000000..590664e856fe767b35eebbfdb9f0377a90335b7e --- /dev/null +++ b/civicrm/bower_components/crossfilter-1.3.x/.composer-downloads/crossfilter-1.3.x-7acfcad9e23c80333653a6e5d55428e5.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:crossfilter-1.3.x", + "url": "https://github.com/crossfilter/crossfilter/archive/1.3.14.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/crossfilter2/.bower.json b/civicrm/bower_components/crossfilter2/.bower.json deleted file mode 100644 index 90836ab929ef8ac4a09526a60e861311dcef887a..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/crossfilter2/.bower.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "crossfilter2", - "description": "Fast multidimensional filtering for coordinated views.", - "main": "crossfilter.min.js", - "license": "Apache-2.0", - "keywords": [ - "analytics", - "visualization", - "crossfilter" - ], - "homepage": "https://github.com/crossfilter/crossfilter", - "moduleType": [ - "globals", - "node" - ], - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "package.json", - "index.js", - "src", - "component.json", - "media", - "test", - "tests" - ], - "version": "1.4.7", - "_release": "1.4.7", - "_resolution": { - "type": "version", - "tag": "1.4.7", - "commit": "8f29300df4949f70dafaeb675001d42991d75edd" - }, - "_source": "https://github.com/crossfilter/crossfilter.git", - "_target": "~1.4", - "_originalSource": "crossfilter2" -} \ No newline at end of file diff --git a/civicrm/bower_components/crossfilter2/.composer-downloads/crossfilter2-cfc7aab525b6a272826f0d7b1046426e.json b/civicrm/bower_components/crossfilter2/.composer-downloads/crossfilter2-cfc7aab525b6a272826f0d7b1046426e.json new file mode 100644 index 0000000000000000000000000000000000000000..f5dd634474b558313fa1e9384dcb426fc2f8897a --- /dev/null +++ b/civicrm/bower_components/crossfilter2/.composer-downloads/crossfilter2-cfc7aab525b6a272826f0d7b1046426e.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:crossfilter2", + "url": "https://github.com/crossfilter/crossfilter/archive/1.4.7.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/css-color-names/.bower.json b/civicrm/bower_components/css-color-names/.bower.json deleted file mode 100644 index db9d473fd805af2ce95834b39a855c08bd932d26..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/css-color-names/.bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "css-color-names", - "homepage": "https://github.com/bahamas10/css-color-names", - "version": "1.0.1", - "_release": "1.0.1", - "_resolution": { - "type": "version", - "tag": "v1.0.1", - "commit": "c41f2d98d6b018226f3505d6e0238bd7e2d7e611" - }, - "_source": "https://github.com/bahamas10/css-color-names.git", - "_target": "~1", - "_originalSource": "css-color-names" -} \ No newline at end of file diff --git a/civicrm/bower_components/css-color-names/.composer-downloads/css-color-names-54216149e268d2a17ad72fce05bfdc93.json b/civicrm/bower_components/css-color-names/.composer-downloads/css-color-names-54216149e268d2a17ad72fce05bfdc93.json new file mode 100644 index 0000000000000000000000000000000000000000..48818eca5017d8eec2535f872198c352a7bb5b1e --- /dev/null +++ b/civicrm/bower_components/css-color-names/.composer-downloads/css-color-names-54216149e268d2a17ad72fce05bfdc93.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:css-color-names", + "url": "https://github.com/bahamas10/css-color-names/archive/v1.0.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/d3-3.5.x/.bower.json b/civicrm/bower_components/d3-3.5.x/.bower.json deleted file mode 100644 index c83d63af9776b542ca198381ab91807c289d51c7..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/d3-3.5.x/.bower.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "d3", - "description": "A JavaScript visualization library for HTML and SVG.", - "main": "d3.js", - "license": "BSD-3-Clause", - "ignore": [], - "homepage": "https://github.com/mbostock-bower/d3-bower", - "version": "3.5.17", - "_release": "3.5.17", - "_resolution": { - "type": "version", - "tag": "v3.5.17", - "commit": "abe0262a205c9f3755c3a757de4dfd1d49f34b24" - }, - "_source": "https://github.com/mbostock-bower/d3-bower.git", - "_target": "~3.5.17", - "_originalSource": "d3" -} \ No newline at end of file diff --git a/civicrm/bower_components/d3-3.5.x/.composer-downloads/d3-3.5.x-3ba96c298dad99990feb13a2bc313897.json b/civicrm/bower_components/d3-3.5.x/.composer-downloads/d3-3.5.x-3ba96c298dad99990feb13a2bc313897.json new file mode 100644 index 0000000000000000000000000000000000000000..f7a4dc38bb392ff461d205fdb97f4c77ebe3a6f9 --- /dev/null +++ b/civicrm/bower_components/d3-3.5.x/.composer-downloads/d3-3.5.x-3ba96c298dad99990feb13a2bc313897.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:d3-3.5.x", + "url": "https://github.com/mbostock-bower/d3-bower/archive/v3.5.17.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/d3/.bower.json b/civicrm/bower_components/d3/.bower.json deleted file mode 100644 index 4881d3b57125c7be84934d8fc0e3e23f3d19bba4..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/d3/.bower.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "d3", - "version": "3.4.11", - "main": "d3.js", - "scripts": [ - "d3.js" - ], - "ignore": [ - ".DS_Store", - ".git", - ".gitignore", - ".npmignore", - ".travis.yml", - "Makefile", - "bin", - "component.json", - "index.js", - "lib", - "node_modules", - "package.json", - "src", - "test" - ], - "homepage": "https://github.com/mbostock-bower/d3-bower", - "_release": "3.4.11", - "_resolution": { - "type": "version", - "tag": "v3.4.11", - "commit": "e8317588b4c0494c494e510b968624609c1a3d3f" - }, - "_source": "https://github.com/mbostock-bower/d3-bower.git", - "_target": "3.4.11", - "_originalSource": "d3" -} \ No newline at end of file diff --git a/civicrm/bower_components/d3/.composer-downloads/d3-e53125275854402400f74fd6ab3f7659.json b/civicrm/bower_components/d3/.composer-downloads/d3-e53125275854402400f74fd6ab3f7659.json new file mode 100644 index 0000000000000000000000000000000000000000..3ac99310416fde4a44921ad3a2db3e472ef74eb2 --- /dev/null +++ b/civicrm/bower_components/d3/.composer-downloads/d3-e53125275854402400f74fd6ab3f7659.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:d3", + "url": "https://github.com/mbostock-bower/d3-bower/archive/v3.4.11.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/datatables/.bower.json b/civicrm/bower_components/datatables/.bower.json deleted file mode 100644 index b62efb2a7baa50a106f0258bcb31376ad3bc6db3..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/datatables/.bower.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "datatables", - "main": [ - "media/js/jquery.dataTables.js", - "media/css/jquery.dataTables.css", - "media/images/sort_asc.png", - "media/images/sort_asc_disabled.png", - "media/images/sort_both.png", - "media/images/sort_desc.png", - "media/images/sort_desc_disabled.png" - ], - "dependencies": { - "jquery": ">=1.7.0" - }, - "license": "MIT", - "keywords": [ - "jquery", - "datatables", - "table", - "javascript", - "library" - ], - "ignore": [ - "/.*", - "examples", - "media/unit_testing", - "composer.json", - "dataTables.jquery.json", - "package.json" - ], - "homepage": "https://github.com/DataTables/DataTables", - "version": "1.10.19", - "_release": "1.10.19", - "_resolution": { - "type": "version", - "tag": "1.10.19", - "commit": "cedff8828e4507e36de9dc58e22edff5b8d37dfe" - }, - "_source": "https://github.com/DataTables/DataTables.git", - "_target": "~1.10", - "_originalSource": "datatables" -} \ No newline at end of file diff --git a/civicrm/bower_components/datatables/.composer-downloads/datatables-06669348abd69fdff10f03f7c7ff1571.json b/civicrm/bower_components/datatables/.composer-downloads/datatables-06669348abd69fdff10f03f7c7ff1571.json new file mode 100644 index 0000000000000000000000000000000000000000..326f23e4563737dae7c102ac8a39a5688701f871 --- /dev/null +++ b/civicrm/bower_components/datatables/.composer-downloads/datatables-06669348abd69fdff10f03f7c7ff1571.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:datatables", + "url": "https://github.com/DataTables/DataTables/archive/1.10.19.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/dc-2.1.x/.bower.json b/civicrm/bower_components/dc-2.1.x/.bower.json deleted file mode 100644 index a3ed44e63ff4c64e880a8b57e9c234454855d825..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/dc-2.1.x/.bower.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "dcjs", - "main": [ - "dc.js", - "dc.css" - ], - "keywords": [ - "visualization", - "svg", - "animation", - "canvas", - "chart", - "dimensional", - "crossfilter", - "d3" - ], - "ignore": [ - "*", - "!dc.*", - "!LICENSE", - "!README.md" - ], - "dependencies": { - "d3": "3.x", - "crossfilter2": "~1.4" - }, - "homepage": "https://github.com/NickQiZhu/dc.js", - "version": "2.1.10", - "_release": "2.1.10", - "_resolution": { - "type": "version", - "tag": "2.1.10", - "commit": "1eb166ef26b33fca3875e490c29d1cacc960168e" - }, - "_source": "https://github.com/NickQiZhu/dc.js.git", - "_target": "~2.1.8", - "_originalSource": "dc.js" -} \ No newline at end of file diff --git a/civicrm/bower_components/dc-2.1.x/.composer-downloads/dc-2.1.x-ea78359606fb2b93565a6497513116e7.json b/civicrm/bower_components/dc-2.1.x/.composer-downloads/dc-2.1.x-ea78359606fb2b93565a6497513116e7.json new file mode 100644 index 0000000000000000000000000000000000000000..7ef3ee7dfbd55a9b7179c80826fb32cbe00ee6ef --- /dev/null +++ b/civicrm/bower_components/dc-2.1.x/.composer-downloads/dc-2.1.x-ea78359606fb2b93565a6497513116e7.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:dc-2.1.x", + "url": "https://github.com/NickQiZhu/dc.js/archive/2.1.10.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/dc-2.1.x/bower.json b/civicrm/bower_components/dc-2.1.x/bower.json deleted file mode 100644 index 62f0c60a686546dc27ac0c0268abd7af9431eb0b..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/dc-2.1.x/bower.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "dcjs", - "main": ["dc.js", "dc.css"], - "keywords": [ - "visualization", - "svg", - "animation", - "canvas", - "chart", - "dimensional", - "crossfilter", - "d3" - ], - "ignore": [ - "*", - "!dc.*", - "!LICENSE", - "!README.md" - ], - "dependencies": { - "d3": "3.x", - "crossfilter2": "~1.4" - } -} diff --git a/civicrm/bower_components/es6-promise/.bower.json b/civicrm/bower_components/es6-promise/.bower.json deleted file mode 100644 index 516e10d580369657e09901a156091a172ce9d704..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/es6-promise/.bower.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "es6-promise", - "namespace": "Promise", - "description": "A polyfill for ES6-style Promises, tracking rsvp", - "authors": [ - "Stefan Penner <stefan.penner@gmail.com>" - ], - "main": "./es6-promise.js", - "keywords": [ - "promise" - ], - "repository": { - "type": "git", - "url": "git://github.com/stefanpenner/es6-promise.git" - }, - "bugs": { - "url": "https://github.com/stefanpenner/es6-promise/issues" - }, - "license": "MIT", - "homepage": "https://github.com/components/es6-promise", - "version": "4.2.4", - "_release": "4.2.4", - "_resolution": { - "type": "version", - "tag": "v4.2.4", - "commit": "c7911b0f272651dca8c3163704fd39628ed4283a" - }, - "_source": "https://github.com/components/es6-promise.git", - "_target": "^4.2.4", - "_originalSource": "es6-promise" -} \ No newline at end of file diff --git a/civicrm/bower_components/es6-promise/.composer-downloads/es6-promise-60df2490a63990439db23398a56349b2.json b/civicrm/bower_components/es6-promise/.composer-downloads/es6-promise-60df2490a63990439db23398a56349b2.json new file mode 100644 index 0000000000000000000000000000000000000000..ed3cc5662f1f2cae374e5e6d309da1869c84198a --- /dev/null +++ b/civicrm/bower_components/es6-promise/.composer-downloads/es6-promise-60df2490a63990439db23398a56349b2.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:es6-promise", + "url": "https://github.com/components/es6-promise/archive/v4.2.4.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/font-awesome/.bower.json b/civicrm/bower_components/font-awesome/.bower.json deleted file mode 100644 index 59038154822ef189cc17ec6d843f054d70ff22e8..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/font-awesome/.bower.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "font-awesome", - "description": "Font Awesome", - "keywords": [], - "homepage": "http://fontawesome.io", - "dependencies": {}, - "devDependencies": {}, - "license": [ - "OFL-1.1", - "MIT", - "CC-BY-3.0" - ], - "main": [ - "less/font-awesome.less", - "scss/font-awesome.scss" - ], - "ignore": [ - "*/.*", - "*.json", - "src", - "*.yml", - "Gemfile", - "Gemfile.lock", - "*.md" - ], - "version": "4.7.0", - "_release": "4.7.0", - "_resolution": { - "type": "version", - "tag": "v4.7.0", - "commit": "a3fe90fa5f6fac55d197f9cbd18e3f57dafb716c" - }, - "_source": "https://github.com/FortAwesome/Font-Awesome.git", - "_target": "~4", - "_originalSource": "font-awesome" -} \ No newline at end of file diff --git a/civicrm/bower_components/font-awesome/.composer-downloads/font-awesome-32b121f1e564c015b458c30a6337ac1b.json b/civicrm/bower_components/font-awesome/.composer-downloads/font-awesome-32b121f1e564c015b458c30a6337ac1b.json new file mode 100644 index 0000000000000000000000000000000000000000..a7cc944ae518e563d7f52fa2dbbfb1a2576d3345 --- /dev/null +++ b/civicrm/bower_components/font-awesome/.composer-downloads/font-awesome-32b121f1e564c015b458c30a6337ac1b.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:font-awesome", + "url": "https://github.com/FortAwesome/Font-Awesome/archive/v4.7.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/font-awesome/bower.json b/civicrm/bower_components/font-awesome/bower.json deleted file mode 100644 index 9e2112659b01fcfc385bd070c0d2fb1d6bbb80a8..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/font-awesome/bower.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "font-awesome", - "description": "Font Awesome", - "keywords": [], - "homepage": "http://fontawesome.io", - "dependencies": {}, - "devDependencies": {}, - "license": ["OFL-1.1", "MIT", "CC-BY-3.0"], - "main": [ - "less/font-awesome.less", - "scss/font-awesome.scss" - ], - "ignore": [ - "*/.*", - "*.json", - "src", - "*.yml", - "Gemfile", - "Gemfile.lock", - "*.md" - ] -} diff --git a/civicrm/bower_components/google-code-prettify/.bower.json b/civicrm/bower_components/google-code-prettify/.bower.json deleted file mode 100644 index ed3ae3e4af61c7e9715a5cfc198580452e0c76f8..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/google-code-prettify/.bower.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "google-code-prettify", - "version": "1.0.5", - "main": [ - "./bin/prettify.min.css", - "./bin/prettify.min.js" - ], - "dependencies": {}, - "ignore": [ - "closure-compiler", - "js-modules", - "tests", - "yui-compressor", - "Makefile" - ], - "homepage": "https://github.com/tcollard/google-code-prettify", - "_release": "1.0.5", - "_resolution": { - "type": "version", - "tag": "v1.0.5", - "commit": "5e0b27bba2583a386c08ead942bbf25418c28784" - }, - "_source": "https://github.com/tcollard/google-code-prettify.git", - "_target": "~1.0", - "_originalSource": "google-code-prettify" -} \ No newline at end of file diff --git a/civicrm/bower_components/google-code-prettify/.composer-downloads/google-code-prettify-8b46b49e999a9774c040fd46f81a68a5.json b/civicrm/bower_components/google-code-prettify/.composer-downloads/google-code-prettify-8b46b49e999a9774c040fd46f81a68a5.json new file mode 100644 index 0000000000000000000000000000000000000000..5104588da1d9f8c5fad40bb9e19cc5f43c333a38 --- /dev/null +++ b/civicrm/bower_components/google-code-prettify/.composer-downloads/google-code-prettify-8b46b49e999a9774c040fd46f81a68a5.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:google-code-prettify", + "url": "https://github.com/tcollard/google-code-prettify/archive/v1.0.5.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jquery-ui/.bower.json b/civicrm/bower_components/jquery-ui/.bower.json deleted file mode 100644 index d28097dd886aa3254e1ae3f4b4c31a9a08723e8e..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/jquery-ui/.bower.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "jquery-ui", - "version": "1.12.1", - "main": [ - "jquery-ui.js" - ], - "ignore": [], - "license": "MIT", - "dependencies": { - "jquery": ">=1.6" - }, - "homepage": "https://github.com/components/jqueryui", - "_release": "1.12.1", - "_resolution": { - "type": "version", - "tag": "1.12.1", - "commit": "44ecf3794cc56b65954cc19737234a3119d036cc" - }, - "_source": "https://github.com/components/jqueryui.git", - "_target": "~1.12", - "_originalSource": "jquery-ui" -} \ No newline at end of file diff --git a/civicrm/bower_components/jquery-ui/.composer-downloads/jquery-ui-f4e47df9c6fa2e82f5987f78dc64c392.json b/civicrm/bower_components/jquery-ui/.composer-downloads/jquery-ui-f4e47df9c6fa2e82f5987f78dc64c392.json new file mode 100644 index 0000000000000000000000000000000000000000..a0bb4e854bf8bac10ace426303ca633923be060a --- /dev/null +++ b/civicrm/bower_components/jquery-ui/.composer-downloads/jquery-ui-f4e47df9c6fa2e82f5987f78dc64c392.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:jquery-ui", + "url": "https://github.com/components/jqueryui/archive/1.12.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jquery-validation/.bower.json b/civicrm/bower_components/jquery-validation/.bower.json deleted file mode 100644 index 6f937f82ed5d43a56808833323e2001e36eed1b5..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/jquery-validation/.bower.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "jquery-validation", - "homepage": "http://jqueryvalidation.org/", - "repository": { - "type": "git", - "url": "git://github.com/jzaefferer/jquery-validation.git" - }, - "authors": [ - "Jörn Zaefferer <joern.zaefferer@gmail.com>" - ], - "description": "Form validation made easy", - "main": "dist/jquery.validate.js", - "keywords": [ - "forms", - "validation", - "validate" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "demo", - "lib" - ], - "dependencies": { - "jquery": ">= 1.6.4" - }, - "version": "1.13.1", - "_release": "1.13.1", - "_resolution": { - "type": "version", - "tag": "1.13.1", - "commit": "91f9b8a8597ae8f8164671aadf5a8ed7eefcf4e4" - }, - "_source": "https://github.com/jzaefferer/jquery-validation.git", - "_target": "~1.13", - "_originalSource": "jquery-validation" -} \ No newline at end of file diff --git a/civicrm/bower_components/jquery-validation/.composer-downloads/jquery-validation-134dc18b66d427be700a9e1241688102.json b/civicrm/bower_components/jquery-validation/.composer-downloads/jquery-validation-134dc18b66d427be700a9e1241688102.json new file mode 100644 index 0000000000000000000000000000000000000000..57affa2efd25ace8693181ba6b1466a56b8b5321 --- /dev/null +++ b/civicrm/bower_components/jquery-validation/.composer-downloads/jquery-validation-134dc18b66d427be700a9e1241688102.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:jquery-validation", + "url": "https://github.com/jquery-validation/jquery-validation/archive/1.13.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jquery/.bower.json b/civicrm/bower_components/jquery/.bower.json deleted file mode 100644 index a833c07bba7da543a4574ab3f63d92a483d2e55b..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/jquery/.bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "jquery", - "homepage": "https://github.com/civicrm/jquery", - "version": "1.12.4-civicrm-1.2", - "_release": "1.12.4-civicrm-1.2", - "_resolution": { - "type": "version", - "tag": "1.12.4-civicrm-1.2", - "commit": "b948cbb31d608a5ded2aa6bae6557aa754dbf47d" - }, - "_source": "https://github.com/civicrm/jquery.git", - "_target": "1.12.4-civicrm-1.2", - "_originalSource": "civicrm/jquery" -} \ No newline at end of file diff --git a/civicrm/bower_components/jquery/.composer-downloads/jquery-d223e1439188e478349d52476506c22e.json b/civicrm/bower_components/jquery/.composer-downloads/jquery-d223e1439188e478349d52476506c22e.json new file mode 100644 index 0000000000000000000000000000000000000000..7a1a3609f711dad70f31733249ccb7ebe7a5c54c --- /dev/null +++ b/civicrm/bower_components/jquery/.composer-downloads/jquery-d223e1439188e478349d52476506c22e.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:jquery", + "url": "https://github.com/civicrm/jquery/archive/1.12.4-civicrm-1.2.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jstree/.bower.json b/civicrm/bower_components/jstree/.bower.json deleted file mode 100644 index 4486b7a78609669eb287296595e15d5df07dd564..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/jstree/.bower.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "jstree", - "license": "MIT", - "version": "3.3.8", - "main": [ - "./dist/jstree.js", - "./dist/themes/default/style.css" - ], - "ignore": [ - "**/.*", - "docs", - "demo", - "libs", - "node_modules", - "test", - "libs", - "jstree.jquery.json", - "gruntfile.js", - "package.json", - "bower.json", - "component.json", - "LICENCE-MIT", - "README.md" - ], - "dependencies": { - "jquery": ">=1.9.1" - }, - "keywords": [ - "ui", - "tree", - "jstree" - ], - "homepage": "https://github.com/vakata/jstree", - "_release": "3.3.8", - "_resolution": { - "type": "version", - "tag": "3.3.8", - "commit": "c9d7c1425f2272c5400536fa631eba8657522ecf" - }, - "_source": "https://github.com/vakata/jstree.git", - "_target": "~3", - "_originalSource": "jstree" -} \ No newline at end of file diff --git a/civicrm/bower_components/jstree/.composer-downloads/jstree-50d46fdfc87493925fbba33deede1c4b.json b/civicrm/bower_components/jstree/.composer-downloads/jstree-50d46fdfc87493925fbba33deede1c4b.json new file mode 100644 index 0000000000000000000000000000000000000000..fe930393c3d67a46d2e5cf952c1bffafc3ba4e33 --- /dev/null +++ b/civicrm/bower_components/jstree/.composer-downloads/jstree-50d46fdfc87493925fbba33deede1c4b.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:jstree", + "url": "https://github.com/vakata/jstree/archive/3.3.8.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/jstree/bower.json b/civicrm/bower_components/jstree/bower.json deleted file mode 100644 index e3265b11f519c104441c2ce39e7bf3ed66e52b80..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/jstree/bower.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "jstree", - "license": "MIT", - "version": "3.3.8", - "main" : [ - "./dist/jstree.js", - "./dist/themes/default/style.css" - ], - "ignore": [ - "**/.*", - "docs", - "demo", - "libs", - "node_modules", - "test", - "libs", - "jstree.jquery.json", - "gruntfile.js", - "package.json", - "bower.json", - "component.json", - "LICENCE-MIT", - "README.md" - ], - "dependencies": { - "jquery": ">=1.9.1" - }, - "keywords": [ - "ui", - "tree", - "jstree" - ] -} diff --git a/civicrm/bower_components/lodash-compat/.bower.json b/civicrm/bower_components/lodash-compat/.bower.json deleted file mode 100644 index 753792395f5b58849d56216c0bd7987bf7f622bb..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/lodash-compat/.bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "lodash-compat", - "version": "3.0.1", - "main": "lodash.js", - "ignore": [ - ".*", - "*.log", - "*.md", - "component.json", - "package.json", - "node_modules" - ], - "homepage": "https://github.com/lodash/lodash-compat", - "_release": "3.0.1", - "_resolution": { - "type": "version", - "tag": "3.0.1", - "commit": "c0dd92d1e5c993c632d8efeb083d6b2ace640118" - }, - "_source": "https://github.com/lodash/lodash-compat.git", - "_target": "~3.0", - "_originalSource": "lodash-compat" -} \ No newline at end of file diff --git a/civicrm/bower_components/lodash-compat/.composer-downloads/lodash-compat-bf9d53c8a06b2909c0053b89d9bcce3b.json b/civicrm/bower_components/lodash-compat/.composer-downloads/lodash-compat-bf9d53c8a06b2909c0053b89d9bcce3b.json new file mode 100644 index 0000000000000000000000000000000000000000..0fb35c76cff2811772789fcae9a04492b48202f2 --- /dev/null +++ b/civicrm/bower_components/lodash-compat/.composer-downloads/lodash-compat-bf9d53c8a06b2909c0053b89d9bcce3b.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:lodash-compat", + "url": "https://github.com/lodash/lodash-compat/archive/3.0.1.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/phantomjs-polyfill/.bower.json b/civicrm/bower_components/phantomjs-polyfill/.bower.json deleted file mode 100644 index a6702b104cdc52d3129f43b5ea45ee808435df29..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/phantomjs-polyfill/.bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "phantomjs-polyfill", - "homepage": "https://github.com/conversocial/phantomjs-polyfill", - "version": "0.0.2", - "_release": "0.0.2", - "_resolution": { - "type": "version", - "tag": "v0.0.2", - "commit": "a1f767df019a1d02bfca39546dfe6bcc8c057c75" - }, - "_source": "https://github.com/conversocial/phantomjs-polyfill.git", - "_target": "^0.0.2", - "_originalSource": "phantomjs-polyfill" -} \ No newline at end of file diff --git a/civicrm/bower_components/phantomjs-polyfill/.composer-downloads/phantomjs-polyfill-dce4e52b3d79fc404e0b05c8674afd11.json b/civicrm/bower_components/phantomjs-polyfill/.composer-downloads/phantomjs-polyfill-dce4e52b3d79fc404e0b05c8674afd11.json new file mode 100644 index 0000000000000000000000000000000000000000..1ec7a2f5f767dd0c73f7b5d2125d21225db883e7 --- /dev/null +++ b/civicrm/bower_components/phantomjs-polyfill/.composer-downloads/phantomjs-polyfill-dce4e52b3d79fc404e0b05c8674afd11.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:phantomjs-polyfill", + "url": "https://github.com/conversocial/phantomjs-polyfill/archive/v0.0.2.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/qunit/.bower.json b/civicrm/bower_components/qunit/.bower.json deleted file mode 100644 index 76412286374528552f613c7f0e6dcf896599120c..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/qunit/.bower.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "qunit", - "homepage": "https://github.com/jquery/qunit", - "version": "1.10.0", - "_release": "1.10.0", - "_resolution": { - "type": "version", - "tag": "v1.10.0", - "commit": "900f72051b0112342feda3d700a7a049d886b9ce" - }, - "_source": "https://github.com/jquery/qunit.git", - "_target": "~1.10", - "_originalSource": "qunit" -} \ No newline at end of file diff --git a/civicrm/bower_components/qunit/.composer-downloads/qunit-4f8ae0790a302e5ed86ca7b079f3ab20.json b/civicrm/bower_components/qunit/.composer-downloads/qunit-4f8ae0790a302e5ed86ca7b079f3ab20.json new file mode 100644 index 0000000000000000000000000000000000000000..2438bdbaff9c6fbb373a0c6a3059a6bd4edb85d8 --- /dev/null +++ b/civicrm/bower_components/qunit/.composer-downloads/qunit-4f8ae0790a302e5ed86ca7b079f3ab20.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:qunit", + "url": "https://github.com/jquery/qunit/archive/v1.10.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/select2/.bower.json b/civicrm/bower_components/select2/.bower.json deleted file mode 100644 index ff78f03e76b50bb05e7c5a10e83d5d5339e40a1d..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/select2/.bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "select2", - "main": [ - "select2.js", - "select2.css", - "select2.png", - "select2x2.png", - "select2-spinner.gif" - ], - "dependencies": { - "jquery": ">= 1.7.1" - }, - "homepage": "https://github.com/colemanw/select2", - "_release": "1b03cb0b28", - "_resolution": { - "type": "branch", - "branch": "stable/3.5", - "commit": "1b03cb0b2837549350e17b8d07ae2947dd8ac0a6" - }, - "_source": "https://github.com/colemanw/select2.git", - "_target": "stable/3.5", - "_originalSource": "colemanw/select2" -} \ No newline at end of file diff --git a/civicrm/bower_components/select2/.composer-downloads/select2-35368a19f307e4af02d0df055846840d.json b/civicrm/bower_components/select2/.composer-downloads/select2-35368a19f307e4af02d0df055846840d.json new file mode 100644 index 0000000000000000000000000000000000000000..0ec2bae6e593850dc9a6dd22830ecd2e01d7e20c --- /dev/null +++ b/civicrm/bower_components/select2/.composer-downloads/select2-35368a19f307e4af02d0df055846840d.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:select2", + "url": "https://github.com/colemanw/select2/archive/v3.5-civicrm-1.0.zip" +} \ No newline at end of file diff --git a/civicrm/bower_components/smartmenus/.bower.json b/civicrm/bower_components/smartmenus/.bower.json deleted file mode 100644 index e655f19ef20ab6938dd347abf18fb747d920b03e..0000000000000000000000000000000000000000 --- a/civicrm/bower_components/smartmenus/.bower.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "smartmenus", - "title": "SmartMenus", - "description": "Advanced jQuery website menu plugin. Mobile first, responsive and accessible list-based website menus that work on all devices.", - "keywords": [ - "menu", - "navigation", - "accessible", - "responsive", - "mobile", - "ui", - "jquery-plugin", - "bootstrap", - "ecosystem:jquery" - ], - "version": "1.1.0", - "version_keyboard_addon": "0.4.0", - "version_bootstrap_addon": "0.4.0", - "version_bootstrap_4_addon": "0.1.0", - "main": [ - "dist/jquery.smartmenus.js" - ], - "author": { - "name": "Vasil Dinkov", - "email": "vasko.dinkov@gmail.com", - "url": "http://vadikom.com" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://www.opensource.org/licenses/MIT" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/vadikom/smartmenus.git" - }, - "bugs": "https://github.com/vadikom/smartmenus/issues", - "homepage": "http://www.smartmenus.org/", - "docs": "http://www.smartmenus.org/docs/", - "download": "http://www.smartmenus.org/download/", - "dependencies": { - "jquery": ">=1.7.0" - }, - "ignore": [ - ".gitignore", - "Gruntfile.js" - ], - "_release": "1.1.0", - "_resolution": { - "type": "version", - "tag": "1.1.0", - "commit": "9a73dd16049c8ac0b000d0c7b23b47defed61015" - }, - "_source": "https://github.com/vadikom/smartmenus.git", - "_target": "~1.1", - "_originalSource": "smartmenus" -} \ No newline at end of file diff --git a/civicrm/bower_components/smartmenus/.composer-downloads/smartmenus-b6b012dd2c05e4df06d5f6aa2ef2b36e.json b/civicrm/bower_components/smartmenus/.composer-downloads/smartmenus-b6b012dd2c05e4df06d5f6aa2ef2b36e.json new file mode 100644 index 0000000000000000000000000000000000000000..16db09c03c9ef1534dfa01b5419a07c3686e9e5d --- /dev/null +++ b/civicrm/bower_components/smartmenus/.composer-downloads/smartmenus-b6b012dd2c05e4df06d5f6aa2ef2b36e.json @@ -0,0 +1,4 @@ +{ + "name": "civicrm/civicrm-core:smartmenus", + "url": "https://github.com/vadikom/smartmenus/archive/1.1.0.zip" +} \ No newline at end of file diff --git a/civicrm/civicrm-version.php b/civicrm/civicrm-version.php index 260090910852bb201e1c1610722176ac5a6f728f..1eb317eff8d7892e4b7f5dfcdc3c636c9ac8c997 100644 --- a/civicrm/civicrm-version.php +++ b/civicrm/civicrm-version.php @@ -1,7 +1,7 @@ <?php /** @deprecated */ function civicrmVersion( ) { - return array( 'version' => '5.17.5', + return array( 'version' => '5.18.0', 'cms' => 'Wordpress', 'revision' => '' ); } diff --git a/civicrm/composer.json b/civicrm/composer.json index f5dfe176013a6710f60c3d8d15f77ed20ae044f6..b298a5c9baebd2f2c26493abea016c50179dc766 100644 --- a/civicrm/composer.json +++ b/civicrm/composer.json @@ -63,6 +63,7 @@ "cweagans/composer-patches": "~1.0", "pear/log": "1.13.1", "katzien/php-mime-type": "2.1.0", + "civicrm/composer-downloads-plugin": "^2.0", "league/csv": "^9.2" }, "require-dev": { @@ -87,6 +88,122 @@ ] }, "extra": { + "downloads": { + "*": { + "path": "bower_components/{$id}" + }, + "angular": { + "url": "https://github.com/angular/bower-angular/archive/v1.5.11.zip" + }, + "angular-bootstrap": { + "url": "https://github.com/angular-ui/bootstrap-bower/archive/2.5.0.zip" + }, + "angular-file-upload": { + "url": "https://github.com/nervgh/angular-file-upload/archive/v1.1.6.zip", + "ignore": ["examples"] + }, + "angular-jquery-dialog-service": { + "url": "https://github.com/totten/angular-jquery-dialog-service/archive/v0.8.0-civicrm-1.0.zip" + }, + "angular-mocks": { + "url": "https://github.com/angular/bower-angular-mocks/archive/v1.5.11.zip" + }, + "angular-route": { + "url": "https://github.com/angular/bower-angular-route/archive/v1.5.11.zip" + }, + "angular-sanitize": { + "url": "https://github.com/angular/bower-angular-sanitize/archive/v1.5.11.zip" + }, + "angular-ui-sortable": { + "url": "https://github.com/angular-ui/ui-sortable/archive/v0.12.11.zip" + }, + "angular-ui-utils": { + "url": "https://github.com/angular-ui/ui-utils/archive/v0.1.1.zip" + }, + "angular-unsavedChanges": { + "url": "https://github.com/facultymatt/angular-unsavedChanges/archive/v0.1.1.zip", + "ignore": [".*", "node_modules", "bower_components", "test", "tests"] + }, + "angular-xeditable": { + "url": "https://github.com/vitalets/angular-xeditable/archive/0.9.0.zip", + "ignore": [".*", "node_modules", "bower_components", "playground", "test", "libs", "docs", "zip", "src", "starter", "Gruntfile.js", "index.html", "jsdoc.conf.json", "package.json"] + }, + "checklist-model": { + "url": "https://github.com/vitalets/checklist-model/archive/1.0.0.zip", + "ignore": [".*", "node_modules", "docs", "Gruntfile.js", "index.html", "package.json", "test"] + }, + "ckeditor": { + "url": "https://github.com/ckeditor/ckeditor-releases/archive/4.9.2.zip" + }, + "crossfilter-1.3.x": { + "url": "https://github.com/crossfilter/crossfilter/archive/1.3.14.zip", + "ignore": [".*", "node_modules", "bower_components", "src", "lib", "test", "component.json", "package.json", "index.js", "Makefile"] + }, + "crossfilter2": { + "url": "https://github.com/crossfilter/crossfilter/archive/1.4.7.zip", + "ignore": [".*", "node_modules", "bower_components", "package.json", "index.js", "src", "component.json", "media", "test", "tests"] + }, + "css-color-names": { + "url": "https://github.com/bahamas10/css-color-names/archive/v1.0.1.zip" + }, + "d3": { + "url": "https://github.com/mbostock-bower/d3-bower/archive/v3.4.11.zip", + "ignore": [".DS_Store", ".git", ".gitignore", ".npmignore", ".travis.yml", "Makefile", "bin", "component.json", "index.js", "lib", "node_modules", "package.json", "src", "test"] + }, + "d3-3.5.x": { + "url": "https://github.com/mbostock-bower/d3-bower/archive/v3.5.17.zip" + }, + "datatables": { + "url": "https://github.com/DataTables/DataTables/archive/1.10.19.zip", + "ignore": ["/.*", "examples", "media/unit_testing", "composer.json", "dataTables.jquery.json", "package.json"] + }, + "dc-2.1.x": { + "url": "https://github.com/NickQiZhu/dc.js/archive/2.1.10.zip", + "ignore": [".*", "style", "web", "*.json", "regression", "scripts", "spec", "src", "docs", "grunt", "Gruntfile.js", "Changelog.md", "welcome.md", "class-hierarchy.dot", "index.js", "CONTRIBUTING.md", "LICENSE_BANNER", "AUTHORS"] + }, + "es6-promise": { + "url": "https://github.com/components/es6-promise/archive/v4.2.4.zip" + }, + "font-awesome": { + "url": "https://github.com/FortAwesome/Font-Awesome/archive/v4.7.0.zip", + "ignore": ["*/.*", "*.json", "src", "*.yml", "Gemfile", "Gemfile.lock", "*.md"] + }, + "google-code-prettify": { + "url": "https://github.com/tcollard/google-code-prettify/archive/v1.0.5.zip", + "ignore": ["closure-compiler", "js-modules", "tests", "yui-compressor", "Makefile"] + }, + "jquery": { + "url": "https://github.com/civicrm/jquery/archive/1.12.4-civicrm-1.2.zip" + }, + "jquery-ui": { + "url": "https://github.com/components/jqueryui/archive/1.12.1.zip" + }, + "jquery-validation": { + "url": "https://github.com/jquery-validation/jquery-validation/archive/1.13.1.zip", + "ignore": [".*", "node_modules", "bower_components", "test", "demo", "lib"] + }, + "jstree": { + "url": "https://github.com/vakata/jstree/archive/3.3.8.zip", + "ignore": [".*", "docs", "demo", "libs", "node_modules", "test", "libs", "jstree.jquery.json", "gruntfile.js", "package.json", "bower.json", "component.json", "LICENCE-MIT", "README.md"] + }, + "lodash-compat": { + "url": "https://github.com/lodash/lodash-compat/archive/3.0.1.zip", + "ignore": [".*", "*.log", "*.md", "component.json", "package.json", "node_modules"] + }, + "phantomjs-polyfill": { + "url": "https://github.com/conversocial/phantomjs-polyfill/archive/v0.0.2.zip" + }, + "qunit": { + "url": "https://github.com/jquery/qunit/archive/v1.10.0.zip" + }, + "select2": { + "url": "https://github.com/colemanw/select2/archive/v3.5-civicrm-1.0.zip" + }, + "smartmenus": { + "url": "https://github.com/vadikom/smartmenus/archive/1.1.0.zip", + "ignore": [".gitignore", "Gruntfile.js"] + } + }, "patches": { "phpoffice/common": { "Fix handling of libxml_disable_entity_loader": "tools/scripts/composer/patches/phpoffice-common-xml-entity-fix.patch" diff --git a/civicrm/composer.lock b/civicrm/composer.lock index db621338827172b2a5bc505edce33ebf358711f7..ab0f88ec85c2107011c5f89251960cf47f8d1db6 100644 --- a/civicrm/composer.lock +++ b/civicrm/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ffdac3f93564fe6edb467d3ac43c4869", + "content-hash": "195f60bb40e72b390be3211fcc870a38", "packages": [ { "name": "civicrm/civicrm-cxn-rpc", @@ -80,6 +80,57 @@ "description": "CiviCRM installation library", "time": "2018-01-23T06:26:55+00:00" }, + { + "name": "civicrm/composer-downloads-plugin", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/civicrm/composer-downloads-plugin.git", + "reference": "869b7a12f57b2d912f0ea77d5c33c1518b8de27d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/civicrm/composer-downloads-plugin/zipball/869b7a12f57b2d912f0ea77d5c33c1518b8de27d", + "reference": "869b7a12f57b2d912f0ea77d5c33c1518b8de27d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1", + "php": ">=5.6", + "togos/gitignore": "~1.1.1" + }, + "require-dev": { + "composer/composer": "~1.0", + "friendsofphp/php-cs-fixer": "^2.3", + "phpunit/phpunit": "^5.7", + "totten/process-helper": "^1.0.1" + }, + "type": "composer-plugin", + "extra": { + "class": "LastCall\\DownloadsPlugin\\Plugin" + }, + "autoload": { + "psr-4": { + "LastCall\\DownloadsPlugin\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Bayliss", + "email": "rob@lastcallmedia.com" + }, + { + "name": "Tim Otten", + "email": "totten@civicrm.org" + } + ], + "description": "Composer plugin for downloading additional files within any composer package.", + "time": "2019-08-22T10:56:51+00:00" + }, { "name": "cweagans/composer-patches", "version": "1.6.5", @@ -2107,6 +2158,39 @@ ], "time": "2018-10-16T17:24:05+00:00" }, + { + "name": "togos/gitignore", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/TOGoS/PHPGitIgnore.git", + "reference": "32bc0830e4123f670adcbf5ddda5bef362f4f4d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TOGoS/PHPGitIgnore/zipball/32bc0830e4123f670adcbf5ddda5bef362f4f4d4", + "reference": "32bc0830e4123f670adcbf5ddda5bef362f4f4d4", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "togos/simpler-test": "1.1.1" + }, + "type": "library", + "autoload": { + "psr-0": { + "TOGoS_GitIgnore_": "src/main/php/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Parser for .gitignore (and sparse-checkout, and anything else using the same format) files", + "time": "2019-04-19T19:16:58+00:00" + }, { "name": "totten/ca-config", "version": "v17.05.0", diff --git a/civicrm/css/joomla.css b/civicrm/css/joomla.css index 3f417d79160049a8b21ec4610d871d82767fa201..f232545eb1f6c32ff31ebfa0ff312d3cc5e5efc5 100644 --- a/civicrm/css/joomla.css +++ b/civicrm/css/joomla.css @@ -155,9 +155,6 @@ br.clear { #header, #content { width: 100%; } -#header { - background-color: #69c; -} #logo { vertical-align: middle; border: 0; diff --git a/civicrm/ext/api4/CRM/Api4/Page/AJAX.php b/civicrm/ext/api4/CRM/Api4/Page/AJAX.php index 6a1bc2dee6aacc92a2d8d1a6d908bfed4eb32563..e8346ca032cff80d34fac9417f32681940b90f71 100644 --- a/civicrm/ext/api4/CRM/Api4/Page/AJAX.php +++ b/civicrm/ext/api4/CRM/Api4/Page/AJAX.php @@ -33,7 +33,7 @@ class CRM_Api4_Page_AJAX extends CRM_Core_Page { ]; if (CRM_Core_Permission::check('view debug output')) { $response['error_message'] = $e->getMessage(); - if (CRM_Core_BAO_Setting::getItem(NULL, 'backtrace')) { + if (\Civi::settings()->get('backtrace')) { $response['backtrace'] = $e->getTrace(); } } @@ -54,12 +54,18 @@ class CRM_Api4_Page_AJAX extends CRM_Core_Page { */ protected function execute($entity, $action, $params = [], $index = NULL) { $params['checkPermissions'] = TRUE; - $result = civicrm_api4($entity, $action, $params, $index); + + // Handle numeric indexes later so we can get the count + $itemAt = CRM_Utils_Type::validate($index, 'Integer', FALSE); + + $result = civicrm_api4($entity, $action, $params, isset($itemAt) ? NULL : $index); + // Convert arrayObject into something more suitable for json - $vals = ['values' => (array) $result]; + $vals = ['values' => isset($itemAt) ? $result->itemAt($itemAt) : (array) $result]; foreach (get_class_vars(get_class($result)) as $key => $val) { $vals[$key] = $result->$key; } + $vals['count'] = $result->count(); return $vals; } diff --git a/civicrm/ext/api4/CRM/Api4/Page/Api4Explorer.php b/civicrm/ext/api4/CRM/Api4/Page/Api4Explorer.php index 50aa0c3d58a9e68de2a7cf40a433d2ac8290c05c..f06452548cb8ce576ad4e3bf0c247dbeb416b000 100644 --- a/civicrm/ext/api4/CRM/Api4/Page/Api4Explorer.php +++ b/civicrm/ext/api4/CRM/Api4/Page/Api4Explorer.php @@ -6,10 +6,14 @@ class CRM_Api4_Page_Api4Explorer extends CRM_Core_Page { $vars = [ 'operators' => \CRM_Core_DAO::acceptedSQLOperators(), 'basePath' => Civi::resources()->getUrl('org.civicrm.api4'), + 'schema' => (array) \Civi\Api4\Entity::get()->setChain(['fields' => ['$name', 'getFields']])->execute(), + 'links' => (array) \Civi\Api4\Entity::getLinks()->execute(), ]; Civi::resources() ->addVars('api4', $vars) - ->addScriptFile('org.civicrm.api4', 'js/load-bootstrap.js'); + ->addScriptFile('org.civicrm.api4', 'js/load-bootstrap.js') + ->addScriptFile('civicrm', 'bower_components/google-code-prettify/bin/prettify.min.js') + ->addStyleFile('civicrm', 'bower_components/google-code-prettify/bin/prettify.min.css'); $loader = new Civi\Angular\AngularLoader(); $loader->setModules(['api4Explorer']); diff --git a/civicrm/ext/api4/CRM/Api4/Services.php b/civicrm/ext/api4/CRM/Api4/Services.php new file mode 100644 index 0000000000000000000000000000000000000000..ddd889a39070e1a082fa93e715eb0aa3ba34241b --- /dev/null +++ b/civicrm/ext/api4/CRM/Api4/Services.php @@ -0,0 +1,75 @@ +<?php + +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\Config\FileLocator; + +class CRM_Api4_Services { + + /** + * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + */ + public static function hook_container($container) { + $loader = new XmlFileLoader($container, new FileLocator(dirname(dirname(__DIR__)))); + $loader->load('Civi/Api4/services.xml'); + + self::loadServices('Civi\Api4\Service\Spec\Provider', 'spec_provider', $container); + self::loadServices('Civi\Api4\Event\Subscriber', 'event_subscriber', $container); + + $container->getDefinition('civi_api_kernel')->addMethodCall( + 'registerApiProvider', + [new Reference('action_object_provider')] + ); + + // add event subscribers$container->get( + $dispatcher = $container->getDefinition('dispatcher'); + $subscribers = $container->findTaggedServiceIds('event_subscriber'); + + foreach (array_keys($subscribers) as $subscriber) { + $dispatcher->addMethodCall( + 'addSubscriber', + [new Reference($subscriber)] + ); + } + + // add spec providers + $providers = $container->findTaggedServiceIds('spec_provider'); + $gatherer = $container->getDefinition('spec_gatherer'); + + foreach (array_keys($providers) as $provider) { + $gatherer->addMethodCall( + 'addSpecProvider', + [new Reference($provider)] + ); + } + + if (defined('CIVICRM_UF') && CIVICRM_UF === 'UnitTests') { + $loader->load('tests/phpunit/api/v4/services.xml'); + } + } + + /** + * Load all services in a given directory + * + * @param string $namespace + * @param string $tag + * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + */ + public static function loadServices($namespace, $tag, $container) { + $namespace = \CRM_Utils_File::addTrailingSlash($namespace, '\\'); + foreach (\CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles() as $ext) { + $path = \CRM_Utils_File::addTrailingSlash(dirname($ext['filePath'])) . str_replace('\\', DIRECTORY_SEPARATOR, $namespace); + foreach (glob("$path*.php") as $file) { + $matches = []; + preg_match('/(\w*).php/', $file, $matches); + $serviceName = $namespace . array_pop($matches); + $serviceClass = new \ReflectionClass($serviceName); + if ($serviceClass->isInstantiable()) { + $definition = $container->register(str_replace('\\', '_', $serviceName), $serviceName); + $definition->addTag($tag); + } + } + } + } + +} diff --git a/civicrm/ext/api4/CRM/Api4/Upgrader.php b/civicrm/ext/api4/CRM/Api4/Upgrader.php index b2fda2a7249732afa8e0779fad6cae4caaa87512..534eca552f3e837c0db922e8a07b96d60809aab4 100644 --- a/civicrm/ext/api4/CRM/Api4/Upgrader.php +++ b/civicrm/ext/api4/CRM/Api4/Upgrader.php @@ -12,23 +12,29 @@ class CRM_Api4_Upgrader extends CRM_Api4_Upgrader_Base { * Install script */ public function install() { - // Add menu item for api explorer; rename v3 explorer menu item. try { $v3Item = civicrm_api3('Navigation', 'get', [ 'name' => 'API Explorer', - 'return' => ['id', 'parent_id'], + 'return' => ['id', 'parent_id', 'weight'], 'sequential' => 1, + 'domain_id' => CRM_Core_Config::domainID(), 'api.Navigation.create' => ['label' => ts("Api Explorer v3")], ]); - civicrm_api3('Navigation', 'create', [ - 'parent_id' => $v3Item['values'][0]['parent_id'], - 'label' => ts("Api Explorer v4"), - 'weight' => 2, + $existing = civicrm_api3('Navigation', 'getcount', [ 'name' => "Api Explorer v4", - 'permission' => "administer CiviCRM", - 'url' => "civicrm/api4#/explorer", - 'is_active' => 1, + 'domain_id' => CRM_Core_Config::domainID(), ]); + if (!$existing) { + civicrm_api3('Navigation', 'create', [ + 'parent_id' => $v3Item['values'][0]['parent_id'] ?? 'Developer', + 'label' => ts("Api Explorer v4"), + 'weight' => $v3Item['values'][0]['weight'] ?? 2, + 'name' => "Api Explorer v4", + 'permission' => "administer CiviCRM", + 'url' => "civicrm/api4#/explorer", + 'is_active' => 1, + ]); + } } catch (Exception $e) { // Couldn't create menu item. diff --git a/civicrm/ext/api4/Civi/Api4/Action/Address/AddressSaveTrait.php b/civicrm/ext/api4/Civi/Api4/Action/Address/AddressSaveTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..640d67e52528f1aebac3e63965d70c0e8c62b3cf --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Address/AddressSaveTrait.php @@ -0,0 +1,50 @@ +<?php + +namespace Civi\Api4\Action\Address; + +/** + * @inheritDoc + * @method bool getStreetParsing() + * @method $this setStreetParsing(bool $streetParsing) + * @method bool getSkipGeocode() + * @method $this setSkipGeocode(bool $skipGeocode) + * @method bool getFixAddress() + * @method $this setFixAddress(bool $fixAddress) + */ +trait AddressSaveTrait { + + /** + * Optional param to indicate you want the street_address field parsed into individual params + * + * @var bool + */ + protected $streetParsing = FALSE; + + /** + * Optional param to indicate you want to skip geocoding (useful when importing a lot of addresses at once, the job Geocode and Parse Addresses can execute this task after the import) + * + * @var bool + */ + protected $skipGeocode = FALSE; + + /** + * When true, apply various fixes to the address before insert. + * + * @var bool + */ + protected $fixAddress = TRUE; + + /** + * @inheritDoc + */ + protected function writeObjects($items) { + foreach ($items as &$item) { + if ($this->streetParsing && !empty($item['street_address'])) { + $item = array_merge($item, \CRM_Core_BAO_Address::parseStreetAddress($item['street_address'])); + } + $item['skip_geocode'] = $this->skipGeocode; + } + return parent::writeObjects($items); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Address/Create.php b/civicrm/ext/api4/Civi/Api4/Action/Address/Create.php index 641b76f6f7e213961529bc472f6185d1267f6232..43278d4126805da4282d2559e9f8cc182416d9f0 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/Address/Create.php +++ b/civicrm/ext/api4/Civi/Api4/Action/Address/Create.php @@ -2,42 +2,10 @@ namespace Civi\Api4\Action\Address; -use Civi\Api4\Generic\Result; - /** * @inheritDoc */ class Create extends \Civi\Api4\Generic\DAOCreateAction { - - /** - * Optional param to indicate you want the street_address field parsed into individual params - * - * @var bool - */ - protected $streetParsing = TRUE; - - /** - * Optional param to indicate you want to skip geocoding (useful when importing a lot of addresses at once, the job Geocode and Parse Addresses can execute this task after the import) - * - * @var bool - */ - protected $skipGeocode = FALSE; - - /** - * When true, apply various fixes to the address before insert. - * - * @var bool - */ - protected $fixAddress = TRUE; - - /** - * @inheritDoc - */ - public function _run(Result $result) { - $this->values['street_parsing'] = $this->streetParsing; - $this->values['skip_geocode'] = $this->skipGeocode; - $this->values['fix_address'] = $this->fixAddress; - parent::_run($result); - } + use AddressSaveTrait; } diff --git a/civicrm/ext/api4/Civi/Api4/Action/Address/Save.php b/civicrm/ext/api4/Civi/Api4/Action/Address/Save.php new file mode 100644 index 0000000000000000000000000000000000000000..d2b1e65820bc6d33795a91f8f1721af2f9880ad3 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Address/Save.php @@ -0,0 +1,11 @@ +<?php + +namespace Civi\Api4\Action\Address; + +/** + * @inheritDoc + */ +class Save extends \Civi\Api4\Generic\DAOSaveAction { + use AddressSaveTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Address/Update.php b/civicrm/ext/api4/Civi/Api4/Action/Address/Update.php index 862a8b9e7fac306d525e80b43cb30d4e46eeb0d2..214c2acd3f7a10684d7c3d5effe4f18bf25e19d0 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/Address/Update.php +++ b/civicrm/ext/api4/Civi/Api4/Action/Address/Update.php @@ -2,42 +2,10 @@ namespace Civi\Api4\Action\Address; -use Civi\Api4\Generic\Result; - /** * @inheritDoc */ class Update extends \Civi\Api4\Generic\DAOUpdateAction { - - /** - * Optional param to indicate you want the street_address field parsed into individual params - * - * @var bool - */ - protected $streetParsing = TRUE; - - /** - * Optional param to indicate you want to skip geocoding (useful when importing a lot of addresses at once, the job Geocode and Parse Addresses can execute this task after the import) - * - * @var bool - */ - protected $skipGeocode = FALSE; - - /** - * When true, apply various fixes to the address before insert. - * - * @var bool - */ - protected $fixAddress = TRUE; - - /** - * @inheritDoc - */ - public function _run(Result $result) { - $this->values['street_parsing'] = $this->streetParsing; - $this->values['skip_geocode'] = $this->skipGeocode; - $this->values['fix_address'] = $this->fixAddress; - parent::_run($result); - } + use AddressSaveTrait; } diff --git a/civicrm/ext/api4/Civi/Api4/Action/Campaign/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Campaign/Get.php new file mode 100644 index 0000000000000000000000000000000000000000..4b81accf1666e8ffc0d1e69f2ffeae5da48d6c3d --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Campaign/Get.php @@ -0,0 +1,12 @@ +<?php +namespace Civi\Api4\Action\Campaign; + +/** + * @inheritDoc + * + * Set current = true to get active, non past campaigns. + */ +class Get extends \Civi\Api4\Generic\DAOGetAction { + use \Civi\Api4\Generic\Traits\IsCurrentTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php b/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php deleted file mode 100644 index 1bd0bcec83e2b146ea052d37f18b793ebd10c294..0000000000000000000000000000000000000000 --- a/civicrm/ext/api4/Civi/Api4/Action/Contact/Create.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - -namespace Civi\Api4\Action\Contact; - -/** - * @inheritDoc - */ -class Create extends \Civi\Api4\Generic\DAOCreateAction { - - protected function fillDefaults(&$params) { - // Guess which type of contact is being created - if (empty($params['contact_type']) && !empty($params['organization_name'])) { - $params['contact_type'] = 'Organization'; - } - if (empty($params['contact_type']) && !empty($params['household_name'])) { - $params['contact_type'] = 'Household'; - } - // Will default to Individual per fieldSpec - parent::fillDefaults($params); - } - -} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Contact/GetChecksum.php b/civicrm/ext/api4/Civi/Api4/Action/Contact/GetChecksum.php new file mode 100644 index 0000000000000000000000000000000000000000..daa81df4c1e53117fd91737e733d760fd52800d3 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Contact/GetChecksum.php @@ -0,0 +1,45 @@ +<?php + +namespace Civi\Api4\Action\Contact; + +use Civi\Api4\Generic\Result; + +/** + * Generate a security checksum for anonymous access to CiviCRM. + * + * @method $this setContactId(int $cid) Set contact ID (required) + * @method int getContactId() Get contact ID param + * @method $this setTtl(int $ttl) Set TTL param + * @method int getTtl() Get TTL param + */ +class GetChecksum extends \Civi\Api4\Generic\AbstractAction { + + /** + * ID of contact + * + * @var int + * @required + */ + protected $contactId; + + /** + * Expiration time (hours). Defaults to 168 (24 * [7 or value of checksum_timeout system setting]). + * + * Set to 0 for infinite. + * + * @var int + */ + protected $ttl = NULL; + + /** + * @param \Civi\Api4\Generic\Result $result + */ + public function _run(Result $result) { + $ttl = ($this->ttl === 0 || $this->ttl === '0') ? 'inf' : $this->ttl; + $result[] = [ + 'id' => $this->contactId, + 'checksum' => \CRM_Contact_BAO_Contact_Utils::generateChecksum($this->contactId, NULL, $ttl), + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Contact/ValidateChecksum.php b/civicrm/ext/api4/Civi/Api4/Action/Contact/ValidateChecksum.php new file mode 100644 index 0000000000000000000000000000000000000000..07819c78725dd37c17da106e602e3846925e68a6 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Contact/ValidateChecksum.php @@ -0,0 +1,42 @@ +<?php + +namespace Civi\Api4\Action\Contact; + +use Civi\Api4\Generic\Result; + +/** + * Generate a security checksum for anonymous access to CiviCRM. + * + * @method $this setContactId(int $cid) Set contact ID (required) + * @method int getContactId() Get contact ID param + * @method $this setChecksum(string $checksum) Set checksum param (required) + * @method string getChecksum() Get checksum param + */ +class ValidateChecksum extends \Civi\Api4\Generic\AbstractAction { + + /** + * ID of contact + * + * @var int + * @required + */ + protected $contactId; + + /** + * Value of checksum + * + * @var string + * @required + */ + protected $checksum; + + /** + * @param \Civi\Api4\Generic\Result $result + */ + public function _run(Result $result) { + $result[] = [ + 'valid' => \CRM_Contact_BAO_Contact_Utils::validChecksum($this->contactId, $this->checksum), + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Contribution/Create.php b/civicrm/ext/api4/Civi/Api4/Action/Contribution/Create.php deleted file mode 100644 index 52ee63c8ecaf9ec5a2b77b3a0dfc6122ce62806c..0000000000000000000000000000000000000000 --- a/civicrm/ext/api4/Civi/Api4/Action/Contribution/Create.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -namespace Civi\Api4\Action\Contribution; - -use Civi\Api4\Generic\Result; - -/** - * @inheritDoc - */ -class Create extends \Civi\Api4\Generic\DAOCreateAction { - - public function _run(Result $result) { - // Required by Contribution BAO - $this->values['skipCleanMoney'] = TRUE; - parent::_run($result); - } - -} diff --git a/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php b/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php index 733776b7245d474f4707cccdb9b60cdac4c2478e..398ee36992a85334dd09c848ade54c32e5244d64 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php +++ b/civicrm/ext/api4/Civi/Api4/Action/CustomValue/GetFields.php @@ -2,7 +2,6 @@ namespace Civi\Api4\Action\CustomValue; -use Civi\Api4\Service\Spec\SpecGatherer; use Civi\Api4\Service\Spec\SpecFormatter; /** @@ -13,10 +12,10 @@ class GetFields extends \Civi\Api4\Generic\DAOGetFieldsAction { protected function getRecords() { $fields = $this->_itemsToGet('name'); - /** @var SpecGatherer $gatherer */ + /** @var \Civi\Api4\Service\Spec\SpecGatherer $gatherer */ $gatherer = \Civi::container()->get('spec_gatherer'); $spec = $gatherer->getSpec('Custom_' . $this->getCustomGroup(), $this->getAction(), $this->includeCustom); - return SpecFormatter::specToArray($spec->getFields($fields), (array) $this->select, $this->loadOptions); + return SpecFormatter::specToArray($spec->getFields($fields), $this->loadOptions); } /** diff --git a/civicrm/ext/api4/Civi/Api4/Action/CustomValue/Save.php b/civicrm/ext/api4/Civi/Api4/Action/CustomValue/Save.php new file mode 100644 index 0000000000000000000000000000000000000000..b2982845dbe868951268fbae340306e2289e56a5 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/CustomValue/Save.php @@ -0,0 +1,11 @@ +<?php + +namespace Civi\Api4\Action\CustomValue; + +/** + * @inheritDoc + */ +class Save extends \Civi\Api4\Generic\DAOSaveAction { + use \Civi\Api4\Generic\Traits\CustomValueActionTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Domain/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Domain/Get.php new file mode 100644 index 0000000000000000000000000000000000000000..9d67a80b1c0e2b3fb49157d9d114c86c211013eb --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Domain/Get.php @@ -0,0 +1,27 @@ +<?php + +namespace Civi\Api4\Action\Domain; + +/** + * @inheritDoc + */ +class Get extends \Civi\Api4\Generic\DAOGetAction { + + /** + * Return only the current domain. + * + * @var bool + */ + protected $currentDomain = FALSE; + + /** + * @inheritDoc + */ + protected function getObjects() { + if ($this->currentDomain) { + $this->addWhere('id', '=', \CRM_Core_Config::domainID()); + } + return parent::getObjects(); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Entity/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Entity/Get.php index 020c6398e071c55460a7d21b4052686b50361630..1d4678cd3c05191853f62650fdbd1dd82ce78edf 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/Entity/Get.php +++ b/civicrm/ext/api4/Civi/Api4/Action/Entity/Get.php @@ -25,8 +25,8 @@ class Get extends \Civi\Api4\Generic\BasicGetAction { */ protected function getRecords() { $entities = []; - foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { - $dir = \CRM_Utils_File::addTrailingSlash($path) . 'Civi/Api4'; + foreach (\CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles() as $ext) { + $dir = \CRM_Utils_File::addTrailingSlash(dirname($ext['filePath'])) . 'Civi/Api4'; if (is_dir($dir)) { foreach (glob("$dir/*.php") as $file) { $matches = []; diff --git a/civicrm/ext/api4/Civi/Api4/Action/Entity/GetLinks.php b/civicrm/ext/api4/Civi/Api4/Action/Entity/GetLinks.php index ee274bf90be6737de5e163ea57c4667b29333aea..bfd3c3b4064bd83a0b2c870a2b4d8cc26a9dca80 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/Entity/GetLinks.php +++ b/civicrm/ext/api4/Civi/Api4/Action/Entity/GetLinks.php @@ -2,7 +2,7 @@ namespace Civi\Api4\Action\Entity; -use \CRM_Core_DAO_AllCoreTables as AllCoreTables; +use Civi\Api4\Utils\CoreUtil; /** * Get a list of FK links between entities @@ -14,7 +14,7 @@ class GetLinks extends \Civi\Api4\Generic\BasicGetAction { /** @var \Civi\Api4\Service\Schema\SchemaMap $schema */ $schema = \Civi::container()->get('schema_map'); foreach ($schema->getTables() as $table) { - $entity = AllCoreTables::getBriefName(AllCoreTables::getClassForTable($table->getName())); + $entity = CoreUtil::getApiNameFromTableName($table->getName()); // Since this is an api function, exclude tables that don't have an api if (class_exists('\Civi\Api4\\' . $entity)) { $item = [ @@ -24,7 +24,7 @@ class GetLinks extends \Civi\Api4\Generic\BasicGetAction { ]; foreach ($table->getTableLinks() as $link) { $link = $link->toArray(); - $link['entity'] = AllCoreTables::getBriefName(AllCoreTables::getClassForTable($link['targetTable'])); + $link['entity'] = CoreUtil::getApiNameFromTableName($link['targetTable']); $item['links'][] = $link; } $result[] = $item; diff --git a/civicrm/ext/api4/Civi/Api4/Action/Event/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Event/Get.php new file mode 100644 index 0000000000000000000000000000000000000000..15cac2ff7a2579d825dbc08f448626c95ec9386e --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Event/Get.php @@ -0,0 +1,12 @@ +<?php +namespace Civi\Api4\Action\Event; + +/** + * @inheritDoc + * + * Set current = true to get active, non past events. + */ +class Get extends \Civi\Api4\Generic\DAOGetAction { + use \Civi\Api4\Generic\Traits\IsCurrentTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/GetActions.php b/civicrm/ext/api4/Civi/Api4/Action/GetActions.php index 1dc4ebbb9a40f183dab12382d2578ce363d650db..67da925b86d00688fd7a8ecf4edb4c8ea37748e8 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/GetActions.php +++ b/civicrm/ext/api4/Civi/Api4/Action/GetActions.php @@ -27,11 +27,10 @@ class GetActions extends BasicGetAction { } } if (!$this->_actionsToGet || count($this->_actionsToGet) > count($this->_actions)) { - $includePaths = array_unique(explode(PATH_SEPARATOR, get_include_path())); // Search entity-specific actions (including those provided by extensions) - foreach ($includePaths as $path) { - $dir = \CRM_Utils_File::addTrailingSlash($path) . 'Civi/Api4/Action/' . $this->_entityName; - $this->scanDir($dir); + foreach (\CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles() as $ext) { + $dir = \CRM_Utils_File::addTrailingSlash(dirname($ext['filePath'])); + $this->scanDir($dir . 'Civi/Api4/Action/' . $this->_entityName); } } ksort($this->_actions); @@ -47,7 +46,10 @@ class GetActions extends BasicGetAction { $matches = []; preg_match('/(\w*).php/', $file, $matches); $actionName = array_pop($matches); - $this->loadAction(lcfirst($actionName)); + $actionClass = new \ReflectionClass('\\Civi\\Api4\\Action\\' . $this->_entityName . '\\' . $actionName); + if ($actionClass->isInstantiable() && $actionClass->isSubclassOf('\\Civi\\Api4\\Generic\\AbstractAction')) { + $this->loadAction(lcfirst($actionName)); + } } } } @@ -69,6 +71,14 @@ class GetActions extends BasicGetAction { } if ($this->_isFieldSelected('params')) { $this->_actions[$actionName]['params'] = $action->getParamInfo(); + // Language param is only relevant on multilingual sites + $languageLimit = (array) \Civi::settings()->get('languageLimit'); + if (count($languageLimit) < 2) { + unset($this->_actions[$actionName]['params']['language']); + } + elseif (isset($this->_actions[$actionName]['params']['language'])) { + $this->_actions[$actionName]['params']['language']['options'] = array_keys($languageLimit); + } } } } diff --git a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Create.php b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Create.php index 44e61f2e751988ac826b961892a0307e841b790a..89dd8695aefe69698765ca6b859f8a401cb3f3c0 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Create.php +++ b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Create.php @@ -2,37 +2,10 @@ namespace Civi\Api4\Action\GroupContact; -use Civi\Api4\Generic\Result; - /** * @inheritDoc - * - * @method $this setMethod(string $method) Indicate who added/removed the group. - * @method $this setTracking(string $tracking) Specify ip address or other tracking info. */ class Create extends \Civi\Api4\Generic\DAOCreateAction { - - /** - * String to indicate who added/removed the group. - * - * @var string - */ - protected $method = 'API'; - - /** - * IP address or other tracking info about who performed this group subscription. - * - * @var string - */ - protected $tracking = ''; - - /** - * @inheritDoc - */ - public function _run(Result $result) { - $this->values['method'] = $this->method; - $this->values['tracking'] = $this->tracking; - parent::_run($result); - } + use GroupContactSaveTrait; } diff --git a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/GroupContactSaveTrait.php b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/GroupContactSaveTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..714225982806e623e988026ea75eddaa8ad7dac4 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/GroupContactSaveTrait.php @@ -0,0 +1,40 @@ +<?php + +namespace Civi\Api4\Action\GroupContact; + +/** + * @inheritDoc + * + * @method $this setMethod(string $method) Indicate who added/removed the group. + * @method string getMethod() + * @method $this setTracking(string $tracking) Specify ip address or other tracking info. + * @method string getTracking() + */ +trait GroupContactSaveTrait { + + /** + * String to indicate who added/removed the group. + * + * @var string + */ + protected $method = 'API'; + + /** + * IP address or other tracking info about who performed this group subscription. + * + * @var string + */ + protected $tracking = ''; + + /** + * @inheritDoc + */ + protected function writeObjects($items) { + foreach ($items as &$item) { + $item['method'] = $this->method; + $item['tracking'] = $this->tracking; + } + return parent::writeObjects($items); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Save.php b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Save.php new file mode 100644 index 0000000000000000000000000000000000000000..28ef046720e0b786baa607a72fbb86389557331b --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Save.php @@ -0,0 +1,11 @@ +<?php + +namespace Civi\Api4\Action\GroupContact; + +/** + * @inheritDoc + */ +class Save extends \Civi\Api4\Generic\DAOSaveAction { + use GroupContactSaveTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Update.php b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Update.php index edb8a90213d066292a032a1c11ec5d1ab8d71e06..f9b09334aa4cf07dba97a9b04674797d4ebde99e 100644 --- a/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Update.php +++ b/civicrm/ext/api4/Civi/Api4/Action/GroupContact/Update.php @@ -2,37 +2,10 @@ namespace Civi\Api4\Action\GroupContact; -use Civi\Api4\Generic\Result; - /** * @inheritDoc - * - * @method $this setMethod(string $method) Indicate who added/removed the group. - * @method $this setTracking(string $tracking) Specify ip address or other tracking info. */ class Update extends \Civi\Api4\Generic\DAOUpdateAction { - - /** - * String to indicate who added/removed the group. - * - * @var string - */ - protected $method = 'API'; - - /** - * IP address or other tracking info about who performed this group subscription. - * - * @var string - */ - protected $tracking = ''; - - /** - * @inheritDoc - */ - public function _run(Result $result) { - $this->values['method'] = $this->method; - $this->values['tracking'] = $this->tracking; - parent::_run($result); - } + use GroupContactSaveTrait; } diff --git a/civicrm/ext/api4/Civi/Api4/Action/Navigation/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Navigation/Get.php deleted file mode 100644 index dcecc06a9d55b9572d61c3d261fa5a6ad4c21fbd..0000000000000000000000000000000000000000 --- a/civicrm/ext/api4/Civi/Api4/Action/Navigation/Get.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Civi\Api4\Action\Navigation; - -/** - * @inheritDoc - * - * Fetch items from the navigation menu. By default this will fetch items from the current domain. - */ -class Get extends \Civi\Api4\Generic\DAOGetAction { - - /** - * @inheritDoc - */ - protected $where = [ - ['domain_id', '=', 'current_domain'], - ]; - -} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Participant/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Participant/Get.php deleted file mode 100644 index c5efec93d4ca2831fa5645ced0a8d1ab3b884d47..0000000000000000000000000000000000000000 --- a/civicrm/ext/api4/Civi/Api4/Action/Participant/Get.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -namespace Civi\Api4\Action\Participant; - -/** - * @inheritDoc - */ -class Get extends \Civi\Api4\Generic\DAOGetAction { - - /** - * @inheritDoc - * $example->addWhere('contact_id.contact_type', 'IN', array('Individual', 'Household')) - */ - protected $where = [ - ['is_test', '=', 0], - ]; - -} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Relationship/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Relationship/Get.php new file mode 100644 index 0000000000000000000000000000000000000000..f94dad55f915d07ec0174ccf4e718a06ea183caa --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Relationship/Get.php @@ -0,0 +1,12 @@ +<?php +namespace Civi\Api4\Action\Relationship; + +/** + * @inheritDoc + * + * Set current = true to get active, non past relationships. + */ +class Get extends \Civi\Api4\Generic\DAOGetAction { + use \Civi\Api4\Generic\Traits\IsCurrentTrait; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/AbstractSettingAction.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/AbstractSettingAction.php new file mode 100644 index 0000000000000000000000000000000000000000..a0481e1804a5f646de7ff31e04e42f00b7771801 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/AbstractSettingAction.php @@ -0,0 +1,80 @@ +<?php +namespace Civi\Api4\Action\Setting; + +use Civi\Api4\Domain; +use Civi\Api4\Generic\Result; + +/** + * Base class for setting actions. + * + * @method int getDomainId + * @method $this setDomainId(int $domainId) + */ +abstract class AbstractSettingAction extends \Civi\Api4\Generic\AbstractAction { + + /** + * Domain id of setting. Leave NULL for default domain. + * + * @var int|string|array + */ + protected $domainId; + + /** + * Contact - if this is a contact-related setting. + * + * @var int + */ + protected $contactId; + + public function _run(Result $result) { + $this->findDomains(); + $meta = []; + foreach ($this->domainId as $domain) { + $meta[$domain] = $this->validateSettings($domain); + } + foreach ($this->domainId as $domain) { + $settingsBag = $this->contactId ? \Civi::contactSettings($this->contactId, $domain) : \Civi::settings($domain); + $this->processSettings($result, $settingsBag, $meta[$domain], $domain); + } + } + + /** + * Checks that really ought to be taken care of by Civi::settings + * + * @param int $domain + * @return array + * @throws \API_Exception + */ + protected function validateSettings($domain) { + $meta = \Civi\Core\SettingsMetadata::getMetadata([], $domain); + $names = isset($this->values) ? array_keys($this->values) : $this->select; + $invalid = array_diff($names, array_keys($meta)); + if ($invalid) { + throw new \API_Exception("Unknown settings for domain $domain: " . implode(', ', $invalid)); + } + if (isset($this->values)) { + foreach ($this->values as $name => &$value) { + \CRM_Core_BAO_Setting::validateSetting($value, $meta[$name]); + } + } + return $meta; + } + + protected function findDomains() { + if ($this->domainId == 'all') { + $this->domainId = Domain::get()->setCheckPermissions(FALSE)->addSelect('id')->execute()->column('id'); + } + elseif ($this->domainId) { + $this->domainId = (array) $this->domainId; + $domains = Domain::get()->setCheckPermissions(FALSE)->addSelect('id')->execute()->column('id'); + $invalid = array_diff($this->domainId, $domains); + if ($invalid) { + throw new \API_Exception('Invalid domain id: ' . implode(', ', $invalid)); + } + } + else { + $this->domainId = [\CRM_Core_Config::domainID()]; + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/Get.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/Get.php new file mode 100644 index 0000000000000000000000000000000000000000..31d5e8b2f2868f6c8e4869086a9349917582c931 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/Get.php @@ -0,0 +1,55 @@ +<?php +namespace Civi\Api4\Action\Setting; + +use Civi\Api4\Generic\Result; + +/** + * Get the value of one or more CiviCRM settings. + * + * @method array getSelect + * @method $this addSelect(string $name) + * @method $this setSelect(array $select) + */ +class Get extends AbstractSettingAction { + + /** + * Names of settings to retrieve + * + * @var array + */ + protected $select = []; + + /** + * @param \Civi\Api4\Generic\Result $result + * @param \Civi\Core\SettingsBag $settingsBag + * @param array $meta + * @param int $domain + * @throws \Exception + */ + protected function processSettings(Result $result, $settingsBag, $meta, $domain) { + if ($this->select) { + foreach ($this->select as $name) { + $result[] = [ + 'name' => $name, + 'value' => $settingsBag->get($name), + 'domain_id' => $domain, + ]; + } + } + else { + foreach ($settingsBag->all() as $name => $value) { + $result[] = [ + 'name' => $name, + 'value' => $value, + 'domain_id' => $domain, + ]; + } + } + foreach ($result as $name => &$setting) { + if (isset($setting['value']) && !empty($meta[$name]['serialize'])) { + $setting['value'] = \CRM_Core_DAO::unSerializeField($setting['value'], $meta[$name]['serialize']); + } + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/GetFields.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/GetFields.php new file mode 100644 index 0000000000000000000000000000000000000000..5864a468792349cbb0c8ee6b3270543d9d7c56da --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/GetFields.php @@ -0,0 +1,84 @@ +<?php +namespace Civi\Api4\Action\Setting; + +/** + * Get information about CiviCRM settings. + * + * @method int getDomainId + * @method $this setDomainId(int $domainId) + */ +class GetFields extends \Civi\Api4\Generic\BasicGetFieldsAction { + + /** + * Domain id of settings. Leave NULL for default domain. + * + * @var int + */ + protected $domainId; + + protected function getRecords() { + // TODO: Waiting for filter handling to get fixed in core + // $names = $this->_itemsToGet('name'); + // $filter = $names ? ['name' => $names] : []; + $filter = []; + return \Civi\Core\SettingsMetadata::getMetadata($filter, $this->domainId, $this->loadOptions); + } + + public function fields() { + return [ + [ + 'name' => 'name', + 'data_type' => 'String', + ], + [ + 'name' => 'title', + 'data_type' => 'String', + ], + [ + 'name' => 'description', + 'data_type' => 'String', + ], + [ + 'name' => 'help_text', + 'data_type' => 'String', + ], + [ + 'name' => 'default', + 'data_type' => 'String', + ], + [ + 'name' => 'pseudoconstant', + 'data_type' => 'String', + ], + [ + 'name' => 'options', + 'data_type' => 'Array', + ], + [ + 'name' => 'group_name', + 'data_type' => 'String', + ], + [ + 'name' => 'group', + 'data_type' => 'String', + ], + [ + 'name' => 'html_type', + 'data_type' => 'String', + ], + [ + 'name' => 'add', + 'data_type' => 'String', + ], + [ + 'name' => 'serialize', + 'data_type' => 'Integer', + ], + [ + 'name' => 'data_type', + 'data_type' => 'Integer', + ], + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/Revert.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/Revert.php new file mode 100644 index 0000000000000000000000000000000000000000..65540abfd7ce84e480bc93adf6e663f7c78699e1 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/Revert.php @@ -0,0 +1,46 @@ +<?php +namespace Civi\Api4\Action\Setting; + +use Civi\Api4\Generic\Result; + +/** + * Revert one or more CiviCRM settings to their default value. + * + * @method array getSelect + * @method $this addSelect(string $name) + * @method $this setSelect(array $select) + */ +class Revert extends AbstractSettingAction { + + /** + * Names of settings to revert + * + * @var array + * @required + */ + protected $select = []; + + /** + * @param \Civi\Api4\Generic\Result $result + * @param \Civi\Core\SettingsBag $settingsBag + * @param array $meta + * @param int $domain + * @throws \Exception + */ + protected function processSettings(Result $result, $settingsBag, $meta, $domain) { + foreach ($this->select as $name) { + $settingsBag->revert($name); + $result[] = [ + 'name' => $name, + 'value' => $settingsBag->get($name), + 'domain_id' => $domain, + ]; + } + foreach ($result as $name => &$setting) { + if (isset($setting['value']) && !empty($meta[$name]['serialize'])) { + $setting['value'] = \CRM_Core_DAO::unSerializeField($setting['value'], $meta[$name]['serialize']); + } + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/Setting/Set.php b/civicrm/ext/api4/Civi/Api4/Action/Setting/Set.php new file mode 100644 index 0000000000000000000000000000000000000000..ad9804ab5ad3074c00396e724798cdcddb84533c --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/Setting/Set.php @@ -0,0 +1,44 @@ +<?php +namespace Civi\Api4\Action\Setting; + +use Civi\Api4\Generic\Result; + +/** + * Set the value of one or more CiviCRM settings. + * + * @method array getValues + * @method $this setValues(array $value) + * @method $this addValue(string $name, mixed $value) + */ +class Set extends AbstractSettingAction { + + /** + * Setting names/values to set. + * + * @var mixed + * @required + */ + protected $values = []; + + /** + * @param \Civi\Api4\Generic\Result $result + * @param \Civi\Core\SettingsBag $settingsBag + * @param array $meta + * @param int $domain + * @throws \Exception + */ + protected function processSettings(Result $result, $settingsBag, $meta, $domain) { + foreach ($this->values as $name => $value) { + if (isset($value) && !empty($meta[$name]['serialize'])) { + $value = \CRM_Core_DAO::serializeField($value, $meta[$name]['serialize']); + } + $settingsBag->set($name, $value); + $result[] = [ + 'name' => $name, + 'value' => $this->values[$name], + 'domain_id' => $domain, + ]; + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/System/Check.php b/civicrm/ext/api4/Civi/Api4/Action/System/Check.php new file mode 100644 index 0000000000000000000000000000000000000000..1910f61b0d31a2178db9692b257a54c97876189e --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/System/Check.php @@ -0,0 +1,83 @@ +<?php +namespace Civi\Api4\Action\System; + +/** + * Retrieve system notices, warnings, errors, etc. + */ +class Check extends \Civi\Api4\Generic\BasicGetAction { + + protected function getRecords() { + $messages = []; + foreach (\CRM_Utils_Check::checkAll() as $message) { + $messages[] = $message->toArray(); + } + return $messages; + } + + public static function fields() { + return [ + [ + 'name' => 'name', + 'title' => 'Name', + 'description' => 'Unique identifier', + 'data_type' => 'String', + ], + [ + 'name' => 'title', + 'title' => 'Title', + 'description' => 'Short title text', + 'data_type' => 'String', + ], + [ + 'name' => 'message', + 'title' => 'Message', + 'description' => 'Long description html', + 'data_type' => 'String', + ], + [ + 'name' => 'help', + 'title' => 'Help', + 'description' => 'Optional extra help (html string)', + 'data_type' => 'String', + ], + [ + 'name' => 'icon', + 'description' => 'crm-i class of icon to display with message', + 'data_type' => 'String', + ], + [ + 'name' => 'severity', + 'title' => 'Severity', + 'description' => 'Psr\Log\LogLevel string', + 'data_type' => 'String', + 'options' => array_combine(\CRM_Utils_Check::getSeverityList(), \CRM_Utils_Check::getSeverityList()), + ], + [ + 'name' => 'severity_id', + 'title' => 'Severity ID', + 'description' => 'Integer representation of Psr\Log\LogLevel', + 'data_type' => 'Integer', + 'options' => \CRM_Utils_Check::getSeverityList(), + ], + [ + 'name' => 'is_visible', + 'title' => 'is visible', + 'description' => '0 if message has been hidden by the user', + 'data_type' => 'Boolean', + ], + [ + 'name' => 'hidden_until', + 'title' => 'Hidden until', + 'description' => 'When will hidden message be visible again?', + 'data_type' => 'Date', + ], + [ + 'name' => 'actions', + 'title' => 'Actions', + 'description' => 'List of actions user can perform', + 'data_type' => 'Array', + ], + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Action/System/Flush.php b/civicrm/ext/api4/Civi/Api4/Action/System/Flush.php new file mode 100644 index 0000000000000000000000000000000000000000..0a39138576c742829858897dbde4c53ef65a80ee --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Action/System/Flush.php @@ -0,0 +1,32 @@ +<?php +namespace Civi\Api4\Action\System; + +/** + * Clear CiviCRM caches, and optionally rebuild triggers and reset sessions. + * + * @method bool getTriggers + * @method $this setTriggers(bool $triggers) + * @method bool getSession + * @method $this setSession(bool $session) + */ +class Flush extends \Civi\Api4\Generic\AbstractAction { + + /** + * Rebuild db triggers + * + * @var bool + */ + protected $triggers = FALSE; + + /** + * Reset sessions + * + * @var bool + */ + protected $session = FALSE; + + public function _run(\Civi\Api4\Generic\Result $result) { + \CRM_Core_Invoke::rebuildMenuAndCaches($this->triggers, $this->session); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Address.php b/civicrm/ext/api4/Civi/Api4/Address.php index e52b6283e4a5e54659f1be397574f52747ccdbd3..be8df42d569260c32a14c6a32777f9c4fbb51266 100644 --- a/civicrm/ext/api4/Civi/Api4/Address.php +++ b/civicrm/ext/api4/Civi/Api4/Address.php @@ -22,6 +22,13 @@ class Address extends Generic\DAOEntity { return new \Civi\Api4\Action\Address\Create(__CLASS__, __FUNCTION__); } + /** + * @return \Civi\Api4\Action\Address\Save + */ + public static function save() { + return new \Civi\Api4\Action\Address\Save(__CLASS__, __FUNCTION__); + } + /** * @return \Civi\Api4\Action\Address\Update */ diff --git a/civicrm/ext/api4/Civi/Api4/Campaign.php b/civicrm/ext/api4/Civi/Api4/Campaign.php new file mode 100644 index 0000000000000000000000000000000000000000..ee85821eb4afa61b5b8a6a43ca7e144949e3d02c --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Campaign.php @@ -0,0 +1,19 @@ +<?php + +namespace Civi\Api4; + +/** + * Campaign entity. + * + * @package Civi\Api4 + */ +class Campaign extends Generic\DAOEntity { + + /** + * @return \Civi\Api4\Action\Campaign\Get + */ + public static function get() { + return new \Civi\Api4\Action\Campaign\Get(__CLASS__, __FUNCTION__); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Contact.php b/civicrm/ext/api4/Civi/Api4/Contact.php index cca8c335d3e36bc95c683674f92bb38ba58b47b9..7282ba7cf9af55d192333ff6c87b1bba712a1127 100644 --- a/civicrm/ext/api4/Civi/Api4/Contact.php +++ b/civicrm/ext/api4/Civi/Api4/Contact.php @@ -14,26 +14,16 @@ namespace Civi\Api4; */ class Contact extends Generic\DAOEntity { - /** - * @return Action\Contact\Create - */ - public static function create() { - return new Action\Contact\Create(__CLASS__, __FUNCTION__); + public static function getFields() { + return new Action\Contact\GetFields(__CLASS__, __FUNCTION__); } - /** - * @return \Civi\Api4\Generic\DAOUpdateAction - */ - public static function update() { - // For some reason the contact bao requires this for updating - return new Generic\DAOUpdateAction(__CLASS__, __FUNCTION__, ['id', 'contact_type']); + public static function getChecksum() { + return new Action\Contact\GetChecksum(__CLASS__, __FUNCTION__); } - /** - * @return \Civi\Api4\Action\Contact\GetFields - */ - public static function getFields() { - return new Action\Contact\GetFields(__CLASS__, __FUNCTION__); + public static function validateChecksum() { + return new Action\Contact\ValidateChecksum(__CLASS__, __FUNCTION__); } } diff --git a/civicrm/ext/api4/Civi/Api4/Contribution.php b/civicrm/ext/api4/Civi/Api4/Contribution.php index 903c4753401f98b4c40615543df6f8b55668181a..1386caebf622468156fb378c7fbfe28dcf712fcc 100644 --- a/civicrm/ext/api4/Civi/Api4/Contribution.php +++ b/civicrm/ext/api4/Civi/Api4/Contribution.php @@ -9,11 +9,4 @@ namespace Civi\Api4; */ class Contribution extends Generic\DAOEntity { - /** - * @return \Civi\Api4\Action\Contribution\Create - */ - public static function create() { - return new \Civi\Api4\Action\Contribution\Create(__CLASS__, __FUNCTION__); - } - } diff --git a/civicrm/ext/api4/Civi/Api4/ContributionPage.php b/civicrm/ext/api4/Civi/Api4/ContributionPage.php new file mode 100644 index 0000000000000000000000000000000000000000..51c92320176f72722107e33ad3fc9015d1430cc3 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/ContributionPage.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * ContributionPage entity. + * + * @package Civi\Api4 + */ +class ContributionPage extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/CustomValue.php b/civicrm/ext/api4/Civi/Api4/CustomValue.php index 9cf4da43604da17517b8ec344053d4cb9ebb7847..037470e3af0629d8139085a5e265ca1fb518e09b 100644 --- a/civicrm/ext/api4/Civi/Api4/CustomValue.php +++ b/civicrm/ext/api4/Civi/Api4/CustomValue.php @@ -25,6 +25,14 @@ class CustomValue extends Generic\AbstractEntity { return new Action\CustomValue\GetFields($customGroup, __FUNCTION__); } + /** + * @param string $customGroup + * @return Action\CustomValue\Save + */ + public static function save($customGroup) { + return new Action\CustomValue\Save($customGroup, __FUNCTION__); + } + /** * @param string $customGroup * @return Action\CustomValue\Create diff --git a/civicrm/ext/api4/Civi/Api4/Domain.php b/civicrm/ext/api4/Civi/Api4/Domain.php new file mode 100644 index 0000000000000000000000000000000000000000..9aebbf47083d820553624247e99e8dddc0a483dd --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Domain.php @@ -0,0 +1,16 @@ +<?php + +namespace Civi\Api4; + +/** + * Domains - multisite instances of CiviCRM. + * + * @package Civi\Api4 + */ +class Domain extends Generic\DAOEntity { + + public static function get() { + return new \Civi\Api4\Action\Domain\Get(__CLASS__, __FUNCTION__); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Entity.php b/civicrm/ext/api4/Civi/Api4/Entity.php index bc759d051738db534e4e763cf3fdc8c508cab155..008e818f100892f783af34a09969cc749bcac18a 100644 --- a/civicrm/ext/api4/Civi/Api4/Entity.php +++ b/civicrm/ext/api4/Civi/Api4/Entity.php @@ -41,7 +41,7 @@ class Entity extends Generic\AbstractEntity { */ public static function permissions() { return [ - 'default' => ['access CiviCRM'] + 'default' => ['access CiviCRM'], ]; } diff --git a/civicrm/ext/api4/Civi/Api4/EntityTag.php b/civicrm/ext/api4/Civi/Api4/EntityTag.php new file mode 100644 index 0000000000000000000000000000000000000000..6274e0c8fd3b704dacb08bdfe51092d338751275 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/EntityTag.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * EntityTag - links tags to contacts, activities, etc. + * + * @package Civi\Api4 + */ +class EntityTag extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event.php b/civicrm/ext/api4/Civi/Api4/Event.php index 1a07cc3df40f283e78b2594eaff782eefc23ab79..70555af82cf5c4b555d929d7f5ca31d9f766cd4f 100644 --- a/civicrm/ext/api4/Civi/Api4/Event.php +++ b/civicrm/ext/api4/Civi/Api4/Event.php @@ -9,4 +9,11 @@ namespace Civi\Api4; */ class Event extends Generic\DAOEntity { + /** + * @return \Civi\Api4\Action\Event\Get + */ + public static function get() { + return new \Civi\Api4\Action\Event\Get(__CLASS__, __FUNCTION__); + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Event/GetSpecEvent.php b/civicrm/ext/api4/Civi/Api4/Event/GetSpecEvent.php index cc24785377af8ccb181f13be9bc287794e43244d..d85f416c6fa1aca3723929de0a201af72ac094ad 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/GetSpecEvent.php +++ b/civicrm/ext/api4/Civi/Api4/Event/GetSpecEvent.php @@ -7,19 +7,19 @@ use Symfony\Component\EventDispatcher\Event as BaseEvent; class GetSpecEvent extends BaseEvent { /** - * @var AbstractAction + * @var \Civi\Api4\Generic\AbstractAction */ protected $request; /** - * @param AbstractAction $request + * @param \Civi\Api4\Generic\AbstractAction $request */ public function __construct(AbstractAction $request) { $this->request = $request; } /** - * @return AbstractAction + * @return \Civi\Api4\Generic\AbstractAction */ public function getRequest() { return $this->request; diff --git a/civicrm/ext/api4/Civi/Api4/Event/PostSelectQueryEvent.php b/civicrm/ext/api4/Civi/Api4/Event/PostSelectQueryEvent.php index 4489033b223d6448811ca478e5084f85bfa82cdd..15456d7ffeef2499e7949d8548d8ad7098e70199 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/PostSelectQueryEvent.php +++ b/civicrm/ext/api4/Civi/Api4/Event/PostSelectQueryEvent.php @@ -13,14 +13,14 @@ class PostSelectQueryEvent extends Event { protected $results; /** - * @var Api4SelectQuery + * @var \Civi\Api4\Query\Api4SelectQuery */ protected $query; /** * PostSelectQueryEvent constructor. * @param array $results - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query */ public function __construct(array $results, Api4SelectQuery $query) { $this->results = $results; @@ -45,14 +45,14 @@ class PostSelectQueryEvent extends Event { } /** - * @return Api4SelectQuery + * @return \Civi\Api4\Query\Api4SelectQuery */ public function getQuery() { return $this->query; } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @return $this */ public function setQuery($query) { diff --git a/civicrm/ext/api4/Civi/Api4/Event/SchemaMapBuildEvent.php b/civicrm/ext/api4/Civi/Api4/Event/SchemaMapBuildEvent.php index f79f6b4be86a5f3a3410274a3b69a09688bb878e..7698eb2df1ba6156feae78de30067e3fe624d41b 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/SchemaMapBuildEvent.php +++ b/civicrm/ext/api4/Civi/Api4/Event/SchemaMapBuildEvent.php @@ -7,26 +7,26 @@ use Symfony\Component\EventDispatcher\Event as BaseEvent; class SchemaMapBuildEvent extends BaseEvent { /** - * @var SchemaMap + * @var \Civi\Api4\Service\Schema\SchemaMap */ protected $schemaMap; /** - * @param SchemaMap $schemaMap + * @param \Civi\Api4\Service\Schema\SchemaMap $schemaMap */ public function __construct(SchemaMap $schemaMap) { $this->schemaMap = $schemaMap; } /** - * @return SchemaMap + * @return \Civi\Api4\Service\Schema\SchemaMap */ public function getSchemaMap() { return $this->schemaMap; } /** - * @param SchemaMap $schemaMap + * @param \Civi\Api4\Service\Schema\SchemaMap $schemaMap * * @return $this */ diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php index 1938ce0bdaaa0bb981d988ddc7ab5fd6a47e0d1a..adfd17c8d091e501f8f5b21f0169737443b69a90 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivityPreCreationSubscriber.php @@ -5,9 +5,10 @@ namespace Civi\Api4\Event\Subscriber; use Civi\Api4\Generic\DAOCreateAction; use Civi\Api4\OptionValue; -class ActivityPreCreationSubscriber extends PreCreationSubscriber { +class ActivityPreCreationSubscriber extends Generic\PreCreationSubscriber { + /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * @throws \API_Exception * @throws \Exception */ @@ -29,7 +30,7 @@ class ActivityPreCreationSubscriber extends PreCreationSubscriber { } /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * * @return bool */ diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivitySchemaMapSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivitySchemaMapSubscriber.php index 52d58397d894c55ea1849709517f2dead814a76a..4e05c44de30c2c1d5c6220366910abb90509a1d9 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivitySchemaMapSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ActivitySchemaMapSubscriber.php @@ -8,9 +8,9 @@ use Civi\Api4\Service\Schema\Joinable\ActivityToActivityContactAssigneesJoinable use Civi\Api4\Service\Schema\Joinable\BridgeJoinable; use Civi\Api4\Service\Schema\Joinable\Joinable; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use \CRM_Utils_String as StringHelper; class ActivitySchemaMapSubscriber implements EventSubscriberInterface { + /** * @return array */ @@ -21,13 +21,13 @@ class ActivitySchemaMapSubscriber implements EventSubscriberInterface { } /** - * @param SchemaMapBuildEvent $event + * @param \Civi\Api4\Event\SchemaMapBuildEvent $event */ public function onSchemaBuild(SchemaMapBuildEvent $event) { $schema = $event->getSchemaMap(); $table = $schema->getTableByName('civicrm_activity'); - $middleAlias = StringHelper::createRandom(10, implode(range('a', 'z'))); + $middleAlias = \CRM_Utils_String::createRandom(10, implode(range('a', 'z'))); $middleLink = new ActivityToActivityContactAssigneesJoinable($middleAlias); $bridge = new BridgeJoinable('civicrm_contact', 'id', 'assignees', $middleLink); diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactPreSaveSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactPreSaveSubscriber.php new file mode 100644 index 0000000000000000000000000000000000000000..21d2627aad50290068fca7735f2133e7f3672286 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactPreSaveSubscriber.php @@ -0,0 +1,25 @@ +<?php + +namespace Civi\Api4\Event\Subscriber; + +use Civi\Api4\Generic\AbstractAction; + +class ContactPreSaveSubscriber extends Generic\PreSaveSubscriber { + + public $supportedOperation = 'create'; + + public function modify(&$contact, AbstractAction $request) { + // Guess which type of contact is being created + if (empty($contact['contact_type']) && !empty($contact['organization_name'])) { + $contact['contact_type'] = 'Organization'; + } + if (empty($contact['contact_type']) && !empty($contact['household_name'])) { + $contact['contact_type'] = 'Household'; + } + } + + public function applies(AbstractAction $request) { + return $request->getEntityName() === 'Contact'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactSchemaMapSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactSchemaMapSubscriber.php index edea3de6599a0420723e9fa2fd07174f104bf267..f2c82a07c2fce1269057406fefd7a88e70b7241d 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactSchemaMapSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContactSchemaMapSubscriber.php @@ -5,10 +5,10 @@ namespace Civi\Api4\Event\Subscriber; use Civi\Api4\Event\Events; use Civi\Api4\Event\SchemaMapBuildEvent; use Civi\Api4\Service\Schema\Joinable\Joinable; -use Civi\Api4\Service\Schema\Table; use Symfony\Component\EventDispatcher\EventSubscriberInterface; class ContactSchemaMapSubscriber implements EventSubscriberInterface { + /** * @return array */ @@ -19,7 +19,7 @@ class ContactSchemaMapSubscriber implements EventSubscriberInterface { } /** - * @param SchemaMapBuildEvent $event + * @param \Civi\Api4\Event\SchemaMapBuildEvent $event */ public function onSchemaBuild(SchemaMapBuildEvent $event) { $schema = $event->getSchemaMap(); @@ -29,7 +29,7 @@ class ContactSchemaMapSubscriber implements EventSubscriberInterface { } /** - * @param Table $table + * @param \Civi\Api4\Service\Schema\Table $table */ private function addCreatedActivitiesLink($table) { $alias = 'created_activities'; @@ -40,7 +40,7 @@ class ContactSchemaMapSubscriber implements EventSubscriberInterface { } /** - * @param Table $table + * @param \Civi\Api4\Service\Schema\Table $table */ private function fixPreferredLanguageAlias($table) { foreach ($table->getExternalLinks() as $link) { diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContributionPreSaveSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContributionPreSaveSubscriber.php new file mode 100644 index 0000000000000000000000000000000000000000..dfc723a495fa62516f275fb8ec89014d5055157a --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ContributionPreSaveSubscriber.php @@ -0,0 +1,18 @@ +<?php + +namespace Civi\Api4\Event\Subscriber; + +use Civi\Api4\Generic\AbstractAction; + +class ContributionPreSaveSubscriber extends Generic\PreSaveSubscriber { + + public function modify(&$record, AbstractAction $request) { + // Required by Contribution BAO + $record['skipCleanMoney'] = TRUE; + } + + public function applies(AbstractAction $request) { + return $request->getEntityName() === 'Contribution'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreCreationSubscriber.php deleted file mode 100644 index 289e105715934b9853d363eef09f6bda957050fb..0000000000000000000000000000000000000000 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreCreationSubscriber.php +++ /dev/null @@ -1,91 +0,0 @@ -<?php - -namespace Civi\Api4\Event\Subscriber; - -use Civi\Api4\Generic\DAOCreateAction; - -class CustomFieldPreCreationSubscriber extends PreCreationSubscriber { - - const OPTION_TYPE_NEW = 1; - const OPTION_STATUS_ACTIVE = 1; - - /** - * @param DAOCreateAction $request - */ - public function modify(DAOCreateAction $request) { - $this->formatOptionParams($request); - $this->setDefaults($request); - } - - /** - * @param DAOCreateAction $request - * - * @return bool - */ - protected function applies(DAOCreateAction $request) { - return $request->getEntityName() === 'CustomField'; - } - - /** - * Sets defaults required for option group and value creation - * @see CRM_Core_BAO_CustomField::create() - * - * @param DAOCreateAction $request - */ - protected function formatOptionParams(DAOCreateAction $request) { - $options = $request->getValue('options'); - - if (!is_array($options)) { - return; - } - - $dataTypeKey = 'data_type'; - $optionLabelKey = 'option_label'; - $optionWeightKey = 'option_weight'; - $optionStatusKey = 'option_status'; - $optionValueKey = 'option_value'; - $optionTypeKey = 'option_type'; - - $dataType = $request->getValue($dataTypeKey); - $optionLabel = $request->getValue($optionLabelKey); - $optionWeight = $request->getValue($optionWeightKey); - $optionStatus = $request->getValue($optionStatusKey); - $optionValue = $request->getValue($optionValueKey); - $optionType = $request->getValue($optionTypeKey); - - if (!$optionType) { - $request->addValue($optionTypeKey, self::OPTION_TYPE_NEW); - } - - if (!$dataType) { - $request->addValue($dataTypeKey, 'String'); - } - - if (!$optionLabel) { - $request->addValue($optionLabelKey, array_values($options)); - } - - if (!$optionValue) { - $request->addValue($optionValueKey, array_keys($options)); - } - - if (!$optionStatus) { - $statuses = array_fill(0, count($options), self::OPTION_STATUS_ACTIVE); - $request->addValue($optionStatusKey, $statuses); - } - - if (!$optionWeight) { - $request->addValue($optionWeightKey, range(1, count($options))); - } - } - - /** - * @param DAOCreateAction $request - */ - private function setDefaults(DAOCreateAction $request) { - if (!$request->getValue('option_type')) { - $request->addValue('option_type', NULL); - } - } - -} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreSaveSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreSaveSubscriber.php new file mode 100644 index 0000000000000000000000000000000000000000..0a4ce707a945c68b858fb0205db5fe72d3a4d1fb --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomFieldPreSaveSubscriber.php @@ -0,0 +1,38 @@ +<?php + +namespace Civi\Api4\Event\Subscriber; + +use Civi\Api4\Generic\AbstractAction; + +class CustomFieldPreSaveSubscriber extends Generic\PreSaveSubscriber { + + public $supportedOperation = 'create'; + + public function modify(&$field, AbstractAction $request) { + if (!empty($field['option_values'])) { + $weight = 0; + foreach ($field['option_values'] as $key => $value) { + // Translate simple key/value pairs into full-blown option values + if (!is_array($value)) { + $value = [ + 'label' => $value, + 'value' => $key, + 'is_active' => 1, + 'weight' => $weight, + ]; + $key = $weight++; + } + $field['option_label'][$key] = $value['label']; + $field['option_value'][$key] = $value['value']; + $field['option_status'][$key] = $value['is_active']; + $field['option_weight'][$key] = $value['weight']; + } + } + $field['option_type'] = !empty($field['option_values']); + } + + public function applies(AbstractAction $request) { + return $request->getEntityName() === 'CustomField'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomGroupPreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomGroupPreCreationSubscriber.php index 70f6e426c24aa06744d6d6a685fdc9fb8ecdc76f..e83c91f79e0b87463787b1485441a22b7ef75342 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomGroupPreCreationSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/CustomGroupPreCreationSubscriber.php @@ -4,9 +4,10 @@ namespace Civi\Api4\Event\Subscriber; use Civi\Api4\Generic\DAOCreateAction; -class CustomGroupPreCreationSubscriber extends PreCreationSubscriber { +class CustomGroupPreCreationSubscriber extends Generic\PreCreationSubscriber { + /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request */ protected function modify(DAOCreateAction $request) { $extends = $request->getValue('extends'); diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/AbstractPrepareSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/AbstractPrepareSubscriber.php similarity index 81% rename from civicrm/ext/api4/Civi/Api4/Event/Subscriber/AbstractPrepareSubscriber.php rename to civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/AbstractPrepareSubscriber.php index d4725e0dc820bbf6d8b9826ac13d0de54cdd682e..833e886fd075fe0b4654d2d8e79a4e2c9bf66779 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/AbstractPrepareSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/AbstractPrepareSubscriber.php @@ -1,12 +1,13 @@ <?php -namespace Civi\Api4\Event\Subscriber; +namespace Civi\Api4\Event\Subscriber\Generic; use Civi\API\Event\PrepareEvent; use Civi\API\Events; use Symfony\Component\EventDispatcher\EventSubscriberInterface; abstract class AbstractPrepareSubscriber implements EventSubscriberInterface { + /** * @return array */ @@ -17,7 +18,7 @@ abstract class AbstractPrepareSubscriber implements EventSubscriberInterface { } /** - * @param PrepareEvent $event + * @param \Civi\API\Event\PrepareEvent $event */ abstract public function onApiPrepare(PrepareEvent $event); diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreCreationSubscriber.php similarity index 77% rename from civicrm/ext/api4/Civi/Api4/Event/Subscriber/PreCreationSubscriber.php rename to civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreCreationSubscriber.php index 6737a9f368acce863f47539a408b9a0c49837fc2..66f5366df7a66f355e13e1e46fffb08a0e773d5b 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PreCreationSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreCreationSubscriber.php @@ -1,13 +1,14 @@ <?php -namespace Civi\Api4\Event\Subscriber; +namespace Civi\Api4\Event\Subscriber\Generic; use Civi\API\Event\PrepareEvent; use Civi\Api4\Generic\DAOCreateAction; abstract class PreCreationSubscriber extends AbstractPrepareSubscriber { + /** - * @param PrepareEvent $event + * @param \Civi\API\Event\PrepareEvent $event */ public function onApiPrepare(PrepareEvent $event) { $apiRequest = $event->getApiRequest(); @@ -24,7 +25,7 @@ abstract class PreCreationSubscriber extends AbstractPrepareSubscriber { /** * Modify the request * - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * * @return void */ @@ -33,7 +34,7 @@ abstract class PreCreationSubscriber extends AbstractPrepareSubscriber { /** * Check if this subscriber should be applied to the request * - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * * @return bool */ @@ -42,7 +43,7 @@ abstract class PreCreationSubscriber extends AbstractPrepareSubscriber { /** * Sets default values common to all creation requests * - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request */ protected function addDefaultCreationValues(DAOCreateAction $request) { } diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreSaveSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreSaveSubscriber.php new file mode 100644 index 0000000000000000000000000000000000000000..a36ba1fa11cee520a3c8965a9b72e002ca3f5824 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/Generic/PreSaveSubscriber.php @@ -0,0 +1,54 @@ +<?php + +namespace Civi\Api4\Event\Subscriber\Generic; + +use Civi\API\Event\PrepareEvent; +use Civi\Api4\Generic\AbstractAction; +use Civi\Api4\Generic\AbstractCreateAction; +use Civi\Api4\Generic\AbstractUpdateAction; + +abstract class PreSaveSubscriber extends AbstractPrepareSubscriber { + + /** + * @var string + * create|update|both + */ + public $supportedOperation = 'both'; + + /** + * @param \Civi\API\Event\PrepareEvent $event + */ + public function onApiPrepare(PrepareEvent $event) { + $apiRequest = $event->getApiRequest(); + + if ($apiRequest instanceof AbstractAction && $this->applies($apiRequest)) { + if ( + ($apiRequest instanceof AbstractCreateAction && $this->supportedOperation !== 'update') || + ($apiRequest instanceof AbstractUpdateAction && $this->supportedOperation !== 'create') + ) { + $values = $apiRequest->getValues(); + $this->modify($values, $apiRequest); + $apiRequest->setValues($values); + } + } + } + + /** + * Modify the item about to be saved + * + * @param array $item + * @param \Civi\Api4\Generic\AbstractAction $request + * + */ + abstract protected function modify(&$item, AbstractAction $request); + + /** + * Check if this subscriber should be applied to the request + * + * @param \Civi\Api4\Generic\AbstractAction $request + * + * @return bool + */ + abstract protected function applies(AbstractAction $request); + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/IsCurrentSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/IsCurrentSubscriber.php new file mode 100644 index 0000000000000000000000000000000000000000..4f1d3494619f00d5d20ee3275b336efa30027a30 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/IsCurrentSubscriber.php @@ -0,0 +1,39 @@ +<?php + +namespace Civi\Api4\Event\Subscriber; + +use Civi\API\Event\PrepareEvent; +use Civi\Api4\Utils\ReflectionUtils; + +/** + * Process $current api param for Get actions + * + * @see \Civi\Api4\Generic\Traits\IsCurrentTrait + */ +class IsCurrentSubscriber extends Generic\AbstractPrepareSubscriber { + + public function onApiPrepare(PrepareEvent $event) { + /** @var \Civi\Api4\Generic\AbstractQueryAction $action */ + $action = $event->getApiRequest(); + if ($action['version'] == 4 && method_exists($action, 'getCurrent') + && in_array('Civi\Api4\Generic\Traits\IsCurrentTrait', ReflectionUtils::getTraits($action)) + ) { + $fields = $action->entityFields(); + if ($action->getCurrent()) { + if (isset($fields['is_active'])) { + $action->addWhere('is_active', '=', '1'); + } + $action->addClause('OR', ['start_date', 'IS NULL'], ['start_date', '<=', 'now']); + $action->addClause('OR', ['end_date', 'IS NULL'], ['end_date', '>=', 'now']); + } + elseif ($action->getCurrent() === FALSE) { + $conditions = [['end_date', '<', 'now'], ['start_date', '>', 'now']]; + if (isset($fields['is_active'])) { + $conditions[] = ['is_active', '=', '0']; + } + $action->addClause('OR', $conditions); + } + } + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php index 3e671d61d31a8a389e6f48131e13fc36d5ba17dd..2695cd4c1d720b23a2929b8bdac284d50c4d610d 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/OptionValuePreCreationSubscriber.php @@ -5,17 +5,17 @@ namespace Civi\Api4\Event\Subscriber; use Civi\Api4\Generic\DAOCreateAction; use Civi\Api4\OptionGroup; -class OptionValuePreCreationSubscriber extends PreCreationSubscriber { +class OptionValuePreCreationSubscriber extends Generic\PreCreationSubscriber { /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request */ protected function modify(DAOCreateAction $request) { $this->setOptionGroupId($request); } /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * * @return bool */ @@ -24,7 +24,7 @@ class OptionValuePreCreationSubscriber extends PreCreationSubscriber { } /** - * @param DAOCreateAction $request + * @param \Civi\Api4\Generic\DAOCreateAction $request * @throws \API_Exception * @throws \Exception */ diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PermissionCheckSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PermissionCheckSubscriber.php index 62d542d0e0cfc225a5b20a04f3323b3043ae048a..b63fdc553d7a090180e8a441b04d5e794a915c3c 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PermissionCheckSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PermissionCheckSubscriber.php @@ -36,6 +36,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; * Civi\API\Annotation\Permission. */ class PermissionCheckSubscriber implements EventSubscriberInterface { + /** * @return array */ diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PostSelectQuerySubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PostSelectQuerySubscriber.php index ff7e6d20d61def5a89cd3da1d2ce277623cbf3cf..094a03c58da1dca43ab054bc3c62b8af94ce1dfd 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PostSelectQuerySubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/PostSelectQuerySubscriber.php @@ -19,12 +19,12 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { */ public static function getSubscribedEvents() { return [ - Events::POST_SELECT_QUERY => 'onPostQuery' + Events::POST_SELECT_QUERY => 'onPostQuery', ]; } /** - * @param PostSelectQueryEvent $event + * @param \Civi\Api4\Event\PostSelectQueryEvent $event */ public function onPostQuery(PostSelectQueryEvent $event) { $results = $event->getResults(); @@ -33,7 +33,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { /** * @param array $results - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -69,7 +69,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { /** * @param array $joinResults - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @param string $alias */ private function formatJoinResults(&$joinResults, $query, $alias) { @@ -108,7 +108,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -140,11 +140,10 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { return $selects; } - /** * @param array $selects * @param $serializationType - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -202,13 +201,12 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { return $newResults; } - /** * Prepares selects for the subquery to fetch join results * * @param string $alias * @param array $selects - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -236,7 +234,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { /** * @param array $selects - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array */ @@ -268,7 +266,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @param $alias * @param $selects * @return array @@ -297,14 +295,15 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { * * @param string $pathString * Dot separated path to the field - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * * @return array * Index is table alias and value is boolean whether is 1-to-many join */ private function getJoinPathInfo($pathString, $query) { $pathParts = explode('.', $pathString); - array_pop($pathParts); // remove field + // remove field + array_pop($pathParts); $path = []; $isMultipleChecker = function($alias) use ($query) { foreach ($query->getJoinedTables() as $table) { @@ -326,7 +325,7 @@ class PostSelectQuerySubscriber implements EventSubscriberInterface { * Get all the option_value values required in the query * * @param array $selects - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @param array $values * * @return array diff --git a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ValidateFieldsSubscriber.php b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ValidateFieldsSubscriber.php index 5e2c6f33f47149cd7e043bbfc4c00c3b29115575..2e7faab588bc707b4af59032bf7d9db2e6255d60 100644 --- a/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ValidateFieldsSubscriber.php +++ b/civicrm/ext/api4/Civi/Api4/Event/Subscriber/ValidateFieldsSubscriber.php @@ -32,10 +32,10 @@ use Civi\API\Event\PrepareEvent; /** * Validate field inputs based on annotations in the action class */ -class ValidateFieldsSubscriber extends AbstractPrepareSubscriber { +class ValidateFieldsSubscriber extends Generic\AbstractPrepareSubscriber { /** - * @param PrepareEvent $event + * @param \Civi\API\Event\PrepareEvent $event * @throws \Exception */ public function onApiPrepare(PrepareEvent $event) { @@ -87,6 +87,9 @@ class ValidateFieldsSubscriber extends AbstractPrepareSubscriber { } break; + case 'mixed': + return TRUE; + default: throw new \API_Exception('Unknown parameter type: ' . $type); } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractAction.php index 1b0786eae7b4610e3be0f3b50ddbb99cc381ff1d..cd316f621035e92b72ce51e59311b0e71f84b7ce 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractAction.php @@ -1,10 +1,8 @@ <?php namespace Civi\Api4\Generic; -use Civi\API\Exception\UnauthorizedException; -use Civi\API\Kernel; -use Civi\Api4\Generic\Result; use Civi\Api4\Utils\ReflectionUtils; +use Civi\Api4\Utils\ActionUtil; /** * Base class for all api actions. @@ -53,23 +51,42 @@ abstract class AbstractAction implements \ArrayAccess { */ protected $checkPermissions = TRUE; - /* @var string */ + /** + * @var string + */ protected $_entityName; - /* @var string */ + /** + * @var string + */ protected $_actionName; - /* @var \ReflectionClass */ - private $thisReflection; + /** + * @var \ReflectionClass + */ + private $_reflection; - /* @var array */ - private $thisParamInfo; + /** + * @var array + */ + private $_paramInfo; - /* @var array */ - private $entityFields; + /** + * @var array + */ + private $_entityFields; - /* @var array */ - private $thisArrayStorage; + /** + * @var array + */ + private $_arrayStorage = []; + + /** + * @var int + * Used to identify api calls for transactions + * @see \Civi\Core\Transaction\Manager + */ + private $_id; /** * Action constructor. @@ -85,6 +102,7 @@ abstract class AbstractAction implements \ArrayAccess { } $this->_entityName = $entityName; $this->_actionName = $actionName; + $this->_id = \Civi\API\Request::getNextId(); } /** @@ -172,11 +190,11 @@ abstract class AbstractAction implements \ArrayAccess { * At this point all the params have been sent in and we initiate the api call & return the result. * This is basically the outer wrapper for api v4. * - * @return Result|array - * @throws UnauthorizedException + * @return \Civi\Api4\Generic\Result + * @throws \Civi\API\Exception\UnauthorizedException */ - final public function execute() { - /** @var Kernel $kernel */ + public function execute() { + /** @var \Civi\API\Kernel $kernel */ $kernel = \Civi::service('civi_api_kernel'); return $kernel->runRequest($this); @@ -193,7 +211,7 @@ abstract class AbstractAction implements \ArrayAccess { */ public function getParams() { $params = []; - foreach ($this->getReflection()->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) { + foreach ($this->reflect()->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) { $name = $property->getName(); // Skip variables starting with an underscore if ($name[0] != '_') { @@ -210,17 +228,17 @@ abstract class AbstractAction implements \ArrayAccess { * @return array of arrays [description, type, default, (comment)] */ public function getParamInfo($param = NULL) { - if (!isset($this->thisParamInfo)) { + if (!isset($this->_paramInfo)) { $defaults = $this->getParamDefaults(); - foreach ($this->getReflection()->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) { + foreach ($this->reflect()->getProperties(\ReflectionProperty::IS_PROTECTED) as $property) { $name = $property->getName(); if ($name != 'version' && $name[0] != '_') { - $this->thisParamInfo[$name] = ReflectionUtils::getCodeDocs($property, 'Property'); - $this->thisParamInfo[$name]['default'] = $defaults[$name]; + $this->_paramInfo[$name] = ReflectionUtils::getCodeDocs($property, 'Property'); + $this->_paramInfo[$name]['default'] = $defaults[$name]; } } } - return $param ? $this->thisParamInfo[$param] : $this->thisParamInfo; + return $param ? $this->_paramInfo[$param] : $this->_paramInfo; } /** @@ -242,7 +260,7 @@ abstract class AbstractAction implements \ArrayAccess { * @param string $param * @return bool */ - protected function paramExists($param) { + public function paramExists($param) { return array_key_exists($param, $this->getParams()); } @@ -250,14 +268,14 @@ abstract class AbstractAction implements \ArrayAccess { * @return array */ protected function getParamDefaults() { - return array_intersect_key($this->getReflection()->getDefaultProperties(), $this->getParams()); + return array_intersect_key($this->reflect()->getDefaultProperties(), $this->getParams()); } /** * @inheritDoc */ public function offsetExists($offset) { - return in_array($offset, ['entity', 'action', 'params', 'version', 'check_permissions']) || isset($this->thisArrayStorage[$offset]); + return in_array($offset, ['entity', 'action', 'params', 'version', 'check_permissions', 'id']) || isset($this->_arrayStorage[$offset]); } /** @@ -276,8 +294,11 @@ abstract class AbstractAction implements \ArrayAccess { if ($offset == 'check_permissions') { return $this->checkPermissions; } - if (isset ($this->thisArrayStorage[$offset])) { - return $this->thisArrayStorage[$offset]; + if ($offset == 'id') { + return $this->_id; + } + if (isset($this->_arrayStorage[$offset])) { + return $this->_arrayStorage[$offset]; } return $val; } @@ -286,14 +307,14 @@ abstract class AbstractAction implements \ArrayAccess { * @inheritDoc */ public function offsetSet($offset, $value) { - if (in_array($offset, ['entity', 'action', 'entityName', 'actionName', 'params', 'version'])) { + if (in_array($offset, ['entity', 'action', 'entityName', 'actionName', 'params', 'version', 'id'])) { throw new \API_Exception('Cannot modify api4 state via array access'); } if ($offset == 'check_permissions') { $this->setCheckPermissions($value); } else { - $this->thisArrayStorage[$offset] = $value; + $this->_arrayStorage[$offset] = $value; } } @@ -301,10 +322,10 @@ abstract class AbstractAction implements \ArrayAccess { * @inheritDoc */ public function offsetUnset($offset) { - if (in_array($offset, ['entity', 'action', 'entityName', 'actionName', 'params', 'check_permissions', 'version'])) { + if (in_array($offset, ['entity', 'action', 'entityName', 'actionName', 'params', 'check_permissions', 'version', 'id'])) { throw new \API_Exception('Cannot modify api4 state via array access'); } - unset($this->thisArrayStorage[$offset]); + unset($this->_arrayStorage[$offset]); } /** @@ -319,6 +340,9 @@ abstract class AbstractAction implements \ArrayAccess { return \CRM_Core_Permission::check($permissions); } + /** + * @return array + */ public function getPermissions() { $permissions = call_user_func(["\\Civi\\Api4\\" . $this->_entityName, 'permissions']); $permissions += [ @@ -340,31 +364,62 @@ abstract class AbstractAction implements \ArrayAccess { /** * Returns schema fields for this entity & action. * + * Here we bypass the api wrapper and execute the getFields action directly. + * This is because we DON'T want the wrapper to check permissions as this is an internal op, + * but we DO want permissions to be checked inside the getFields request so e.g. the api_key + * field can be conditionally included. + * @see \Civi\Api4\Action\Contact\GetFields + * * @return array - * @throws \API_Exception */ - protected function getEntityFields() { - if (!$this->entityFields) { - $params = [ - 'action' => $this->getActionName(), - 'checkPermissions' => $this->checkPermissions, - ]; + public function entityFields() { + if (!$this->_entityFields) { + $getFields = ActionUtil::getAction($this->getEntityName(), 'getFields'); + $result = new Result(); if (method_exists($this, 'getBaoName')) { - $params['includeCustom'] = FALSE; + $getFields->setIncludeCustom(FALSE); } - $this->entityFields = (array) civicrm_api4($this->getEntityName(), 'getFields', $params, 'name'); + $getFields + ->setCheckPermissions($this->checkPermissions) + ->setAction($this->getActionName()) + ->_run($result); + $this->_entityFields = (array) $result->indexBy('name'); } - return $this->entityFields; + return $this->_entityFields; } /** * @return \ReflectionClass */ - protected function getReflection() { - if (!$this->thisReflection) { - $this->thisReflection = new \ReflectionClass($this); + public function reflect() { + if (!$this->_reflection) { + $this->_reflection = new \ReflectionClass($this); + } + return $this->_reflection; + } + + /** + * Validates required fields for actions which create a new object. + * + * @param $values + * @return array + * @throws \API_Exception + */ + protected function checkRequiredFields($values) { + $unmatched = []; + foreach ($this->entityFields() as $fieldName => $fieldInfo) { + if (!isset($values[$fieldName]) || $values[$fieldName] === '') { + if (!empty($fieldInfo['required']) && !isset($fieldInfo['default_value'])) { + $unmatched[] = $fieldName; + } + elseif (!empty($fieldInfo['required_if'])) { + if ($this->evaluateCondition($fieldInfo['required_if'], ['values' => $values])) { + $unmatched[] = $fieldName; + } + } + } } - return $this->thisReflection; + return $unmatched; } /** diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractBatchAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractBatchAction.php index 91c3b461fdbecfc97bf875b9ce2069116c719bdf..b896aa0835cda3972d1f3cd41c88af6fbbbe7e7a 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractBatchAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractBatchAction.php @@ -25,7 +25,7 @@ abstract class AbstractBatchAction extends AbstractQueryAction { private $select; /** - * QueryAction constructor. + * BatchAction constructor. * @param string $entityName * @param string $actionName * @param string|array $select diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractCreateAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractCreateAction.php index 0cb55d109ac00b3895ffa9a02144ef25abbcaeca..43f43b601bcbd1752317543200a21b7051c2a96e 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractCreateAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractCreateAction.php @@ -33,23 +33,9 @@ abstract class AbstractCreateAction extends AbstractAction { * @throws \API_Exception */ protected function validateValues() { - $unmatched = []; - $params = NULL; - foreach ($this->getEntityFields() as $fieldName => $fieldInfo) { - if (!$this->getValue($fieldName)) { - if (!empty($fieldInfo['required']) && !isset($fieldInfo['default_value'])) { - $unmatched[] = $fieldName; - } - elseif (!empty($fieldInfo['required_if'])) { - $params = $params ?: $this->getParams(); - if ($this->evaluateCondition($fieldInfo['required_if'], $params)) { - $unmatched[] = $fieldName; - } - } - } - } + $unmatched = $this->checkRequiredFields($this->getValues()); if ($unmatched) { - throw new \API_Exception("Mandatory values missing from Api4 {$this->getEntityName()}::{$this->getActionName()}: '" . implode("', '", $unmatched) . "'", "mandatory_missing", ["fields" => $unmatched]); + throw new \API_Exception("Mandatory values missing from Api4 {$this->getEntityName()}::{$this->getActionName()}: " . implode(", ", $unmatched), "mandatory_missing", ["fields" => $unmatched]); } } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractEntity.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractEntity.php index e774baca38c7b5969bc4708e7789884d899bddd9..ef380a52ad454b3e394b2bd698af01782e344d51 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractEntity.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractEntity.php @@ -50,7 +50,8 @@ abstract class AbstractEntity { $permissions = \CRM_Core_Permission::getEntityActionPermissions(); // For legacy reasons the permissions are keyed by lowercase entity name - $lcentity = _civicrm_api_get_entity_name_from_camel(self::getEntityName()); + // Note: Convert to camel & back in order to circumvent all the api3 naming oddities + $lcentity = _civicrm_api_get_entity_name_from_camel(\CRM_Utils_String::convertStringToCamel(self::getEntityName())); // Merge permissions for this entity with the defaults return \CRM_Utils_Array::value($lcentity, $permissions, []) + $permissions['default']; } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractGetAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractGetAction.php index f8374cf4cacf7fc93e8cac5d4317281119c01bee..842836fe270f0b9f210952252f9d7adb1e8ac60f 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractGetAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractGetAction.php @@ -14,10 +14,106 @@ namespace Civi\Api4\Generic; abstract class AbstractGetAction extends AbstractQueryAction { /** - * Fields to return. Defaults to all non-custom fields. + * Fields to return. Defaults to all fields. + * + * Set to ["row_count"] to return only the number of items found. * * @var array */ protected $select = []; + /** + * Only return the number of found items. + * + * @return $this + */ + public function selectRowCount() { + $this->select = ['row_count']; + return $this; + } + + /** + * Adds field defaults to the where clause. + * + * Note: it will skip adding field defaults when fetching records by id, + * or if that field has already been added to the where clause. + * + * @throws \API_Exception + */ + protected function setDefaultWhereClause() { + if (!$this->_itemsToGet('id')) { + $fields = $this->entityFields(); + foreach ($fields as $field) { + if (isset($field['default_value']) && !$this->_whereContains($field['name'])) { + $this->addWhere($field['name'], '=', $field['default_value']); + } + } + } + } + + /** + * Helper to parse the WHERE param for getRecords to perform simple pre-filtering. + * + * This is intended to optimize some common use-cases e.g. calling the api to get + * one or more records by name or id. + * + * Ex: If getRecords fetches a long list of items each with a unique name, + * but the user has specified a single record to retrieve, you can optimize the call + * by checking $this->_itemsToGet('name') and only fetching the item(s) with that name. + * + * @param string $field + * @return array|null + */ + protected function _itemsToGet($field) { + foreach ($this->where as $clause) { + // Look for exact-match operators (=, IN, or LIKE with no wildcard) + if ($clause[0] == $field && (in_array($clause[1], ['=', 'IN']) || ($clause[1] == 'LIKE' && !(is_string($clause[2]) && strpos($clause[2], '%') !== FALSE)))) { + return (array) $clause[2]; + } + } + return NULL; + } + + /** + * Helper to see if a field should be selected by the getRecords function. + * + * Checks the SELECT, WHERE and ORDER BY params to see what fields are needed. + * + * Note that if no SELECT clause has been set then all fields should be selected + * and this function will always return TRUE. + * + * @param string $field + * @return bool + */ + protected function _isFieldSelected($field) { + if (!$this->select || in_array($field, $this->select) || isset($this->orderBy[$field])) { + return TRUE; + } + return $this->_whereContains($field); + } + + /** + * Walk through the where clause and check if a field is in use. + * + * @param string $field + * @param array $clauses + * @return bool + */ + protected function _whereContains($field, $clauses = NULL) { + if ($clauses === NULL) { + $clauses = $this->where; + } + foreach ($clauses as $clause) { + if (is_array($clause) && is_string($clause[0])) { + if ($clause[0] == $field) { + return TRUE; + } + elseif (is_array($clause[1])) { + return $this->_whereContains($field, $clause[1]); + } + } + } + return FALSE; + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractQueryAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractQueryAction.php index 993383dc440933d91b900ed4edcd9e4b3979f79a..82fd42fe28d04096ad4707d34d22ac7302c10aec 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/AbstractQueryAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractQueryAction.php @@ -102,4 +102,43 @@ abstract class AbstractQueryAction extends AbstractAction { return $this; } + /** + * A human-readable where clause, for the reading enjoyment of you humans. + * + * @param array $whereClause + * @param string $op + * @return string + */ + protected function whereClauseToString($whereClause = NULL, $op = 'AND') { + if ($whereClause === NULL) { + $whereClause = $this->where; + } + $output = ''; + if (!is_array($whereClause) || !$whereClause) { + return $output; + } + if (in_array($whereClause[0], ['AND', 'OR', 'NOT'])) { + $op = array_shift($whereClause); + if ($op == 'NOT') { + $output = 'NOT '; + $op = 'AND'; + } + return $output . '(' . $this->whereClauseToString($whereClause, $op) . ')'; + } + elseif (isset($whereClause[1]) && in_array($whereClause[1], \CRM_Core_DAO::acceptedSQLOperators())) { + $output = $whereClause[0] . ' ' . $whereClause[1] . ' '; + if (isset($whereClause[2])) { + $output .= is_array($whereClause[2]) ? '[' . implode(', ', $whereClause[2]) . ']' : $whereClause[2]; + } + } + else { + $clauses = []; + foreach (array_filter($whereClause) as $clause) { + $clauses[] = $this->whereClauseToString($clause, $op); + } + $output = implode(" $op ", $clauses); + } + return $output; + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/AbstractSaveAction.php b/civicrm/ext/api4/Civi/Api4/Generic/AbstractSaveAction.php new file mode 100644 index 0000000000000000000000000000000000000000..117a1fe77c775566732ed53e28c5be54bd29d32c --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Generic/AbstractSaveAction.php @@ -0,0 +1,90 @@ +<?php + +namespace Civi\Api4\Generic; + +/** + * Base class for all "Save" api actions. + * + * @method $this setRecords(array $records) Array of records. + * @method $this addRecord($record) Add a record to update. + * @method array getRecords() + * @method $this setDefaults(array $defaults) Array of defaults. + * @method $this addDefault($name, $value) Add a default value. + * @method array getDefaults() + * @method $this setReload(bool $reload) Specify whether complete objects will be returned after saving. + * @method bool getReload() + * + * @package Civi\Api4\Generic + */ +abstract class AbstractSaveAction extends AbstractAction { + + /** + * Array of records. + * + * Should be in the same format as returned by Get. + * + * @var array + * @required + */ + protected $records = []; + + /** + * Array of default values. + * + * These defaults will be applied to all records unless they specify otherwise. + * + * @var array + */ + protected $defaults = []; + + /** + * Reload records after saving. + * + * By default this api typically returns partial records containing only the fields + * that were updated. Set reload to TRUE to do an additional lookup after saving + * to return complete records. + * + * @var bool + */ + protected $reload = FALSE; + + /** + * @var string + */ + private $idField; + + /** + * BatchAction constructor. + * @param string $entityName + * @param string $actionName + * @param string $idField + */ + public function __construct($entityName, $actionName, $idField = 'id') { + // $idField should be a string but some apis (e.g. CustomValue) give us an array + $this->idField = array_values((array) $idField)[0]; + parent::__construct($entityName, $actionName); + } + + /** + * @throws \API_Exception + */ + protected function validateValues() { + $unmatched = []; + foreach ($this->records as $record) { + if (empty($record[$this->idField])) { + $unmatched = array_unique(array_merge($unmatched, $this->checkRequiredFields($record))); + } + } + if ($unmatched) { + throw new \API_Exception("Mandatory values missing from Api4 {$this->getEntityName()}::{$this->getActionName()}: " . implode(", ", $unmatched), "mandatory_missing", ["fields" => $unmatched]); + } + } + + /** + * @return string + */ + protected function getIdField() { + return $this->idField; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicBatchAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicBatchAction.php index 2f39cf23a2901d00f6338934d357a1b1df06d6b9..49b76a5a56aac81ec257512cd20b5cc660641e9e 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicBatchAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicBatchAction.php @@ -1,6 +1,7 @@ <?php namespace Civi\Api4\Generic; + use Civi\API\Exception\NotImplementedException; /** diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicGetAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicGetAction.php index 23d47a13c5321f296c03c470b6ecdda37a3e3ed6..033c702ca975173bc9230bd291a548ccb2c7e8f3 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicGetAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicGetAction.php @@ -37,6 +37,7 @@ class BasicGetAction extends AbstractGetAction { * @param \Civi\Api4\Generic\Result $result */ public function _run(Result $result) { + $this->setDefaultWhereClause(); $values = $this->getRecords(); $result->exchangeArray($this->queryArray($values)); } @@ -80,65 +81,4 @@ class BasicGetAction extends AbstractGetAction { throw new NotImplementedException('Getter function not found for api4 ' . $this->getEntityName() . '::' . $this->getActionName()); } - /** - * Helper to parse the WHERE param for getRecords to perform simple pre-filtering. - * - * This is intended to optimize some common use-cases e.g. calling the api to get - * one or more records by name or id. - * - * Ex: If getRecords fetches a long list of items each with a unique name, - * but the user has specified a single record to retrieve, you can optimize the call - * by checking $this->_itemsToGet('name') and only fetching the item(s) with that name. - * - * @param string $field - * @return array|null - */ - public function _itemsToGet($field) { - foreach ($this->where as $clause) { - if ($clause[0] == $field && in_array($clause[1], ['=', 'IN'])) { - return (array) $clause[2]; - } - } - return NULL; - } - - /** - * Helper to see if a field should be selected by the getRecords function. - * - * Checks the SELECT, WHERE and ORDER BY params to see what fields are needed. - * - * Note that if no SELECT clause has been set then all fields should be selected - * and this function will always return TRUE. - * - * @param string $field - * @return bool - */ - public function _isFieldSelected($field) { - if (!$this->select || in_array($field, $this->select) || isset($this->orderBy[$field])) { - return TRUE; - } - return $this->_whereContains($field, $this->where); - } - - /** - * Walk through the where clause and check if a field is in use. - * - * @param string $field - * @param array $clauses - * @return bool - */ - private function _whereContains($field, $clauses) { - foreach ($clauses as $clause) { - if (is_array($clause) && is_string($clause[0])) { - if ($clause[0] == $field) { - return TRUE; - } - elseif (is_array($clause[1])) { - return $this->_whereContains($field, $clause[1]); - } - } - } - return FALSE; - } - } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicGetFieldsAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicGetFieldsAction.php index c9869d5e0c46b2a17f6eb7e8f19f7dc4c24d1158..198dc930f86f47279de65032142dbcf836b71292 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicGetFieldsAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicGetFieldsAction.php @@ -2,6 +2,7 @@ namespace Civi\Api4\Generic; +use Civi\API\Exception\NotImplementedException; use Civi\Api4\Utils\ActionUtil; /** @@ -40,8 +41,12 @@ class BasicGetFieldsAction extends BasicGetAction { * @throws \Civi\API\Exception\NotImplementedException */ public function _run(Result $result) { - $actionClass = ActionUtil::getAction($this->getEntityName(), $this->action); - if (method_exists($actionClass, 'fields')) { + try { + $actionClass = ActionUtil::getAction($this->getEntityName(), $this->getAction()); + } + catch (NotImplementedException $e) { + } + if (isset($actionClass) && method_exists($actionClass, 'fields')) { $values = $actionClass->fields(); } else { @@ -52,20 +57,30 @@ class BasicGetFieldsAction extends BasicGetAction { } /** + * Ensure every result contains, at minimum, the array keys as defined in $this->fields. + * + * Attempt to set some sensible defaults for some fields. + * + * In most cases it's not necessary to override this function, even if your entity is really weird. + * Instead just override $this->fields and thes function will respect that. + * * @param array $values */ - private function padResults(&$values) { + protected function padResults(&$values) { + $fields = array_column($this->fields(), 'name'); foreach ($values as &$field) { - $field += [ - 'title' => ucwords(str_replace('_', ' ', $field['name'])), + $defaults = array_intersect_key([ + 'title' => empty($field['name']) ? NULL : ucwords(str_replace('_', ' ', $field['name'])), 'entity' => $this->getEntityName(), 'required' => FALSE, - 'options' => FALSE, - 'data_type' => 'String', - ]; - if (!$this->loadOptions) { + 'options' => !empty($field['pseudoconstant']), + 'data_type' => \CRM_Utils_Array::value('type', $field, 'String'), + ], array_flip($fields)); + $field += $defaults; + if (!$this->loadOptions && isset($defaults['options'])) { $field['options'] = (bool) $field['options']; } + $field += array_fill_keys($fields, NULL); } } @@ -73,7 +88,12 @@ class BasicGetFieldsAction extends BasicGetAction { * @return string */ public function getAction() { - return $this->action; + // For actions that build on top of other actions, return fields for the simpler action + $sub = [ + 'save' => 'create', + 'replace' => 'create', + ]; + return $sub[$this->action] ?? $this->action; } public function fields() { @@ -98,6 +118,10 @@ class BasicGetFieldsAction extends BasicGetAction { 'name' => 'required', 'data_type' => 'Boolean', ], + [ + 'name' => 'required_if', + 'data_type' => 'String', + ], [ 'name' => 'options', 'data_type' => 'Array', @@ -106,6 +130,14 @@ class BasicGetFieldsAction extends BasicGetAction { 'name' => 'data_type', 'data_type' => 'String', ], + [ + 'name' => 'input_type', + 'data_type' => 'String', + ], + [ + 'name' => 'input_attrs', + 'data_type' => 'Array', + ], [ 'name' => 'fk_entity', 'data_type' => 'String', @@ -114,6 +146,10 @@ class BasicGetFieldsAction extends BasicGetAction { 'name' => 'serialize', 'data_type' => 'Integer', ], + [ + 'name' => 'entity', + 'data_type' => 'String', + ], ]; } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicReplaceAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicReplaceAction.php index 8e0dd22e5a849ae7edccb1c1f418376bd74cd536..da4bac1a83a05d31c2e825619aaf112532d4532e 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicReplaceAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicReplaceAction.php @@ -2,7 +2,8 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; +use Civi\API\Exception\NotImplementedException; +use Civi\Api4\Utils\ActionUtil; /** * Given a set of records, will appropriately update the database. @@ -10,6 +11,9 @@ use Civi\Api4\Generic\Result; * @method $this setRecords(array $records) Array of records. * @method $this addRecord($record) Add a record to update. * @method array getRecords() + * @method $this setDefaults(array $defaults) Array of defaults. + * @method $this addDefault($name, $value) Add a default value. + * @method array getDefaults() * @method $this setReload(bool $reload) Specify whether complete objects will be returned after saving. * @method bool getReload() */ @@ -20,60 +24,89 @@ class BasicReplaceAction extends AbstractBatchAction { * * Should be in the same format as returned by Get. * - * @required * @var array + * @required */ protected $records = []; /** - * Reload objects after saving. + * Array of default values. + * + * Will be merged into $records before saving. + * + * @var array + */ + protected $defaults = []; + + /** + * Reload records after saving. * - * Setting to TRUE will load complete records and return them as the api result. - * If FALSE the api usually returns only the fields specified to be updated. + * By default this api typically returns partial records containing only the fields + * that were updated. Set reload to TRUE to do an additional lookup after saving + * to return complete records. * * @var bool */ protected $reload = FALSE; + /** + * @return \Civi\Api4\Result\ReplaceResult + */ + public function execute() { + return parent::execute(); + } + /** * @inheritDoc */ public function _run(Result $result) { $items = $this->getBatchRecords(); - // Copy params from where clause if the operator is = - $paramsFromWhere = []; + // Copy defaults from where clause if the operator is = foreach ($this->where as $clause) { if (is_array($clause) && $clause[1] === '=') { - $paramsFromWhere[$clause[0]] = $clause[2]; + $this->defaults[$clause[0]] = $clause[2]; } } $idField = $this->getSelect()[0]; - $toDelete = array_column($items, NULL, $idField); + $toDelete = array_diff_key(array_column($items, NULL, $idField), array_flip(array_filter(\CRM_Utils_Array::collect($idField, $this->records)))); - foreach ($this->records as $record) { - $record += $paramsFromWhere; - if (!empty($record[$idField])) { - $id = $record[$idField]; - unset($toDelete[$id], $record[$idField]); - $result[] = civicrm_api4($this->getEntityName(), 'update', [ - 'reload' => $this->reload, - 'where' => [[$idField, '=', $id]], - 'values' => $record, - ])->first(); - } - else { - $result[] = civicrm_api4($this->getEntityName(), 'create', [ - 'values' => $record, - ])->first(); + // Try to delegate to the Save action + try { + $saveAction = ActionUtil::getAction($this->getEntityName(), 'save'); + $saveAction + ->setCheckPermissions($this->getCheckPermissions()) + ->setReload($this->reload) + ->setRecords($this->records) + ->setDefaults($this->defaults); + $result->exchangeArray((array) $saveAction->execute()); + } + // Fall back on Create/Update if Save doesn't exist + catch (NotImplementedException $e) { + foreach ($this->records as $record) { + $record += $this->defaults; + if (!empty($record[$idField])) { + $result[] = civicrm_api4($this->getEntityName(), 'update', [ + 'reload' => $this->reload, + 'where' => [[$idField, '=', $record[$idField]]], + 'values' => $record, + 'checkPermissions' => $this->getCheckPermissions(), + ])->first(); + } + else { + $result[] = civicrm_api4($this->getEntityName(), 'create', [ + 'values' => $record, + 'checkPermissions' => $this->getCheckPermissions(), + ])->first(); + } } } - $result->deleted = []; if ($toDelete) { $result->deleted = (array) civicrm_api4($this->getEntityName(), 'delete', [ 'where' => [[$idField, 'IN', array_keys($toDelete)]], + 'checkPermissions' => $this->getCheckPermissions(), ]); } } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicSaveAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicSaveAction.php new file mode 100644 index 0000000000000000000000000000000000000000..c03d5af349f06d4ec1b83f75782032bbb792ee4b --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicSaveAction.php @@ -0,0 +1,79 @@ +<?php + +namespace Civi\Api4\Generic; + +use Civi\API\Exception\NotImplementedException; +use Civi\Api4\Utils\ActionUtil; + +/** + * Create or update one or more records. + * + * If creating more than one record with similar values, use the "defaults" param. + * + * Set "reload" if you need the api to return complete records. + */ +class BasicSaveAction extends AbstractSaveAction { + + /** + * @var callable + * + * Function(array $item, BasicCreateAction $thisAction) => array + */ + private $setter; + + /** + * Basic Create constructor. + * + * @param string $entityName + * @param string $actionName + * @param string $idField + * @param callable $setter + * Function(array $item, BasicCreateAction $thisAction) => array + */ + public function __construct($entityName, $actionName, $idField = 'id', $setter = NULL) { + parent::__construct($entityName, $actionName, $idField); + $this->setter = $setter; + } + + /** + * We pass the writeRecord function an array representing one item to write. + * We expect to get the same format back. + * + * @param \Civi\Api4\Generic\Result $result + */ + public function _run(Result $result) { + $this->validateValues(); + foreach ($this->records as $record) { + $record += $this->defaults; + $result[] = $this->writeRecord($record); + } + if ($this->reload) { + /** @var BasicGetAction $get */ + $get = ActionUtil::getAction($this->getEntityName(), 'get'); + $get + ->setCheckPermissions($this->getCheckPermissions()) + ->addWhere($this->getIdField(), 'IN', (array) $result->column($this->getIdField())); + $result->exchangeArray((array) $get->execute()); + } + } + + /** + * This Basic Save class can be used in one of two ways: + * + * 1. Use this class directly by passing a callable ($setter) to the constructor. + * 2. Extend this class and override this function. + * + * Either way, this function should return an array representing the one new object. + * + * @param array $item + * @return array + * @throws \Civi\API\Exception\NotImplementedException + */ + protected function writeRecord($item) { + if (is_callable($this->setter)) { + return call_user_func($this->setter, $item, $this); + } + throw new NotImplementedException('Setter function not found for api4 ' . $this->getEntityName() . '::' . $this->getActionName()); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Generic/BasicUpdateAction.php b/civicrm/ext/api4/Civi/Api4/Generic/BasicUpdateAction.php index 40c93624e34aad2914d2cbd8863b17fb9a861f02..796944e3f4fc1b160a76c09494924d49fe7e283e 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/BasicUpdateAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/BasicUpdateAction.php @@ -38,11 +38,17 @@ class BasicUpdateAction extends AbstractUpdateAction { * We expect to get the same format back. * * @param \Civi\Api4\Generic\Result $result + * @throws \API_Exception + * @throws \Civi\API\Exception\NotImplementedException */ public function _run(Result $result) { foreach ($this->getBatchRecords() as $item) { $result[] = $this->writeRecord($this->values + $item); } + + if (!$result->count()) { + throw new \API_Exception('Cannot ' . $this->getActionName() . ' ' . $this->getEntityName() . ', no records found with ' . $this->whereClauseToString()); + } } /** diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOCreateAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOCreateAction.php index d7a0e86930e980d5f02b7771e657f02f9ca7f1ef..091eacf036da5875217e466d7619d734d7591a3a 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOCreateAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOCreateAction.php @@ -2,8 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; - /** * Create a new object from supplied values. * @@ -35,24 +33,4 @@ class DAOCreateAction extends AbstractCreateAction { parent::validateValues(); } - /** - * Fill field defaults which were declared by the api. - * - * Note: default values from core are ignored because the BAO or database layer will supply them. - * - * @param array $params - */ - protected function fillDefaults(&$params) { - $fields = $this->getEntityFields(); - $bao = $this->getBaoName(); - $coreFields = array_column($bao::fields(), NULL, 'name'); - - foreach ($fields as $name => $field) { - // If a default value is set in the api but not in core, the api should supply it. - if (!isset($params[$name]) && !empty($field['default_value']) && empty($coreFields[$name]['default'])) { - $params[$name] = $field['default_value']; - } - } - } - } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAODeleteAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAODeleteAction.php index f61af3f1d2948e4fe6c09959780b10d0f13bf8da..00b32fe21747e28e97badccefa282c14f03e7b91 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAODeleteAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAODeleteAction.php @@ -2,8 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; - /** * Delete one or more items, based on criteria specified in Where param (required). */ @@ -16,11 +14,15 @@ class DAODeleteAction extends AbstractBatchAction { public function _run(Result $result) { $defaults = $this->getParamDefaults(); if ($defaults['where'] && !array_diff_key($this->where, $defaults['where'])) { - throw new \API_Exception('Cannot delete with no "where" parameter specified'); + throw new \API_Exception('Cannot delete ' . $this->getEntityName() . ' with no "where" parameter specified'); } $items = $this->getObjects(); + if (!$items) { + throw new \API_Exception('Cannot delete ' . $this->getEntityName() . ', no records found with ' . $this->whereClauseToString()); + } + $ids = $this->deleteObjects($items); $result->exchangeArray($ids); @@ -46,7 +48,7 @@ class DAODeleteAction extends AbstractBatchAction { $args = [$item['id']]; $bao = call_user_func_array([$baoName, 'del'], $args); if ($bao !== FALSE) { - $ids[] = $item['id']; + $ids[] = ['id' => $item['id']]; } else { throw new \API_Exception("Could not delete {$this->getEntityName()} id {$item['id']}"); @@ -60,7 +62,7 @@ class DAODeleteAction extends AbstractBatchAction { // delete it $action_result = $bao->delete(); if ($action_result) { - $ids[] = $item['id']; + $ids[] = ['id' => $item['id']]; } else { throw new \API_Exception("Could not delete {$this->getEntityName()} id {$item['id']}"); diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOEntity.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOEntity.php index 1ad175da4b5e28a54985859abcbba80c9a18962d..0f2b14160eb26c45caddc2a2a1316185fd1c3ee5 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOEntity.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOEntity.php @@ -14,6 +14,13 @@ abstract class DAOEntity extends AbstractEntity { return new DAOGetAction(static::class, __FUNCTION__); } + /** + * @return DAOGetAction + */ + public static function save() { + return new DAOSaveAction(static::class, __FUNCTION__); + } + /** * @return DAOGetFieldsAction */ diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOGetAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOGetAction.php index 0216f0da8eae86d5cb21ff25ca4d3cb74daea894..2420034bc1131302025d9878d185b8ea1f73c563 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOGetAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOGetAction.php @@ -2,8 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; - /** * Retrieve items based on criteria specified in the 'where' param. * @@ -15,6 +13,7 @@ class DAOGetAction extends AbstractGetAction { use Traits\DAOActionTrait; public function _run(Result $result) { + $this->setDefaultWhereClause(); $result->exchangeArray($this->getObjects()); } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOGetFieldsAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOGetFieldsAction.php index e86d99bc28b47b0eba249c6e272af7ed93a87f51..9f351d075fc22d1218d0f4d3743bfe437bdfac8a 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOGetFieldsAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOGetFieldsAction.php @@ -2,7 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Service\Spec\SpecGatherer; use Civi\Api4\Service\Spec\SpecFormatter; /** @@ -27,14 +26,14 @@ class DAOGetFieldsAction extends BasicGetFieldsAction { */ protected function getRecords() { $fields = $this->_itemsToGet('name'); - /** @var SpecGatherer $gatherer */ + /** @var \Civi\Api4\Service\Spec\SpecGatherer $gatherer */ $gatherer = \Civi::container()->get('spec_gatherer'); // Any fields name with a dot in it is custom if ($fields) { $this->includeCustom = strpos(implode('', $fields), '.') !== FALSE; } - $spec = $gatherer->getSpec($this->getEntityName(), $this->action, $this->includeCustom); - return SpecFormatter::specToArray($spec->getFields($fields), (array) $this->select, $this->loadOptions); + $spec = $gatherer->getSpec($this->getEntityName(), $this->getAction(), $this->includeCustom); + return SpecFormatter::specToArray($spec->getFields($fields), $this->loadOptions); } public function fields() { diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOSaveAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOSaveAction.php new file mode 100644 index 0000000000000000000000000000000000000000..4169ab310337a2b38b723fe788825750de518d46 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOSaveAction.php @@ -0,0 +1,32 @@ +<?php + +namespace Civi\Api4\Generic; + +/** + * Create or update one or more records. + * + * If creating more than one record with similar values, use the "defaults" param. + * + * Set "reload" if you need the api to return complete records. + */ +class DAOSaveAction extends AbstractSaveAction { + use Traits\DAOActionTrait; + + /** + * @inheritDoc + */ + public function _run(Result $result) { + foreach ($this->records as &$record) { + $record += $this->defaults; + if (empty($record['id'])) { + $this->fillDefaults($record); + } + } + $this->validateValues(); + + $resultArray = $this->writeObjects($this->records); + + $result->exchangeArray($resultArray); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Generic/DAOUpdateAction.php b/civicrm/ext/api4/Civi/Api4/Generic/DAOUpdateAction.php index 62da8796673e20ec129e889d99c00103cdcdd215..28684ad9e51bacaf931bdbbce4c7af96ca8216a7 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/DAOUpdateAction.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/DAOUpdateAction.php @@ -2,8 +2,6 @@ namespace Civi\Api4\Generic; -use Civi\Api4\Generic\Result; - /** * Update one or more records with new values. * @@ -12,19 +10,52 @@ use Civi\Api4\Generic\Result; class DAOUpdateAction extends AbstractUpdateAction { use Traits\DAOActionTrait; + /** + * Criteria for selecting items to update. + * + * Required if no id is supplied in values. + * + * @var array + */ + protected $where = []; + /** * @inheritDoc */ public function _run(Result $result) { + // Add ID from values to WHERE clause and check for mismatch if (!empty($this->values['id'])) { - throw new \Exception("Cannot update the id of an existing " . $this->getEntityName() . '.'); + $wheres = array_column($this->where, NULL, 0); + if (!isset($wheres['id'])) { + $this->addWhere('id', '=', $this->values['id']); + } + elseif (!($wheres['id'][1] === '=' && $wheres['id'][2] == $this->values['id'])) { + throw new \Exception("Cannot update the id of an existing " . $this->getEntityName() . '.'); + } + } + + // Require WHERE if we didn't get an ID from values + if (!$this->where) { + throw new \API_Exception('Parameter "where" is required unless an id is supplied in values.'); + } + + // Update a single record by ID unless select requires more than id + if ($this->getSelect() === ['id'] && count($this->where) === 1 && $this->where[0][0] === 'id' && $this->where[0][1] === '=' && !empty($this->where[0][2])) { + $this->values['id'] = $this->where[0][2]; + $result->exchangeArray($this->writeObjects([$this->values])); + return; } + // Batch update 1 or more records based on WHERE clause $items = $this->getObjects(); foreach ($items as &$item) { $item = $this->values + $item; } + if (!$items) { + throw new \API_Exception('Cannot ' . $this->getActionName() . ' ' . $this->getEntityName() . ', no records found with ' . $this->whereClauseToString()); + } + $result->exchangeArray($this->writeObjects($items)); } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Result.php b/civicrm/ext/api4/Civi/Api4/Generic/Result.php index 35fb6fb0668667fe93216a7cb237e514e06b134a..9930ce813f7402f9e063e30296b970608be757c7 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/Result.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/Result.php @@ -45,6 +45,8 @@ class Result extends \ArrayObject { */ public $version = 4; + private $indexedBy; + /** * Return first result. * @return array|null @@ -87,6 +89,7 @@ class Result extends \ArrayObject { * @throws \API_Exception */ public function indexBy($key) { + $this->indexedBy = $key; if (count($this)) { $newResults = []; foreach ($this as $values) { @@ -102,4 +105,27 @@ class Result extends \ArrayObject { return $this; } + /** + * Returns the number of results + * + * @return int + */ + public function count() { + $count = parent::count(); + if ($count == 1 && is_array($this->first()) && array_keys($this->first()) == ['row_count']) { + return $this->first()['row_count']; + } + return $count; + } + + /** + * Reduce each result to one field + * + * @param $name + * @return array + */ + public function column($name) { + return array_column($this->getArrayCopy(), $name, $this->indexedBy); + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Traits/ArrayQueryActionTrait.php b/civicrm/ext/api4/Civi/Api4/Generic/Traits/ArrayQueryActionTrait.php index 1d223f1b79a6074ac524e7a5b9c90a2e524fb380..4435d1f49fc29940307cb56db5a5685c2ba727af 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/Traits/ArrayQueryActionTrait.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/Traits/ArrayQueryActionTrait.php @@ -1,6 +1,7 @@ <?php namespace Civi\Api4\Generic\Traits; + use Civi\API\Exception\NotImplementedException; /** @@ -19,8 +20,8 @@ trait ArrayQueryActionTrait { protected function queryArray($values) { $values = $this->filterArray($values); $values = $this->sortArray($values); - $values = $this->selectArray($values); $values = $this->limitArray($values); + $values = $this->selectArray($values); return $values; } @@ -175,7 +176,10 @@ trait ArrayQueryActionTrait { * @return array */ protected function selectArray($values) { - if ($this->getSelect()) { + if ($this->getSelect() === ['row_count']) { + $values = [['row_count' => count($values)]]; + } + elseif ($this->getSelect()) { foreach ($values as &$value) { $value = array_intersect_key($value, array_flip($this->getSelect())); } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Traits/CustomValueActionTrait.php b/civicrm/ext/api4/Civi/Api4/Generic/Traits/CustomValueActionTrait.php index 6a765b409258e615ab5bf8263c038d2cf928abb2..dc59ca77b0b437a8393927cebb90b56f39b60811 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/Traits/CustomValueActionTrait.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/Traits/CustomValueActionTrait.php @@ -12,7 +12,7 @@ use Civi\Api4\Utils\CoreUtil; */ trait CustomValueActionTrait { - function __construct($customGroup, $actionName) { + public function __construct($customGroup, $actionName) { $this->customGroup = $customGroup; parent::__construct('CustomValue', $actionName, ['id', 'entity_id']); } @@ -36,8 +36,17 @@ trait CustomValueActionTrait { */ protected function writeObjects($items) { $result = []; + $fields = $this->entityFields(); foreach ($items as $item) { - FormattingUtil::formatWriteParams($item, $this->getEntityName(), $this->getEntityFields()); + FormattingUtil::formatWriteParams($item, $this->getEntityName(), $fields); + + // Convert field names to custom_xx format + foreach ($fields as $name => $field) { + if (!empty($field['custom_field_id']) && isset($item[$name])) { + $item['custom_' . $field['custom_field_id']] = $item[$name]; + unset($item[$name]); + } + } $result[] = \CRM_Core_BAO_CustomValueTable::setValues($item); } @@ -66,7 +75,7 @@ trait CustomValueActionTrait { * @inheritDoc */ protected function fillDefaults(&$params) { - foreach ($this->getEntityFields() as $name => $field) { + foreach ($this->entityFields() as $name => $field) { if (!isset($params[$name]) && isset($field['default_value'])) { $params[$name] = $field['default_value']; } diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Traits/DAOActionTrait.php b/civicrm/ext/api4/Civi/Api4/Generic/Traits/DAOActionTrait.php index 1c92906bf5504457bcbb68b2277eed25cf3edb12..0d79389c2e3b553808f801a9af822cef7f45b941 100644 --- a/civicrm/ext/api4/Civi/Api4/Generic/Traits/DAOActionTrait.php +++ b/civicrm/ext/api4/Civi/Api4/Generic/Traits/DAOActionTrait.php @@ -5,8 +5,21 @@ use CRM_Utils_Array as UtilsArray; use Civi\Api4\Utils\FormattingUtil; use Civi\Api4\Query\Api4SelectQuery; +/** + * @method string getLanguage() + * @method setLanguage(string $language) + */ trait DAOActionTrait { + /** + * Specify the language to use if this is a multi-lingual environment. + * + * E.g. "en_US" or "fr_CA" + * + * @var string + */ + protected $language; + /** * @return \CRM_Core_DAO|string */ @@ -28,7 +41,7 @@ trait DAOActionTrait { foreach ($fields as $key => $field) { $name = $field['name']; if (property_exists($bao, $name)) { - $values[$name] = $bao->$name; + $values[$name] = isset($bao->$name) ? $bao->$name : NULL; } } return $values; @@ -38,7 +51,7 @@ trait DAOActionTrait { * @return array|int */ protected function getObjects() { - $query = new Api4SelectQuery($this->getEntityName(), $this->getCheckPermissions()); + $query = new Api4SelectQuery($this->getEntityName(), $this->getCheckPermissions(), $this->entityFields()); $query->select = $this->getSelect(); $query->where = $this->getWhere(); $query->orderBy = $this->getOrderBy(); @@ -48,12 +61,32 @@ trait DAOActionTrait { } /** - * Write a bao object as part of a create/update action. + * Fill field defaults which were declared by the api. + * + * Note: default values from core are ignored because the BAO or database layer will supply them. + * + * @param array $params + */ + protected function fillDefaults(&$params) { + $fields = $this->entityFields(); + $bao = $this->getBaoName(); + $coreFields = array_column($bao::fields(), NULL, 'name'); + + foreach ($fields as $name => $field) { + // If a default value in the api field is different than in core, the api should override it. + if (!isset($params[$name]) && !empty($field['default_value']) && $field['default_value'] != \CRM_Utils_Array::pathGet($coreFields, [$name, 'default'])) { + $params[$name] = $field['default_value']; + } + } + } + + /** + * Write bao objects as part of a create/update action. * * @param array $items - * The record to write to the DB. + * The records to write to the DB. * @return array - * The record after being written to the DB (e.g. including newly assigned "id"). + * The records after being written to the DB (e.g. including newly assigned "id"). * @throws \API_Exception */ protected function writeObjects($items) { @@ -61,11 +94,11 @@ trait DAOActionTrait { // Some BAOs are weird and don't support a straightforward "create" method. $oddballs = [ - 'Address' => 'add', + 'EntityTag' => 'add', 'GroupContact' => 'add', 'Website' => 'add', ]; - $method = UtilsArray::value($this->getEntityName(), $oddballs, 'create'); + $method = $oddballs[$this->getEntityName()] ?? 'create'; if (!method_exists($baoName, $method)) { $method = 'add'; } @@ -74,27 +107,23 @@ trait DAOActionTrait { foreach ($items as $item) { $entityId = UtilsArray::value('id', $item); - FormattingUtil::formatWriteParams($item, $this->getEntityName(), $this->getEntityFields()); + FormattingUtil::formatWriteParams($item, $this->getEntityName(), $this->entityFields()); $this->formatCustomParams($item, $entityId); $item['check_permissions'] = $this->getCheckPermissions(); - $apiKeyPermission = $this->getEntityName() != 'Contact' || !$this->getCheckPermissions() || array_key_exists('api_key', $this->getEntityFields()) - || ($entityId && \CRM_Core_Permission::check('edit own api keys') && \CRM_Core_Session::getLoggedInContactID() == $entityId); - - if (!$apiKeyPermission && array_key_exists('api_key', $item)) { - throw new \Civi\API\Exception\UnauthorizedException('Permission denied to modify api key'); - } - // For some reason the contact bao requires this if ($entityId && $this->getEntityName() == 'Contact') { $item['contact_id'] = $entityId; } - if ($this->getCheckPermissions() && $entityId) { + if ($this->getCheckPermissions()) { $this->checkContactPermissions($baoName, $item); } - if (method_exists($baoName, $method)) { + if ($this->getEntityName() == 'Address') { + $createResult = $baoName::add($item, $this->fixAddress); + } + elseif (method_exists($baoName, $method)) { $createResult = $baoName::$method($item); } else { @@ -113,10 +142,6 @@ trait DAOActionTrait { // trim back the junk and just get the array: $resultArray = $this->baoToArray($createResult); - if (!$apiKeyPermission && array_key_exists('api_key', $resultArray)) { - unset($resultArray['api_key']); - } - $result[] = $resultArray; } return $result; @@ -147,7 +172,7 @@ trait DAOActionTrait { * @param int $entityId * @return mixed */ - private function formatCustomParams(&$params, $entityId) { + protected function formatCustomParams(&$params, $entityId) { $customParams = []; // $customValueID is the ID of the custom value in the custom table for this @@ -191,7 +216,8 @@ trait DAOActionTrait { $customParams, $value, $customFieldExtends, - NULL, // todo check when this is needed + // todo check when this is needed + NULL, $entityId, FALSE, FALSE, @@ -213,7 +239,7 @@ trait DAOActionTrait { * @throws \Civi\API\Exception\UnauthorizedException */ protected function checkContactPermissions($baoName, $item) { - if ($baoName == 'CRM_Contact_BAO_Contact') { + if ($baoName == 'CRM_Contact_BAO_Contact' && !empty($item['id'])) { $permission = $this->getActionName() == 'delete' ? \CRM_Core_Permission::DELETE : \CRM_Core_Permission::EDIT; if (!\CRM_Contact_BAO_Contact_Permission::allow($item['id'], $permission)) { throw new \Civi\API\Exception\UnauthorizedException('Permission denied to modify contact record'); diff --git a/civicrm/ext/api4/Civi/Api4/Generic/Traits/IsCurrentTrait.php b/civicrm/ext/api4/Civi/Api4/Generic/Traits/IsCurrentTrait.php new file mode 100644 index 0000000000000000000000000000000000000000..97a008ac09d13100993a6cdcbe7da5b00c42b7a6 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Generic/Traits/IsCurrentTrait.php @@ -0,0 +1,40 @@ +<?php +namespace Civi\Api4\Generic\Traits; + +/** + * This trait adds the $current param to a Get action. + * + * @see \Civi\Api4\Event\Subscriber\IsCurrentSubscriber + */ +trait IsCurrentTrait { + + /** + * Convenience filter for selecting items that are enabled and are currently within their start/end dates. + * + * Adding current = TRUE is a shortcut for + * WHERE is_active = 1 AND (end_date IS NULL OR end_date >= now) AND (start_date IS NULL OR start_DATE <= now) + * + * Adding current = FALSE is a shortcut for + * WHERE is_active = 0 OR start_date > now OR end_date < now + * + * @var bool + */ + protected $current; + + /** + * @return bool + */ + public function getCurrent() { + return $this->current; + } + + /** + * @param bool $current + * @return $this + */ + public function setCurrent($current) { + $this->current = $current; + return $this; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/GroupContact.php b/civicrm/ext/api4/Civi/Api4/GroupContact.php index 8901cd3bf66169a3fe63f384cc9515c6d69881c0..e2664c2d37657680da48c2a5142ebb3a27876339 100644 --- a/civicrm/ext/api4/Civi/Api4/GroupContact.php +++ b/civicrm/ext/api4/Civi/Api4/GroupContact.php @@ -19,6 +19,13 @@ class GroupContact extends Generic\DAOEntity { return new Action\GroupContact\Create(__CLASS__, __FUNCTION__); } + /** + * @return Action\GroupContact\Save + */ + public static function save() { + return new Action\GroupContact\Save(__CLASS__, __FUNCTION__); + } + /** * @return Action\GroupContact\Update */ diff --git a/civicrm/ext/api4/Civi/Api4/GroupNesting.php b/civicrm/ext/api4/Civi/Api4/GroupNesting.php new file mode 100644 index 0000000000000000000000000000000000000000..df3286b66fab5b7ed51d8823e63893c3d71fdedc --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/GroupNesting.php @@ -0,0 +1,11 @@ +<?php +namespace Civi\Api4; + +/** + * GroupNesting entity. + * + * @package Civi\Api4 + */ +class GroupNesting extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/GroupOrganization.php b/civicrm/ext/api4/Civi/Api4/GroupOrganization.php new file mode 100644 index 0000000000000000000000000000000000000000..0263a5bad0523dfc66f55aa2030f4684cf4ed977 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/GroupOrganization.php @@ -0,0 +1,11 @@ +<?php +namespace Civi\Api4; + +/** + * GroupOrganization entity. + * + * @package Civi\Api4 + */ +class GroupOrganization extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/LocationType.php b/civicrm/ext/api4/Civi/Api4/LocationType.php new file mode 100644 index 0000000000000000000000000000000000000000..3bea60b2f519672bc8525536c6cfb5b0e7647096 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/LocationType.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * LocationType entity. + * + * @package Civi\Api4 + */ +class LocationType extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/MailSettings.php b/civicrm/ext/api4/Civi/Api4/MailSettings.php new file mode 100644 index 0000000000000000000000000000000000000000..c03f0dff739c0503ba9956452b387709915efda0 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/MailSettings.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * MailSettings entity. + * + * @package Civi\Api4 + */ +class MailSettings extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/Mapping.php b/civicrm/ext/api4/Civi/Api4/Mapping.php new file mode 100644 index 0000000000000000000000000000000000000000..910ae1a29da247eb3e84942f9cf97aabb0e8e2ae --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Mapping.php @@ -0,0 +1,14 @@ +<?php + +namespace Civi\Api4; + +/** + * Mapping entity. + * + * This is a collection of MappingFields, for reuse in import, export, etc. + * + * @package Civi\Api4 + */ +class Mapping extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/MappingField.php b/civicrm/ext/api4/Civi/Api4/MappingField.php new file mode 100644 index 0000000000000000000000000000000000000000..b1a1be14f98369a3cc1f42190dddaeac7a3fa22b --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/MappingField.php @@ -0,0 +1,14 @@ +<?php + +namespace Civi\Api4; + +/** + * MappingField entity. + * + * This represents one field in a Mapping collection. + * + * @package Civi\Api4 + */ +class MappingField extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/Navigation.php b/civicrm/ext/api4/Civi/Api4/Navigation.php index 31f2a9113e63e0418168f9a68a0c8b03be607ea2..8c0f79dbfbcbfa130ae6ecc2e4f8619d47d07639 100644 --- a/civicrm/ext/api4/Civi/Api4/Navigation.php +++ b/civicrm/ext/api4/Civi/Api4/Navigation.php @@ -9,11 +9,4 @@ namespace Civi\Api4; */ class Navigation extends Generic\DAOEntity { - /** - * @return Action\Navigation\Get - */ - public static function get() { - return new Action\Navigation\Get(__CLASS__, __FUNCTION__); - } - } diff --git a/civicrm/ext/api4/Civi/Api4/Participant.php b/civicrm/ext/api4/Civi/Api4/Participant.php index 0e09c79739fc5a7e8fcdce8f49a636fb366278a6..d0fce78eb16234a007085c9b31ada0b561b499b4 100644 --- a/civicrm/ext/api4/Civi/Api4/Participant.php +++ b/civicrm/ext/api4/Civi/Api4/Participant.php @@ -3,17 +3,10 @@ namespace Civi\Api4; /** - * Participant entity. + * Participant entity, stores the participation record of a contact in an event. * * @package Civi\Api4 */ class Participant extends Generic\DAOEntity { - /** - * @return Action\Participant\Get - */ - public static function get() { - return new Action\Participant\Get(__CLASS__, __FUNCTION__); - } - } diff --git a/civicrm/ext/api4/Civi/Api4/Provider/ActionObjectProvider.php b/civicrm/ext/api4/Civi/Api4/Provider/ActionObjectProvider.php index 60596d92616c4f229fdc8649223cabbf464eca43..0169800af090c2978c25a0713f14fef227a7b492 100644 --- a/civicrm/ext/api4/Civi/Api4/Provider/ActionObjectProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Provider/ActionObjectProvider.php @@ -31,7 +31,7 @@ use Civi\API\Event\ResolveEvent; use Civi\API\Provider\ProviderInterface; use Civi\Api4\Generic\AbstractAction; use Civi\API\Events; -use Civi\Api4\Generic\Result; +use Civi\Api4\Utils\ReflectionUtils; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -52,8 +52,9 @@ class ActionObjectProvider implements EventSubscriberInterface, ProviderInterfac ], ]; } + /** - * @param ResolveEvent $event + * @param \Civi\API\Event\ResolveEvent $event * API resolution event. */ public function onApiResolve(ResolveEvent $event) { @@ -68,12 +69,16 @@ class ActionObjectProvider implements EventSubscriberInterface, ProviderInterfac /** * @inheritDoc * - * @param AbstractAction $action + * @param \Civi\Api4\Generic\AbstractAction $action * - * @return array|mixed + * @return \Civi\Api4\Generic\Result */ public function invoke($action) { - $result = new Result(); + // Load result class based on @return annotation in the execute() method. + $reflection = new \ReflectionClass($action); + $doc = ReflectionUtils::getCodeDocs($reflection->getMethod('execute'), 'Method'); + $resultClass = \CRM_Utils_Array::value('return', $doc, '\\Civi\\Api4\\Generic\\Result'); + $result = new $resultClass(); $result->action = $action->getActionName(); $result->entity = $action->getEntityName(); $action->_run($result); @@ -84,8 +89,8 @@ class ActionObjectProvider implements EventSubscriberInterface, ProviderInterfac /** * Run each chained action once per row * - * @param AbstractAction $action - * @param Result $result + * @param \Civi\Api4\Generic\AbstractAction $action + * @param \Civi\Api4\Generic\Result $result */ protected function handleChains($action, $result) { foreach ($action->getChain() as $name => $request) { diff --git a/civicrm/ext/api4/Civi/Api4/Query/Api4SelectQuery.php b/civicrm/ext/api4/Civi/Api4/Query/Api4SelectQuery.php index a7a912dab433ff4c02d6f09b2432418b5b08c1a3..7f62c59815195639c51a893f72a7add620e6ea93 100644 --- a/civicrm/ext/api4/Civi/Api4/Query/Api4SelectQuery.php +++ b/civicrm/ext/api4/Civi/Api4/Query/Api4SelectQuery.php @@ -34,8 +34,7 @@ use Civi\Api4\Service\Schema\Joinable\CustomGroupJoinable; use Civi\Api4\Service\Schema\Joinable\Joinable; use Civi\Api4\Utils\FormattingUtil; use Civi\Api4\Utils\CoreUtil; -use CRM_Core_DAO_AllCoreTables as TableHelper; -use CRM_Core_DAO_CustomField as CustomFieldDAO; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; use CRM_Utils_Array as UtilsArray; /** @@ -65,7 +64,7 @@ class Api4SelectQuery extends SelectQuery { protected $fkSelectAliases = []; /** - * @var Joinable[] + * @var \Civi\Api4\Service\Schema\Joinable\Joinable[] * The joinable tables that have been joined so far */ protected $joinedTables = []; @@ -73,17 +72,18 @@ class Api4SelectQuery extends SelectQuery { /** * @param string $entity * @param bool $checkPermissions + * @param array $fields */ - public function __construct($entity, $checkPermissions) { + public function __construct($entity, $checkPermissions, $fields) { require_once 'api/v3/utils.php'; $this->entity = $entity; $this->checkPermissions = $checkPermissions; - $baoName = CoreUtil::getDAOFromApiName($entity); + $baoName = CoreUtil::getBAOFromApiName($entity); $bao = new $baoName(); $this->entityFieldNames = _civicrm_api3_field_names(_civicrm_api3_build_fields_array($bao)); - $this->apiFieldSpec = $this->getFields(); + $this->apiFieldSpec = (array) $fields; \CRM_Utils_SQL_Select::from($this->getTableName($baoName) . ' ' . self::MAIN_TABLE_ALIAS); @@ -97,9 +97,43 @@ class Api4SelectQuery extends SelectQuery { * @return array|int */ public function run() { - $this->preRun(); - $baseResults = parent::run(); - $event = new PostSelectQueryEvent($baseResults, $this); + $this->addJoins(); + $this->buildSelectFields(); + $this->buildWhereClause(); + + // Select + if (in_array('row_count', $this->select)) { + $this->query->select("count(*) as c"); + } + else { + foreach ($this->selectFields as $column => $alias) { + $this->query->select("$column as `$alias`"); + } + // Order by + $this->buildOrderBy(); + } + + // Limit + if (!empty($this->limit) || !empty($this->offset)) { + $this->query->limit($this->limit, $this->offset); + } + + $results = []; + $query = \CRM_Core_DAO::executeQuery($this->query->toSQL()); + + while ($query->fetch()) { + if (in_array('row_count', $this->select)) { + $results[]['row_count'] = (int) $query->c; + break; + } + $results[$query->id] = []; + foreach ($this->selectFields as $column => $alias) { + $returnName = $alias; + $alias = str_replace('.', '_', $alias); + $results[$query->id][$returnName] = property_exists($query, $alias) ? $query->$alias : NULL; + }; + } + $event = new PostSelectQueryEvent($results, $this); \Civi::dispatcher()->dispatch(Events::POST_SELECT_QUERY, $event); return $event->getResults(); @@ -108,7 +142,7 @@ class Api4SelectQuery extends SelectQuery { /** * Gets all FK fields and does the required joins */ - protected function preRun() { + protected function addJoins() { $allFields = array_merge($this->select, array_keys($this->orderBy)); $recurse = function($clauses) use (&$allFields, &$recurse) { foreach ($clauses as $clause) { @@ -209,7 +243,6 @@ class Api4SelectQuery extends SelectQuery { if ($this->getField($field)) { $this->query->orderBy(self::MAIN_TABLE_ALIAS . '.' . $field . " $dir"); } - // TODO: Handle joined fields, custom fields, etc. else { throw new \API_Exception("Invalid sort field. Cannot order by $field $dir"); } @@ -294,8 +327,7 @@ class Api4SelectQuery extends SelectQuery { * @inheritDoc */ protected function getFields() { - $fields = civicrm_api4($this->entity, 'getFields', ['action' => 'get', 'checkPermissions' => $this->checkPermissions, 'includeCustom' => FALSE])->indexBy('name'); - return (array) $fields; + return $this->apiFieldSpec; } /** @@ -337,7 +369,7 @@ class Api4SelectQuery extends SelectQuery { } $joinPath = $joiner->join($this, $pathString); - /** @var Joinable $lastLink */ + /** @var \Civi\Api4\Service\Schema\Joinable\Joinable $lastLink */ $lastLink = array_pop($joinPath); // Cache field info for retrieval by $this->getField() @@ -366,7 +398,7 @@ class Api4SelectQuery extends SelectQuery { } /** - * @param Joinable $joinable + * @param \Civi\Api4\Service\Schema\Joinable\Joinable $joinable * * @return $this */ @@ -380,7 +412,7 @@ class Api4SelectQuery extends SelectQuery { * @return FALSE|string */ public function getFrom() { - return TableHelper::getTableForClass(TableHelper::getFullName($this->entity)); + return AllCoreTables::getTableForClass(AllCoreTables::getFullName($this->entity)); } /** @@ -496,14 +528,14 @@ class Api4SelectQuery extends SelectQuery { } /** - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] */ public function getJoinedTables() { return $this->joinedTables; } /** - * @return Joinable + * @return \Civi\Api4\Service\Schema\Joinable\Joinable */ public function getJoinedTable($alias) { foreach ($this->joinedTables as $join) { @@ -528,7 +560,6 @@ class Api4SelectQuery extends SelectQuery { else { $bao = new $baoName(); $this->query = \CRM_Utils_SQL_Select::from($bao->tableName() . ' ' . self::MAIN_TABLE_ALIAS); - $bao->free(); } } diff --git a/civicrm/ext/api4/Civi/Api4/Relationship.php b/civicrm/ext/api4/Civi/Api4/Relationship.php index 5161f05fc51176980db5edef11ffd41fd7416cf8..49f05199594fb96a39e4c0e353308361f0a9c893 100644 --- a/civicrm/ext/api4/Civi/Api4/Relationship.php +++ b/civicrm/ext/api4/Civi/Api4/Relationship.php @@ -9,4 +9,11 @@ namespace Civi\Api4; */ class Relationship extends Generic\DAOEntity { + /** + * @return \Civi\Api4\Action\Relationship\Get + */ + public static function get() { + return new \Civi\Api4\Action\Relationship\Get(static::class, __FUNCTION__); + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Result/ReplaceResult.php b/civicrm/ext/api4/Civi/Api4/Result/ReplaceResult.php new file mode 100644 index 0000000000000000000000000000000000000000..a11b76c059bfc698786c556d91d87e950cd08cce --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Result/ReplaceResult.php @@ -0,0 +1,10 @@ +<?php +namespace Civi\Api4\Result; + +class ReplaceResult extends \Civi\Api4\Generic\Result { + /** + * @var array + */ + public $deleted = []; + +} diff --git a/civicrm/ext/api4/Civi/Api4/Route.php b/civicrm/ext/api4/Civi/Api4/Route.php new file mode 100644 index 0000000000000000000000000000000000000000..dda3a27c388dd4fd608190937d344c6a82040527 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Route.php @@ -0,0 +1,76 @@ +<?php +namespace Civi\Api4; + +use Civi\Api4\Generic\BasicGetFieldsAction; + +class Route extends \Civi\Api4\Generic\AbstractEntity { + + /** + * @return \Civi\Api4\Generic\BasicGetAction + */ + public static function get() { + return new \Civi\Api4\Generic\BasicGetAction(__CLASS__, __FUNCTION__, function ($get) { + // Pulling from ::items() rather than DB -- because it provides the final/live/altered data. + $items = \CRM_Core_Menu::items(); + $result = []; + foreach ($items as $path => $item) { + $result[] = ['path' => $path] + $item; + } + return $result; + }); + } + + public static function getFields() { + return new BasicGetFieldsAction(__CLASS__, __FUNCTION__, function() { + return [ + [ + 'name' => 'path', + 'title' => 'Relative Path', + 'required' => TRUE, + 'data_type' => 'String', + ], + [ + 'name' => 'title', + 'title' => 'Page Title', + 'required' => TRUE, + 'data_type' => 'String', + ], + [ + 'name' => 'page_callback', + 'title' => 'Page Callback', + 'required' => TRUE, + 'data_type' => 'String', + ], + [ + 'name' => 'page_arguments', + 'title' => 'Page Arguments', + 'required' => FALSE, + 'data_type' => 'String', + ], + [ + 'name' => 'path_arguments', + 'title' => 'Path Arguments', + 'required' => FALSE, + 'data_type' => 'String', + ], + [ + 'name' => 'access_arguments', + 'title' => 'Access Arguments', + 'required' => FALSE, + 'data_type' => 'Array', + ], + ]; + }); + } + + /** + * @return array + */ + public static function permissions() { + return [ + "meta" => ["access CiviCRM"], + "default" => ["administer CiviCRM"], + ]; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php index a1dd1a1d678915c3baf3a568a4257eee2b2b7d98..4069b9aff0458d320607e4e76e7404c9d7672ccf 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/CustomGroupJoinable.php @@ -22,7 +22,8 @@ class CustomGroupJoinable extends Joinable { * @param $targetTable * @param $alias * @param bool $isMultiRecord - * @param null $entity + * @param string $entity + * @param string $columns */ public function __construct($targetTable, $alias, $isMultiRecord, $entity, $columns) { $this->entity = $entity; @@ -38,7 +39,8 @@ class CustomGroupJoinable extends Joinable { public function getEntityFields() { if (!$this->entityFields) { $fields = CustomField::get() - ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_required', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value']) + ->setCheckPermissions(FALSE) + ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_required', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value', 'date_format', 'time_format', 'start_date_years', 'end_date_years']) ->addWhere('custom_group.table_name', '=', $this->getTargetTable()) ->execute(); foreach ($fields as $field) { diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/Joinable.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/Joinable.php index 0e92e3ab83c61cea315732abe0dec25e7ca1b68f..f2f29916bff610912f1018faadc62d2af37389b7 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/Joinable.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joinable/Joinable.php @@ -2,8 +2,8 @@ namespace Civi\Api4\Service\Schema\Joinable; -use Civi\Api4\Service\Spec\FieldSpec; -use CRM_Core_DAO_AllCoreTables as Tables; +use Civi\Api4\Utils\CoreUtil; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; class Joinable { @@ -75,7 +75,7 @@ class Joinable { $this->targetTable = $targetTable; $this->targetColumn = $targetColumn; if (!$this->entity) { - $this->entity = Tables::getBriefName(Tables::getClassForTable($targetTable)); + $this->entity = CoreUtil::getApiNameFromTableName($targetTable); } $this->alias = $alias ?: str_replace('civicrm_', '', $targetTable); } @@ -252,7 +252,7 @@ class Joinable { */ public function getEntityFields() { if (!$this->entityFields) { - $bao = Tables::getClassForTable($this->getTargetTable()); + $bao = AllCoreTables::getClassForTable($this->getTargetTable()); if ($bao) { foreach ($bao::fields() as $field) { $this->entityFields[] = \Civi\Api4\Service\Spec\SpecFormatter::arrayToField($field, $this->getEntity()); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joiner.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joiner.php index cb30ab5703c025e676bbbb59b7f609920e063956..87677f1390b633e3a16a1c21dc3d20e5f39c1f15 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/Joiner.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/Joiner.php @@ -3,7 +3,6 @@ namespace Civi\Api4\Service\Schema; use Civi\Api4\Query\Api4SelectQuery; -use Civi\Api4\Service\Schema\Joinable\Joinable; class Joiner { /** @@ -12,7 +11,7 @@ class Joiner { protected $schemaMap; /** - * @var Joinable[][] + * @var \Civi\Api4\Service\Schema\Joinable\Joinable[][] */ protected $cache = []; @@ -24,7 +23,7 @@ class Joiner { } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * The query object to do the joins on * @param string $joinPath * A path of aliases in dot notation, e.g. contact.phone @@ -32,7 +31,7 @@ class Joiner { * Can be LEFT or INNER * * @throws \Exception - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] * The path used to make the join */ public function join(Api4SelectQuery $query, $joinPath, $side = 'LEFT') { @@ -54,7 +53,7 @@ class Joiner { } /** - * @param Api4SelectQuery $query + * @param \Civi\Api4\Query\Api4SelectQuery $query * @param $joinPath * * @return bool diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMap.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMap.php index 3989afeb4ec3fb95ebc0a3d3dd23082303ddec3f..ed3743d9e54c87267ff289035ec25fce493a1975 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMap.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMap.php @@ -3,7 +3,6 @@ namespace Civi\Api4\Service\Schema; use Civi\Api4\Service\Schema\Joinable\BridgeJoinable; -use Civi\Api4\Service\Schema\Joinable\Joinable; class SchemaMap { @@ -18,7 +17,7 @@ class SchemaMap { * @param $baseTableName * @param $targetTableAlias * - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] * Array of links to the target table, empty if no path found */ public function getPath($baseTableName, $targetTableAlias) { @@ -98,9 +97,9 @@ class SchemaMap { * The target joinable table alias * @param int $depth * The current level of recursion which reflects the number of joins needed - * @param Joinable[] $path + * @param \Civi\Api4\Service\Schema\Joinable\Joinable[] $path * (By-reference) The possible paths to the target table - * @param Joinable[] $currentPath + * @param \Civi\Api4\Service\Schema\Joinable\Joinable[] $currentPath * For internal use only to track the path to reach the target table */ private function findPaths(Table $table, $target, $depth, &$path, $currentPath = [] diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMapBuilder.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMapBuilder.php index b578b73a449c06498674c67dc0d2ef5fe91231c0..e1e62a715673fdf3a4f55ef4f5df3a1ecd58c319 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMapBuilder.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/SchemaMapBuilder.php @@ -9,12 +9,12 @@ use Civi\Api4\Service\Schema\Joinable\CustomGroupJoinable; use Civi\Api4\Service\Schema\Joinable\Joinable; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Civi\Api4\Service\Schema\Joinable\OptionValueJoinable; -use CRM_Core_DAO_AllCoreTables as TableHelper; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; use CRM_Utils_Array as UtilsArray; class SchemaMapBuilder { /** - * @var EventDispatcherInterface + * @var \Symfony\Component\EventDispatcher\EventDispatcherInterface */ protected $dispatcher; /** @@ -23,7 +23,7 @@ class SchemaMapBuilder { protected $apiEntities; /** - * @param EventDispatcherInterface $dispatcher + * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */ public function __construct(EventDispatcherInterface $dispatcher) { $this->dispatcher = $dispatcher; @@ -50,7 +50,7 @@ class SchemaMapBuilder { */ private function loadTables(SchemaMap $map) { /** @var \CRM_Core_DAO $daoName */ - foreach (TableHelper::get() as $daoName => $data) { + foreach (AllCoreTables::get() as $daoName => $data) { $table = new Table($data['table']); foreach ($daoName::fields() as $field => $fieldData) { $this->addJoins($table, $field, $fieldData); @@ -74,7 +74,7 @@ class SchemaMapBuilder { // can there be multiple methods e.g. pseudoconstant and fkclass if ($fkClass) { - $tableName = TableHelper::getTableForClass($fkClass); + $tableName = AllCoreTables::getTableForClass($fkClass); $fkKey = UtilsArray::value('FKKeyColumn', $data, 'id'); $alias = str_replace('_id', '', $field); $joinable = new Joinable($tableName, $fkKey, $alias); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Schema/Table.php b/civicrm/ext/api4/Civi/Api4/Service/Schema/Table.php index 1f464a45d2a5c26ad28d1cbf4843c45972acf5d4..a6e706bebbd5840f54985e9995e87c20f46980a9 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Schema/Table.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Schema/Table.php @@ -12,7 +12,7 @@ class Table { protected $name; /** - * @var Joinable[] + * @var \Civi\Api4\Service\Schema\Joinable\Joinable[] * Array of links to other tables */ protected $tableLinks = []; @@ -43,14 +43,14 @@ class Table { } /** - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] */ public function getTableLinks() { return $this->tableLinks; } /** - * @return Joinable[] + * @return \Civi\Api4\Service\Schema\Joinable\Joinable[] * Only those links that are not joining the table to itself */ public function getExternalLinks() { @@ -60,7 +60,7 @@ class Table { } /** - * @param Joinable $linkToRemove + * @param \Civi\Api4\Service\Schema\Joinable\Joinable $linkToRemove */ public function removeLink(Joinable $linkToRemove) { foreach ($this->tableLinks as $index => $link) { @@ -72,7 +72,7 @@ class Table { /** * @param string $baseColumn - * @param Joinable $joinable + * @param \Civi\Api4\Service\Schema\Joinable\Joinable $joinable * * @return $this */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/FieldSpec.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/FieldSpec.php index 1db2941ebb7619dad67dd544b422ab9150972b26..685a7c7df64975bc3a5f47a746819d9540585cb8 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/FieldSpec.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/FieldSpec.php @@ -50,6 +50,16 @@ class FieldSpec { */ protected $dataType; + /** + * @var string + */ + protected $inputType; + + /** + * @var array + */ + protected $inputAttrs = []; + /** * @var string */ @@ -187,7 +197,7 @@ class FieldSpec { } /** - * @param bool $required + * @param bool $requiredIf * * @return $this */ @@ -233,9 +243,46 @@ class FieldSpec { /** * @param int|null $serialize + * @return $this */ public function setSerialize($serialize) { $this->serialize = $serialize; + + return $this; + } + + /** + * @return string + */ + public function getInputType() { + return $this->inputType; + } + + /** + * @param string $inputType + * @return $this + */ + public function setInputType($inputType) { + $this->inputType = $inputType; + + return $this; + } + + /** + * @return array + */ + public function getInputAttrs() { + return $this->inputAttrs; + } + + /** + * @param array $inputAttrs + * @return $this + */ + public function setInputAttrs($inputAttrs) { + $this->inputAttrs = $inputAttrs; + + return $this; } /** @@ -244,7 +291,7 @@ class FieldSpec { * @return array */ private function getValidDataTypes() { - $extraTypes = ['Boolean', 'Text', 'Float', 'Url']; + $extraTypes = ['Boolean', 'Text', 'Float', 'Url', 'Array']; $extraTypes = array_combine($extraTypes, $extraTypes); return array_merge(\CRM_Utils_Type::dataTypes(), $extraTypes); @@ -262,8 +309,8 @@ class FieldSpec { $fieldName = sprintf('custom_%d', $this->getCustomFieldId()); } - $dao = CoreUtil::getDAOFromApiName($this->getEntity()); - $options = $dao::buildOptions($fieldName); + $bao = CoreUtil::getBAOFromApiName($this->getEntity()); + $options = $bao::buildOptions($fieldName); if (!is_array($options) || !$options) { $options = FALSE; diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ACLCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ACLCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..cbc126cb59c5135eecc8837c65620fcedb137aa0 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ACLCreationSpecProvider.php @@ -0,0 +1,23 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class ACLCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('entity_table')->setDefaultValue('civicrm_acl_role'); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'ACL' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActionScheduleCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActionScheduleCreationSpecProvider.php index 660bfec9d71dd955cca95ebe80f947bdccc1e4aa..e05b7d5925f871f54d21bfe79251874f29ef01da 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActionScheduleCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActionScheduleCreationSpecProvider.php @@ -2,10 +2,10 @@ namespace Civi\Api4\Service\Spec\Provider; -use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -class ActionScheduleCreationSpecProvider implements SpecProviderInterface { +class ActionScheduleCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActivityCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActivityCreationSpecProvider.php index dc254342cb0dba1012bb50aa4ec97aa3b3a822cb..52eb75a2a0c291b1c55859d43c25d3c7637640d9 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActivityCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ActivityCreationSpecProvider.php @@ -5,7 +5,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -class ActivityCreationSpecProvider implements SpecProviderInterface { +class ActivityCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/AddressCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/AddressCreationSpecProvider.php index afba9c79d64a5da877e0b9c2116048e68b371025..ecb6b271b9c58b0fd46e0fd5a5259351521a5bd2 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/AddressCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/AddressCreationSpecProvider.php @@ -2,14 +2,12 @@ namespace Civi\Api4\Service\Spec\Provider; -use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; - -class AddressCreationSpecProvider implements SpecProviderInterface { +class AddressCreationSpecProvider implements Generic\SpecProviderInterface { /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('contact_id')->setRequired(TRUE); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CampaignCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CampaignCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..db0f48f7d678341f9c49ed9238929393528b8a3e --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CampaignCreationSpecProvider.php @@ -0,0 +1,24 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class CampaignCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('title')->setRequired(TRUE); + $spec->getFieldByName('name')->setRequired(FALSE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'Campaign' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php index 94c68d9d093a998988487619b125721d69976086..9f826280e7c9cc318ac910a40e6a185f2da94930 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactCreationSpecProvider.php @@ -4,14 +4,13 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class ContactCreationSpecProvider implements SpecProviderInterface { +class ContactCreationSpecProvider implements Generic\SpecProviderInterface { /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('contact_type') - ->setRequired(TRUE) ->setDefaultValue('Individual'); $spec->getFieldByName('is_opt_out')->setRequired(FALSE); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactTypeCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactTypeCreationSpecProvider.php index f55deb1c1eaf04d1a9b2fa84587d405d6dc59fe6..88c115edf2f8190e21f62145b0cf9056d3ddafe3 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactTypeCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContactTypeCreationSpecProvider.php @@ -4,10 +4,10 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class ContactTypeCreationSpecProvider implements SpecProviderInterface { +class ContactTypeCreationSpecProvider implements Generic\SpecProviderInterface { /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('label')->setRequired(TRUE); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContributionCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContributionCreationSpecProvider.php index 14861871e1c2bb02402634a98daff40454daa8e0..42d2a7a5daf815ac8db4ffce1f51c6a2e6c40a26 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContributionCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/ContributionCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class ContributionCreationSpecProvider implements SpecProviderInterface { +class ContributionCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomFieldCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomFieldCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..4d3aba57995a5c37d9f5f8a7aab50e4744669131 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomFieldCreationSpecProvider.php @@ -0,0 +1,28 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\FieldSpec; +use Civi\Api4\Service\Spec\RequestSpec; + +class CustomFieldCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $optionField = new FieldSpec('option_values', $spec->getEntity(), 'Array'); + $optionField->setTitle(ts('Option Values')); + $optionField->setDescription('Pass an array of options (value => label) to create this field\'s option values'); + $spec->addFieldSpec($optionField); + $spec->getFieldByName('data_type')->setDefaultValue('String')->setRequired(FALSE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'CustomField' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomGroupCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomGroupCreationSpecProvider.php index cd033754e9c47f9035149a9fa8338f64b6ef82f6..aa3002d95c9cca9076600a57f49740aed6afd5fd 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomGroupCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomGroupCreationSpecProvider.php @@ -4,12 +4,13 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class CustomGroupCreationSpecProvider implements SpecProviderInterface { +class CustomGroupCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ public function modifySpec(RequestSpec $spec) { - return $spec->getFieldByName('extends')->setRequired(TRUE); + $spec->getFieldByName('extends')->setRequired(TRUE); } /** diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php index cd82d438f1aaac9c62ae5d689f3e4566faeb013c..97b58ee34adfcdc995526ef8dcf717c37b9da5bf 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/CustomValueSpecProvider.php @@ -5,7 +5,7 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -class CustomValueSpecProvider implements SpecProviderInterface { +class CustomValueSpecProvider implements Generic\SpecProviderInterface { /** * @inheritDoc diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DefaultLocationTypeProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DefaultLocationTypeProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..54ee12061d0269e5fe5ca5d677a6756914491f45 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DefaultLocationTypeProvider.php @@ -0,0 +1,27 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class DefaultLocationTypeProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $locationField = $spec->getFieldByName('location_type_id')->setRequired(TRUE); + $defaultType = \CRM_Core_BAO_LocationType::getDefault(); + if ($defaultType) { + $locationField->setDefaultValue($defaultType->id); + } + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $action === 'create' && in_array($entity, ['Address', 'Email', 'IM', 'OpenID', 'Phone']); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DomainCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DomainCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..890bd7e9d4231a337a58adb595342e95478c6f21 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/DomainCreationSpecProvider.php @@ -0,0 +1,24 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class DomainCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('name')->setRequired(TRUE); + $spec->getFieldByName('version')->setRequired(TRUE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'Domain' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EmailCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EmailCreationSpecProvider.php index 136b0e54025a8fbf82b6bb1d117c1427caec0d85..aa6db7c3503cd9fb9020708ebe6acd70b0b8b001 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EmailCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EmailCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class EmailCreationSpecProvider implements SpecProviderInterface { +class EmailCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EntityTagCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EntityTagCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..47df3af9f4d002927d0e92ee1f66c57781ba459b --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EntityTagCreationSpecProvider.php @@ -0,0 +1,26 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class EntityTagCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @param \Civi\Api4\Service\Spec\RequestSpec $spec + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('entity_table')->setRequired(FALSE)->setDefaultValue('civicrm_contact'); + } + + /** + * @param string $entity + * @param string $action + * + * @return bool + */ + public function applies($entity, $action) { + return $entity === 'EntityTag' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EventCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EventCreationSpecProvider.php index 42b74a6f7502aba7494ffc02905d89693f83dc63..109a3a98d84657423d3f2b09514984585ed27d6f 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EventCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/EventCreationSpecProvider.php @@ -2,14 +2,25 @@ namespace Civi\Api4\Service\Spec\Provider; +use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -class EventCreationSpecProvider implements SpecProviderInterface { +class EventCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ public function modifySpec(RequestSpec $spec) { - $spec->getFieldByName('is_template')->setRequired(FALSE); + $spec->getFieldByName('event_type_id')->setRequiredIf('empty($values.template_id)'); + $spec->getFieldByName('title')->setRequiredIf('empty($values.is_template)'); + $spec->getFieldByName('start_date')->setRequiredIf('empty($values.is_template)'); + $spec->getFieldByName('template_title')->setRequiredIf('!empty($values.is_template)'); + + $template_id = new FieldSpec('template_id', 'Event', 'Integer'); + $template_id + ->setTitle('Template Id') + ->setDescription('Template on which to base this new event'); + $spec->addFieldSpec($template_id); } /** diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/SpecProviderInterface.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/Generic/SpecProviderInterface.php similarity index 74% rename from civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/SpecProviderInterface.php rename to civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/Generic/SpecProviderInterface.php index 8be77e68bed253c6ee6407c3ca1faf06e8513165..4b7a9887c69bd016646de5e8a04e6924610ca7c9 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/SpecProviderInterface.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/Generic/SpecProviderInterface.php @@ -1,12 +1,13 @@ <?php -namespace Civi\Api4\Service\Spec\Provider; +namespace Civi\Api4\Service\Spec\Provider\Generic; use Civi\Api4\Service\Spec\RequestSpec; interface SpecProviderInterface { + /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec * * @return void */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GetActionDefaultsProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GetActionDefaultsProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..5f67131bf3f067d18d896d4309b7604e8d60f1b1 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GetActionDefaultsProvider.php @@ -0,0 +1,33 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class GetActionDefaultsProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + // Exclude deleted records from api Get by default + $isDeletedField = $spec->getFieldByName('is_deleted'); + if ($isDeletedField) { + $isDeletedField->setDefaultValue('0'); + } + + // Exclude test records from api Get by default + $isTestField = $spec->getFieldByName('is_test'); + if ($isTestField) { + $isTestField->setDefaultValue('0'); + } + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $action === 'get'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GroupCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GroupCreationSpecProvider.php index 8af69a0a5335699cbeea565fd2848fc53987c61a..b549fa05c987cfafb48ead243d093f753b5d85b3 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GroupCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/GroupCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class GroupCreationSpecProvider implements SpecProviderInterface { +class GroupCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..2139c5e4f3f02ca1eb9020ed5ea1531c86aa16e8 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/MappingCreationSpecProvider.php @@ -0,0 +1,28 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class MappingCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * This function runs for both Mapping and MappingField entities + * + * @param \Civi\Api4\Service\Spec\RequestSpec $spec + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('name')->setRequired(TRUE); + } + + /** + * @param string $entity + * @param string $action + * + * @return bool + */ + public function applies($entity, $action) { + return strpos($entity, 'Mapping') === 0 && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..1a9188dc8d43d8ad4b78da989fd4a8ef54d895d8 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationSpecProvider.php @@ -0,0 +1,25 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class NavigationSpecProvider implements Generic\SpecProviderInterface { + + /** + * This runs for both create and get actions + * + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('domain_id')->setRequired(FALSE)->setDefaultValue('current_domain'); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'Navigation' && in_array($action, ['create', 'get']); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NoteCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NoteCreationSpecProvider.php index f12e592cf8df4ac9e82205153755f778c5a0e937..20592543eb2c3a2e948f422a6f9b5700a1b96055 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NoteCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NoteCreationSpecProvider.php @@ -4,11 +4,10 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; - -class NoteCreationSpecProvider implements SpecProviderInterface { +class NoteCreationSpecProvider implements Generic\SpecProviderInterface { /** - * @param RequestSpec $spec + * @param \Civi\Api4\Service\Spec\RequestSpec $spec */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('note')->setRequired(TRUE); diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/OptionValueCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/OptionValueCreationSpecProvider.php index 4ea634c189e48980f7a26f343d9b9b01833d149f..8e996ecb1a75dab49c86d0ed4b589123dd3ac92d 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/OptionValueCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/OptionValueCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class OptionValueCreationSpecProvider implements SpecProviderInterface { +class OptionValueCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/PhoneCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/PhoneCreationSpecProvider.php index bb757d439076166565263f3f498b5cdfe67cf971..a69177278ecf50581bd36dc4f054f472220e2816 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/PhoneCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/PhoneCreationSpecProvider.php @@ -4,13 +4,13 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class PhoneCreationSpecProvider implements SpecProviderInterface { +class PhoneCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ public function modifySpec(RequestSpec $spec) { $spec->getFieldByName('contact_id')->setRequired(TRUE); - $spec->getFieldByName('location_type_id')->setRequired(TRUE); $spec->getFieldByName('phone')->setRequired(TRUE); } diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/RelationshipTypeCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/RelationshipTypeCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..b2d60a591552fad9cd4cef3b5c2ebca01375047c --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/RelationshipTypeCreationSpecProvider.php @@ -0,0 +1,24 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class RelationshipTypeCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('name_a_b')->setRequired(TRUE); + $spec->getFieldByName('name_b_a')->setRequired(TRUE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'RelationshipType' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/StatusPreferenceCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/StatusPreferenceCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..66fa7ad8209563d3fc212dd7890bcb572f789226 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/StatusPreferenceCreationSpecProvider.php @@ -0,0 +1,23 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class StatusPreferenceCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('domain_id')->setRequired(FALSE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'StatusPreference' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/TagCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/TagCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..f4fe05af0fe34cfb7f3e905163ea9822161977f3 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/TagCreationSpecProvider.php @@ -0,0 +1,26 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class TagCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @param \Civi\Api4\Service\Spec\RequestSpec $spec + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('used_for')->setDefaultValue('civicrm_contact'); + } + + /** + * @param string $entity + * @param string $action + * + * @return bool + */ + public function applies($entity, $action) { + return $entity === 'Tag' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFFieldCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFFieldCreationSpecProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..e7cf393cbb61a8bbc7e56dc5a508493a4f57f8d3 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFFieldCreationSpecProvider.php @@ -0,0 +1,23 @@ +<?php + +namespace Civi\Api4\Service\Spec\Provider; + +use Civi\Api4\Service\Spec\RequestSpec; + +class UFFieldCreationSpecProvider implements Generic\SpecProviderInterface { + + /** + * @inheritDoc + */ + public function modifySpec(RequestSpec $spec) { + $spec->getFieldByName('label')->setRequired(FALSE); + } + + /** + * @inheritDoc + */ + public function applies($entity, $action) { + return $entity === 'UFField' && $action === 'create'; + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationCreationSpecProvider.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFMatchCreationSpecProvider.php similarity index 70% rename from civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationCreationSpecProvider.php rename to civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFMatchCreationSpecProvider.php index 7d5fc2707f2c2facf800d221bbce43ce211e0fb7..06b9bb25cc4cc96a56294fd966d712c63e3886f7 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/NavigationCreationSpecProvider.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/Provider/UFMatchCreationSpecProvider.php @@ -4,7 +4,8 @@ namespace Civi\Api4\Service\Spec\Provider; use Civi\Api4\Service\Spec\RequestSpec; -class NavigationCreationSpecProvider implements SpecProviderInterface { +class UFMatchCreationSpecProvider implements Generic\SpecProviderInterface { + /** * @inheritDoc */ @@ -16,7 +17,7 @@ class NavigationCreationSpecProvider implements SpecProviderInterface { * @inheritDoc */ public function applies($entity, $action) { - return $entity === 'Navigation' && $action === 'create'; + return $entity === 'UFMatch' && $action === 'create'; } } diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecFormatter.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecFormatter.php index c8e4d3da4df0cdc308965dab90f8508e05c6c1ef..0e55012d73ff7e218f889e53ab1ab8e7db526323 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecFormatter.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecFormatter.php @@ -3,24 +3,24 @@ namespace Civi\Api4\Service\Spec; use CRM_Utils_Array as ArrayHelper; -use CRM_Core_DAO_AllCoreTables as TableHelper; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; class SpecFormatter { + /** * @param FieldSpec[] $fields - * @param array $return * @param bool $includeFieldOptions * * @return array */ - public static function specToArray($fields, $return = [], $includeFieldOptions = FALSE) { + public static function specToArray($fields, $includeFieldOptions = FALSE) { $fieldArray = []; foreach ($fields as $field) { - if ($includeFieldOptions || in_array('options', $return)) { + if ($includeFieldOptions) { $field->getOptions(); } - $fieldArray[$field->getName()] = $field->toArray($return); + $fieldArray[$field->getName()] = $field->toArray(); } return $fieldArray; @@ -63,11 +63,12 @@ class SpecFormatter { $field->setDefaultValue(ArrayHelper::value('default', $data)); $field->setDescription(ArrayHelper::value('description', $data)); + self::setInputTypeAndAttrs($field, $data, $dataTypeName); $fkAPIName = ArrayHelper::value('FKApiName', $data); $fkClassName = ArrayHelper::value('FKClassName', $data); if ($fkAPIName || $fkClassName) { - $field->setFkEntity($fkAPIName ?: TableHelper::getBriefName($fkClassName)); + $field->setFkEntity($fkAPIName ?: AllCoreTables::getBriefName($fkClassName)); } return $field; @@ -89,7 +90,7 @@ class SpecFormatter { if (in_array($field['data_type'], ['ContactReference', 'Date'])) { return FALSE; } - if (strpos($field['html_type'], 'Select')) { + if (strpos($field['html_type'], 'Select') !== FALSE) { return TRUE; } return !empty($field['option_group_id']); @@ -105,7 +106,7 @@ class SpecFormatter { */ private static function getDataType(array $data) { if (isset($data['data_type'])) { - return $data['data_type']; + return !empty($data['time_format']) ? 'Timestamp' : $data['data_type']; } $dataTypeInt = ArrayHelper::value('type', $data); @@ -114,4 +115,102 @@ class SpecFormatter { return $dataTypeName; } + /** + * @param \Civi\Api4\Service\Spec\FieldSpec $fieldSpec + * @param array $data + * @param string $dataTypeName + */ + public static function setInputTypeAndAttrs(FieldSpec &$fieldSpec, $data, $dataTypeName) { + $inputType = isset($data['html']['type']) ? $data['html']['type'] : ArrayHelper::value('html_type', $data); + $inputAttrs = ArrayHelper::value('html', $data, []); + unset($inputAttrs['type']); + + if (!$inputType) { + // If no html type is set, guess + switch ($dataTypeName) { + case 'Int': + $inputType = 'Number'; + $inputAttrs['min'] = 0; + break; + + case 'Text': + $inputType = ArrayHelper::value('type', $data) === \CRM_Utils_Type::T_LONGTEXT ? 'TextArea' : 'Text'; + break; + + case 'Timestamp': + $inputType = 'Date'; + $inputAttrs['time'] = TRUE; + break; + + case 'Date': + $inputAttrs['time'] = FALSE; + break; + + case 'Time': + $inputType = 'Date'; + $inputAttrs['time'] = TRUE; + $inputAttrs['date'] = FALSE; + break; + + default: + $map = [ + 'Email' => 'Email', + 'Boolean' => 'Checkbox', + ]; + $inputType = ArrayHelper::value($dataTypeName, $map, 'Text'); + } + } + if (strstr($inputType, 'Multi-Select') || ($inputType == 'Select' && !empty($data['serialize']))) { + $inputAttrs['multiple'] = TRUE; + $inputType = 'Select'; + } + $map = [ + 'Select State/Province' => 'Select', + 'Select Country' => 'Select', + 'Select Date' => 'Date', + 'Link' => 'Url', + ]; + $inputType = ArrayHelper::value($inputType, $map, $inputType); + if ($inputType == 'Date' && !empty($inputAttrs['formatType'])) { + self::setLegacyDateFormat($inputAttrs); + } + // Date/time settings from custom fields + if ($inputType == 'Date' && !empty($data['custom_group_id'])) { + $inputAttrs['time'] = empty($data['time_format']) ? FALSE : ($data['time_format'] == 1 ? 12 : 24); + $inputAttrs['date'] = $data['date_format']; + $inputAttrs['start_date_years'] = (int) $data['start_date_years']; + $inputAttrs['end_date_years'] = (int) $data['end_date_years']; + } + if ($inputType == 'Text' && !empty($data['maxlength'])) { + $inputAttrs['maxlength'] = (int) $data['maxlength']; + } + if ($inputType == 'TextArea') { + foreach (['rows', 'cols', 'note_rows', 'note_cols'] as $prop) { + if (!empty($data[$prop])) { + $inputAttrs[str_replace('note_', '', $prop)] = (int) $data[$prop]; + } + } + } + $fieldSpec + ->setInputType($inputType) + ->setInputAttrs($inputAttrs); + } + + /** + * @param array $inputAttrs + */ + private static function setLegacyDateFormat(&$inputAttrs) { + if (empty(\Civi::$statics['legacyDatePrefs'][$inputAttrs['formatType']])) { + \Civi::$statics['legacyDatePrefs'][$inputAttrs['formatType']] = []; + $params = ['name' => $inputAttrs['formatType']]; + \CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_PreferencesDate', $params, \Civi::$statics['legacyDatePrefs'][$inputAttrs['formatType']]); + } + $dateFormat = \Civi::$statics['legacyDatePrefs'][$inputAttrs['formatType']]; + unset($inputAttrs['formatType']); + $inputAttrs['time'] = !empty($dateFormat['time_format']); + $inputAttrs['date'] = TRUE; + $inputAttrs['start_date_years'] = (int) $dateFormat['start']; + $inputAttrs['end_date_years'] = (int) $dateFormat['end']; + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecGatherer.php b/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecGatherer.php index b1c83c89593b00424d60fd4c2fd60b01d6453f89..ca5da91a59af11a11b2cb9b75ae28e4702de173e 100644 --- a/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecGatherer.php +++ b/civicrm/ext/api4/Civi/Api4/Service/Spec/SpecGatherer.php @@ -3,13 +3,13 @@ namespace Civi\Api4\Service\Spec; use Civi\Api4\CustomField; -use Civi\Api4\Service\Spec\Provider\SpecProviderInterface; +use Civi\Api4\Service\Spec\Provider\Generic\SpecProviderInterface; use Civi\Api4\Utils\CoreUtil; class SpecGatherer { /** - * @var SpecProviderInterface[] + * @var \Civi\Api4\Service\Spec\Provider\Generic\SpecProviderInterface[] */ protected $specProviders = []; @@ -46,6 +46,13 @@ class SpecGatherer { $this->getCustomGroupFields(substr($entity, 7), $specification); } + // Default value only makes sense for create actions + if ($action != 'create') { + foreach ($specification->getFields() as $field) { + $field->setDefaultValue(NULL); + } + } + foreach ($this->specProviders as $provider) { if ($provider->applies($entity, $action)) { $provider->modifySpec($specification); @@ -56,7 +63,7 @@ class SpecGatherer { } /** - * @param SpecProviderInterface $provider + * @param \Civi\Api4\Service\Spec\Provider\Generic\SpecProviderInterface $provider */ public function addSpecProvider(SpecProviderInterface $provider) { $this->specProviders[] = $provider; @@ -64,7 +71,8 @@ class SpecGatherer { /** * @param string $entity - * @param RequestSpec $specification + * @param string $action + * @param \Civi\Api4\Service\Spec\RequestSpec $specification */ private function addDAOFields($entity, $action, RequestSpec $specification) { $DAOFields = $this->getDAOFields($entity); @@ -86,13 +94,14 @@ class SpecGatherer { /** * @param string $entity - * @param RequestSpec $specification + * @param \Civi\Api4\Service\Spec\RequestSpec $specification */ private function addCustomFields($entity, RequestSpec $specification) { $extends = ($entity == 'Contact') ? ['Contact', 'Individual', 'Organization', 'Household'] : [$entity]; $customFields = CustomField::get() + ->setCheckPermissions(FALSE) ->addWhere('custom_group.extends', 'IN', $extends) - ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value']) + ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value', 'date_format', 'time_format', 'start_date_years', 'end_date_years']) ->execute(); foreach ($customFields as $fieldArray) { @@ -103,12 +112,12 @@ class SpecGatherer { /** * @param string $customGroup - * @param RequestSpec $specification + * @param \Civi\Api4\Service\Spec\RequestSpec $specification */ private function getCustomGroupFields($customGroup, RequestSpec $specification) { $customFields = CustomField::get() ->addWhere('custom_group.name', '=', $customGroup) - ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value', 'custom_group.table_name', 'column_name']) + ->setSelect(['custom_group.name', 'custom_group_id', 'name', 'label', 'data_type', 'html_type', 'is_searchable', 'is_search_range', 'weight', 'is_active', 'is_view', 'option_group_id', 'default_value', 'custom_group.table_name', 'column_name', 'date_format', 'time_format', 'start_date_years', 'end_date_years']) ->execute(); foreach ($customFields as $fieldArray) { @@ -123,9 +132,9 @@ class SpecGatherer { * @return array */ private function getDAOFields($entityName) { - $dao = CoreUtil::getDAOFromApiName($entityName); + $bao = CoreUtil::getBAOFromApiName($entityName); - return $dao::fields(); + return $bao::fields(); } } diff --git a/civicrm/ext/api4/Civi/Api4/Setting.php b/civicrm/ext/api4/Civi/Api4/Setting.php new file mode 100644 index 0000000000000000000000000000000000000000..abd76793cd116381d99f9f3a70109d28b967cbfc --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Setting.php @@ -0,0 +1,30 @@ +<?php + +namespace Civi\Api4; + +/** + * CiviCRM settings api. + * + * Used to read/write persistent setting data from CiviCRM. + * + * @package Civi\Api4 + */ +class Setting extends Generic\AbstractEntity { + + public static function get() { + return new Action\Setting\Get(__CLASS__, __FUNCTION__); + } + + public static function set() { + return new Action\Setting\Set(__CLASS__, __FUNCTION__); + } + + public static function revert() { + return new Action\Setting\Revert(__CLASS__, __FUNCTION__); + } + + public static function getFields() { + return new Action\Setting\GetFields(__CLASS__, __FUNCTION__); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/StatusPreference.php b/civicrm/ext/api4/Civi/Api4/StatusPreference.php new file mode 100644 index 0000000000000000000000000000000000000000..c89ff979b2b37907750064a522d2f39791516cc5 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/StatusPreference.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * For setting "hush" preferences for system check alerts. + * + * @package Civi\Api4 + */ +class StatusPreference extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/System.php b/civicrm/ext/api4/Civi/Api4/System.php new file mode 100644 index 0000000000000000000000000000000000000000..fbbc37acbeecbabeb83d45116d1086d9c4827f82 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/System.php @@ -0,0 +1,28 @@ +<?php + +namespace Civi\Api4; + +use Civi\Api4\Generic\BasicGetFieldsAction; + +/** + * A collection of system maintenance/diagnostic utilities. + * + * @package Civi\Api4 + */ +class System extends Generic\AbstractEntity { + + public static function flush() { + return new Action\System\Flush(__CLASS__, __FUNCTION__); + } + + public static function check() { + return new Action\System\Check(__CLASS__, __FUNCTION__); + } + + public static function getFields() { + return new BasicGetFieldsAction(__CLASS__, __FUNCTION__, function() { + return []; + }); + } + +} diff --git a/civicrm/ext/api4/Civi/Api4/Tag.php b/civicrm/ext/api4/Civi/Api4/Tag.php new file mode 100644 index 0000000000000000000000000000000000000000..a56679df4380f1c1648c594354ae7d2357aeb43b --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/Tag.php @@ -0,0 +1,15 @@ +<?php + +namespace Civi\Api4; + +/** + * Tag entity. + * + * Tags in CiviCRM are used for Contacts, Activities, Cases & Attachments. + * They are connected to those entities via the EntityTag table. + * + * @package Civi\Api4 + */ +class Tag extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/UFField.php b/civicrm/ext/api4/Civi/Api4/UFField.php new file mode 100644 index 0000000000000000000000000000000000000000..736554ca8e748794c09a2d2fdcb5111f9dacd2f7 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/UFField.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * UFField entity - aka profile fields. + * + * @package Civi\Api4 + */ +class UFField extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/UFMatch.php b/civicrm/ext/api4/Civi/Api4/UFMatch.php new file mode 100644 index 0000000000000000000000000000000000000000..0840c4423e5bdfb09b2057f0554312b890bcc78c --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/UFMatch.php @@ -0,0 +1,12 @@ +<?php + +namespace Civi\Api4; + +/** + * UFMatch entity - links civicrm contacts with users created externally + * + * @package Civi\Api4 + */ +class UFMatch extends Generic\DAOEntity { + +} diff --git a/civicrm/ext/api4/Civi/Api4/Utils/ArrayInsertionUtil.php b/civicrm/ext/api4/Civi/Api4/Utils/ArrayInsertionUtil.php index 54e3944b00e63cadd36c120cbda02cdccd5c160c..301e3f67c6c3f2dcd2a42901bc5e56afa5d9724b 100644 --- a/civicrm/ext/api4/Civi/Api4/Utils/ArrayInsertionUtil.php +++ b/civicrm/ext/api4/Civi/Api4/Utils/ArrayInsertionUtil.php @@ -5,6 +5,7 @@ namespace Civi\Api4\Utils; use CRM_Utils_Array as UtilsArray; class ArrayInsertionUtil { + /** * If the values to be inserted contain a key _parent_id they will only be * inserted if the parent node ID matches their ID diff --git a/civicrm/ext/api4/Civi/Api4/Utils/CoreUtil.php b/civicrm/ext/api4/Civi/Api4/Utils/CoreUtil.php index b43e62ca26d4b803271feb4577631665ce78696f..b4ed48e82c829f10a0732074dc6f4df8f80e5cb9 100644 --- a/civicrm/ext/api4/Civi/Api4/Utils/CoreUtil.php +++ b/civicrm/ext/api4/Civi/Api4/Utils/CoreUtil.php @@ -3,6 +3,7 @@ namespace Civi\Api4\Utils; use Civi\Api4\CustomGroup; +use CRM_Core_DAO_AllCoreTables as AllCoreTables; require_once 'api/v3/utils.php'; @@ -14,14 +15,14 @@ class CoreUtil { * @param $entityName * * @return \CRM_Core_DAO|string - * The DAO name for use in static calls. Return doc block is hacked to allow + * The BAO name for use in static calls. Return doc block is hacked to allow * auto-completion of static methods */ - public static function getDAOFromApiName($entityName) { + public static function getBAOFromApiName($entityName) { if ($entityName === 'CustomValue' || strpos($entityName, 'Custom_') === 0) { return 'CRM_Contact_BAO_Contact'; } - return \_civicrm_api3_get_DAO($entityName); + return \_civicrm_api3_get_BAO($entityName); } /** @@ -39,4 +40,14 @@ class CoreUtil { ->first()['table_name']; } + /** + * Given a sql table name, return the name of the api entity. + * + * @param $tableName + * @return string + */ + public static function getApiNameFromTableName($tableName) { + return AllCoreTables::getBriefName(AllCoreTables::getClassForTable($tableName)); + } + } diff --git a/civicrm/ext/api4/Civi/Api4/Utils/FormattingUtil.php b/civicrm/ext/api4/Civi/Api4/Utils/FormattingUtil.php index 3a7cdae5ac18f5b65b13558bb327028316597622..2070a221257cba49cbd8fbead8e03d85f2065f6e 100644 --- a/civicrm/ext/api4/Civi/Api4/Utils/FormattingUtil.php +++ b/civicrm/ext/api4/Civi/Api4/Utils/FormattingUtil.php @@ -46,16 +46,6 @@ class FormattingUtil { $params[$name] = 'null'; } - if (strstr($entity, 'Custom_')) { - if ($name == 'entity_id') { - $params['entityID'] = $params['entity_id']; - unset($params['entity_id']); - } - elseif (!empty($field['custom_field_id'])) { - $params['custom_' . $field['custom_field_id']] = $params[$name]; - unset($params[$name]); - } - } } } diff --git a/civicrm/ext/api4/Civi/Api4/Utils/ReflectionUtils.php b/civicrm/ext/api4/Civi/Api4/Utils/ReflectionUtils.php index 76662647dadd24e3a49faad88be275fd54b221c3..535f9523c5b54c76498bd875b7e1065f85eed2e4 100644 --- a/civicrm/ext/api4/Civi/Api4/Utils/ReflectionUtils.php +++ b/civicrm/ext/api4/Civi/Api4/Utils/ReflectionUtils.php @@ -31,6 +31,7 @@ namespace Civi\Api4\Utils; * Just another place to put static functions... */ class ReflectionUtils { + /** * @param \Reflector|\ReflectionClass $reflection * @param string $type @@ -58,7 +59,8 @@ class ReflectionUtils { $newReflection = $reflection->getParentClass(); } } - catch (\ReflectionException $e) {} + catch (\ReflectionException $e) { + } if ($newReflection) { // Mix in $additionalDocs = self::getCodeDocs($newReflection, $type); @@ -116,4 +118,23 @@ class ReflectionUtils { return $info; } + /** + * List all traits used by a class and its parents. + * + * @param object|string $class + * @return array + */ + public static function getTraits($class) { + $traits = []; + // Get traits of this class + parent classes + do { + $traits = array_merge(class_uses($class), $traits); + } while ($class = get_parent_class($class)); + // Get traits of traits + foreach ($traits as $trait => $same) { + $traits = array_merge(class_uses($trait), $traits); + } + return $traits; + } + } diff --git a/civicrm/ext/api4/Civi/Api4/services.xml b/civicrm/ext/api4/Civi/Api4/services.xml new file mode 100644 index 0000000000000000000000000000000000000000..3d8a2fcab14b35f4db2aa2c5e45c54c2baf7ae04 --- /dev/null +++ b/civicrm/ext/api4/Civi/Api4/services.xml @@ -0,0 +1,26 @@ +<container xmlns="http://symfony.com/schema/dic/services" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + + <services> + + <service id="spec_gatherer" class="Civi\Api4\Service\Spec\SpecGatherer"/> + + <service id="schema_map_builder" class="Civi\Api4\Service\Schema\SchemaMapBuilder" public="false"> + <argument type="service" id="dispatcher" /> + </service> + + <service id="schema_map" class="Civi\Api4\Service\Schema\SchemaMap"> + <factory service="schema_map_builder" method="build"/> + </service> + + <service id="joiner" class="Civi\Api4\Service\Schema\Joiner"> + <argument type="service" id="schema_map"/> + </service> + + <service id="action_object_provider" class="Civi\Api4\Provider\ActionObjectProvider"> + <tag name="event_subscriber"/> + </service> + + </services> +</container> diff --git a/civicrm/ext/api4/ang/api4Explorer.ang.php b/civicrm/ext/api4/ang/api4Explorer.ang.php index 6583f2778e621546ac848ebd94203c1af6423c9c..e00ea0985c3495372d5b4351a86f61b2e933bbf0 100644 --- a/civicrm/ext/api4/ang/api4Explorer.ang.php +++ b/civicrm/ext/api4/ang/api4Explorer.ang.php @@ -14,5 +14,5 @@ return [ 'ang/api4Explorer', ], 'basePages' => [], - 'requires' => ['crmUi', 'crmUtil', 'ngRoute', 'crmRouteBinder', 'ui.sortable', 'api4'], + 'requires' => ['crmUi', 'crmUtil', 'ngRoute', 'crmRouteBinder', 'ui.sortable', 'api4', 'ngSanitize'], ]; diff --git a/civicrm/ext/api4/ang/api4Explorer/Explorer.html b/civicrm/ext/api4/ang/api4Explorer/Explorer.html index 6cea301fceaca629b7ac4f6255c7144d3a6fbb08..bbfd35b95962a2b773c34ea6f609b027b11b39bb 100644 --- a/civicrm/ext/api4/ang/api4Explorer/Explorer.html +++ b/civicrm/ext/api4/ang/api4Explorer/Explorer.html @@ -26,12 +26,26 @@ </div> <div class="panel-body"> <div class="api4-input form-inline"> - <div class="form-control" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-class="{'api4-option-selected': params[name]}" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'bool'"> + <div class="form-control" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-class="{'api4-option-selected': params[name]}" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'bool' && param.default !== null"> <input type="checkbox" id="api4-param-{{ name }}" ng-model="params[name]"/> <label for="api4-param-{{ name }}">{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label> </div> + <div class="form-control" ng-mouseenter="help('selectRowCount', availableParams.select)" ng-mouseleave="help()" ng-class="{'api4-option-selected': isSelectRowCount()}" ng-if="availableParams.select"> + <input type="checkbox" id="api4-param-selectRowCount" ng-checked="isSelectRowCount()" ng-click="selectRowCount()" /> + <label for="api4-param-selectRowCount">SelectRowCount</label> + </div> + </div> + <div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'bool' && param.default === null"> + <label>{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label> + <label class="radio-inline"> + <input type="radio" ng-model="params[name]" ng-value="true" />true + </label> + <label class="radio-inline"> + <input type="radio" ng-model="params[name]" ng-value="false" />false + </label> + <a href class="crm-hover-button" title="Clear" ng-click="clearParam(name)" ng-show="params[name] !== null"><i class="crm-i fa-times"></i></a> </div> - <div class="api4-input form-inline" ng-mouseenter="help('select', availableParams.select)" ng-mouseleave="help()" ng-if="availableParams.select"> + <div class="api4-input form-inline" ng-mouseenter="help('select', availableParams.select)" ng-mouseleave="help()" ng-if="availableParams.select && !isSelectRowCount()"> <label for="api4-param-select">select<span class="crm-marker" ng-if="availableParams.select.required"> *</span></label> <input class="collapsible-optgroups form-control" ng-list crm-ui-select="{data: fieldsAndJoins, multiple: true}" id="api4-param-select" ng-model="params.select" style="width: 85%;"/> </div> @@ -45,10 +59,11 @@ </div> <div class="api4-input form-inline" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && (param.type[0] === 'string' || param.type[0] === 'int')"> <label for="api4-param-{{ name }}">{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label> - <input class="form-control" type="{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{ name }}" ng-model="params[name]"/> + <input class="form-control" ng-if="!param.options" type="{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{ name }}" ng-model="params[name]"/> + <select class="form-control" ng-if="param.options" ng-options="o for o in param.options" id="api4-param-{{ name }}" ng-model="params[name]"></select> <a href class="crm-hover-button" title="Clear" ng-click="clearParam(name)" ng-show="!!params[name]"><i class="crm-i fa-times"></i></a> </div> - <div class="api4-input" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && param.type[0] === 'array'"> + <div class="api4-input" ng-mouseenter="help(name, param)" ng-mouseleave="help()" ng-repeat="(name, param) in availableParams" ng-if="!isSpecial(name) && (param.type[0] === 'array' || param.type[0] === 'mixed')"> <label for="api4-param-{{ name }}">{{ name }}<span class="crm-marker" ng-if="param.required"> *</span></label> <textarea class="form-control" type="{{ param.type[0] === 'int' && param.type.length === 1 ? 'number' : 'text' }}" id="api4-param-{{ name }}" ng-model="params[name]"> </textarea> @@ -57,7 +72,7 @@ </fieldset> <fieldset ng-if="availableParams.values" ng-mouseenter="help('values', availableParams.values)" ng-mouseleave="help()"> <legend>values<span class="crm-marker" ng-if="availableParams.values.required"> *</span></legend> - <div class="api4-input form-inline" ng-repeat="clause in params.values"> + <div class="api4-input form-inline" ng-repeat="clause in params.values" ng-mouseenter="help('value: ' + clause[0], fieldHelp(clause[0]))" ng-mouseleave="help('values', availableParams.values)"> <input class="collapsible-optgroups form-control" ng-model="clause[0]" crm-ui-select="{formatResult: formatSelect2Item, formatSelection: formatSelect2Item, data: valuesFields, allowClear: true, placeholder: 'Field'}" /> <input class="form-control" ng-model="clause[1]" api4-exp-value="{field: clause[0]}" /> </div> @@ -111,8 +126,8 @@ <div class="panel-body"> <table> <tr ng-repeat="(type, item) in code"> - <td>{{ type }}</td> - <td><pre>{{ item }}</pre></td> + <td>{{ codeLabel[type] }}</td> + <td><pre class="prettyprint" ng-bind-html="item"></pre></td> </tr> </table> </div> @@ -128,7 +143,7 @@ </h3> </div> <div class="panel-body"> - <pre ng-repeat="code in result">{{ code }}</pre> + <pre class="prettyprint" ng-repeat="code in result" ng-bind-html="code"></pre> </div> </div> </div> diff --git a/civicrm/ext/api4/ang/api4Explorer/Explorer.js b/civicrm/ext/api4/ang/api4Explorer/Explorer.js index 103917939e633821a6db31f5515e6770ef164ef9..c7e08dd9605382a92b3e26629ff68dbc9acfdb11 100644 --- a/civicrm/ext/api4/ang/api4Explorer/Explorer.js +++ b/civicrm/ext/api4/ang/api4Explorer/Explorer.js @@ -1,9 +1,9 @@ (function(angular, $, _, undefined) { - // Cache schema metadata - var schema = []; - // Cache fk schema data - var links = []; + // Schema metadata + var schema = CRM.vars.api4.schema; + // FK schema data + var links = CRM.vars.api4.links; // Cache list of entities var entities = []; // Cache list of actions @@ -20,7 +20,7 @@ }); }); - angular.module('api4Explorer').controller('Api4Explorer', function($scope, $routeParams, $location, $timeout, crmUiHelp, crmApi4) { + angular.module('api4Explorer').controller('Api4Explorer', function($scope, $routeParams, $location, $timeout, $http, crmUiHelp, crmApi4) { var ts = $scope.ts = CRM.ts('api4'); $scope.entities = entities; $scope.actions = actions; @@ -29,10 +29,7 @@ $scope.availableParams = {}; $scope.params = {}; $scope.index = ''; - var getMetaParams = schema.length ? {} : { - schema: ['Entity', 'get', {chain: {fields: ['$name', 'getFields']}}], - links: ['Entity', 'getLinks'] - }, + var getMetaParams = {}, objectParams = {orderBy: 'ASC', values: '', chain: ['Entity', '', '{}']}, helpTitle = '', helpContent = {}; @@ -43,11 +40,23 @@ $scope.status = 'default'; $scope.loading = false; $scope.controls = {}; - $scope.code = { - php: '', - javascript: '', - cli: '' + $scope.codeLabel = { + oop: ts('PHP (oop style)'), + php: ts('PHP (traditional)'), + js: ts('Javascript'), + cli: ts('Command Line') }; + $scope.code = codeDefaults(); + + function codeDefaults() { + return _.mapValues($scope.codeLabel, function(val, key) { + return key === 'oop' ? ts('Select an entity and action') : ''; + }); + } + + if (!entities.length) { + formatForSelect2(schema, entities, 'name', ['description']); + } $scope.$bindToRoute({ expr: 'index', @@ -129,6 +138,26 @@ } }; + $scope.fieldHelp = function(fieldName) { + var field = getField(fieldName, $scope.entity, $scope.action); + if (!field) { + return; + } + var info = { + description: field.description, + type: field.data_type + }; + if (field.default_value) { + info.default = field.default_value; + } + if (field.required_if) { + info.required_if = field.required_if; + } else if (field.required) { + info.required = 'true'; + } + return info; + }; + $scope.valuesFields = function() { var fields = _.cloneDeep($scope.fields); // Disable fields that are already in use @@ -153,6 +182,21 @@ return _.contains(specialParams, name); }; + $scope.selectRowCount = function() { + if ($scope.isSelectRowCount()) { + $scope.params.select = []; + } else { + $scope.params.select = ['row_count']; + if ($scope.params.limit == 25) { + $scope.params.limit = 0; + } + } + }; + + $scope.isSelectRowCount = function() { + return $scope.params && $scope.params.select && $scope.params.select.length === 1 && $scope.params.select[0] === 'row_count'; + }; + function getEntity(entityName) { return _.findWhere(schema, {name: entityName || $scope.entity}); } @@ -173,33 +217,24 @@ if (params[key]) { var newParam = {}; _.each(params[key], function(item) { - newParam[item[0]] = parseYaml(_.cloneDeep(item[1])); + var val = _.cloneDeep(item[1]); + // Remove blank items from "chain" array + if (_.isArray(val)) { + _.eachRight(item[1], function(v, k) { + if (v) { + return false; + } + val.length--; + }); + } + newParam[item[0]] = parseYaml(val); }); params[key] = newParam; } }); - if (params.where) { - formatWhereClause(params.where); - } return params; } - // Coerce value to an array when the operator is IN or NOT IN - // Note this has already been passed through parseYaml once - function formatWhereClause(where) { - _.each(where, function(clause) { - if (_.isArray(clause)) { - if (clause.length === 3) { - if (_.contains(['IN', 'NOT IN'], clause[1]) && (_.isNumber(clause[2]) || (_.isString(clause[2]) && clause[2].length))) { - clause[2] = parseYaml('[' + clause[2] + ']'); - } - } else { - formatWhereClause(clause); - } - } - }); - } - function parseYaml(input) { if (typeof input === 'undefined') { return undefined; @@ -211,7 +246,9 @@ return input; } try { - return input === '>' ? '>' : jsyaml.safeLoad(input); + var output = (input === '>') ? '>' : jsyaml.safeLoad(input); + // We don't want dates parsed to js objects + return _.isDate(output) ? input : output; } catch (e) { return input; } @@ -220,7 +257,9 @@ function selectAction() { $scope.action = $routeParams.api4action; $scope.fieldsAndJoins = []; - formatForSelect2(getEntity().actions, actions, 'name', ['description', 'params']); + if (!actions.length) { + formatForSelect2(getEntity().actions, actions, 'name', ['description', 'params']); + } if ($scope.action) { var actionInfo = _.findWhere(actions, {id: $scope.action}); $scope.fields = getFieldList(); @@ -313,11 +352,7 @@ } function writeCode() { - var code = { - php: ts('Select an entity and action'), - javascript: '', - cli: '' - }, + var code = codeDefaults(), entity = $scope.entity, action = $scope.action, params = getParams(), @@ -330,67 +365,89 @@ } var results = lcfirst(_.isNumber(index) ? result : pluralize(result)), paramCount = _.size(params), + isSelectRowCount = params.select && params.select.length === 1 && params.select[0] === 'row_count', i = 0; + if (isSelectRowCount) { + results = result + 'Count'; + } + // Write javascript - code.javascript = "CRM.api4('" + entity + "', '" + action + "', {"; + code.js = "CRM.api4('" + entity + "', '" + action + "', {"; _.each(params, function(param, key) { - code.javascript += "\n " + key + ': ' + stringify(param) + + code.js += "\n " + key + ': ' + stringify(param) + (++i < paramCount ? ',' : ''); if (key === 'checkPermissions') { - code.javascript += ' // IGNORED: permissions are always enforced from client-side requests'; + code.js += ' // IGNORED: permissions are always enforced from client-side requests'; } }); - code.javascript += "\n}"; + code.js += "\n}"; if (index || index === 0) { - code.javascript += ', ' + JSON.stringify(index); + code.js += ', ' + JSON.stringify(index); } - code.javascript += ").then(function(" + results + ") {\n // do something with " + results + " array\n}, function(failure) {\n // handle failure\n});"; + code.js += ").then(function(" + results + ") {\n // do something with " + results + " array\n}, function(failure) {\n // handle failure\n});"; // Write php code + code.php = '$' + results + " = civicrm_api4('" + entity + "', '" + action + "', ["; + _.each(params, function(param, key) { + code.php += "\n '" + key + "' => " + phpFormat(param, 4) + ','; + }); + code.php += "\n]"; + if (index || index === 0) { + code.php += ', ' + phpFormat(index); + } + code.php += ");"; + + // Write oop code if (entity.substr(0, 7) !== 'Custom_') { - code.php = '$' + results + " = \\Civi\\Api4\\" + entity + '::' + action + '()'; + code.oop = '$' + results + " = \\Civi\\Api4\\" + entity + '::' + action + '()'; } else { - code.php = '$' + results + " = \\Civi\\Api4\\CustomValue::" + action + "('" + entity.substr(7) + "')"; + code.oop = '$' + results + " = \\Civi\\Api4\\CustomValue::" + action + "('" + entity.substr(7) + "')"; } _.each(params, function(param, key) { var val = ''; if (typeof objectParams[key] !== 'undefined' && key !== 'chain') { _.each(param, function(item, index) { val = phpFormat(index) + ', ' + phpFormat(item, 4); - code.php += "\n ->add" + ucfirst(key).replace(/s$/, '') + '(' + val + ')'; + code.oop += "\n ->add" + ucfirst(key).replace(/s$/, '') + '(' + val + ')'; }); } else if (key === 'where') { _.each(param, function (clause) { if (clause[0] === 'AND' || clause[0] === 'OR' || clause[0] === 'NOT') { - code.php += "\n ->addClause(" + phpFormat(clause[0]) + ", " + phpFormat(clause[1]).slice(1, -1) + ')'; + code.oop += "\n ->addClause(" + phpFormat(clause[0]) + ", " + phpFormat(clause[1]).slice(1, -1) + ')'; } else { - code.php += "\n ->addWhere(" + phpFormat(clause).slice(1, -1) + ")"; + code.oop += "\n ->addWhere(" + phpFormat(clause).slice(1, -1) + ")"; } }); + } else if (key === 'select' && isSelectRowCount) { + code.oop += "\n ->selectRowCount()"; } else { - code.php += "\n ->set" + ucfirst(key) + '(' + phpFormat(param, 4) + ')'; + code.oop += "\n ->set" + ucfirst(key) + '(' + phpFormat(param, 4) + ')'; } }); - code.php += "\n ->execute()"; + code.oop += "\n ->execute()"; if (_.isNumber(index)) { - code.php += !index ? '\n ->first()' : (index === -1 ? '\n ->last()' : '\n ->itemAt(' + index + ')'); + code.oop += !index ? '\n ->first()' : (index === -1 ? '\n ->last()' : '\n ->itemAt(' + index + ')'); } else if (index) { - code.php += "\n ->indexBy('" + index + "')"; + code.oop += "\n ->indexBy('" + index + "')"; + } else if (isSelectRowCount) { + code.oop += "\n ->count()"; } - code.php += ";\n"; - if (!_.isNumber(index)) { - code.php += "foreach ($" + results + ' as $' + ((_.isString(index) && index) ? index + ' => $' : '') + result + ') {\n // do something\n}'; + code.oop += ";\n"; + if (!_.isNumber(index) && !isSelectRowCount) { + code.oop += "foreach ($" + results + ' as $' + ((_.isString(index) && index) ? index + ' => $' : '') + result + ') {\n // do something\n}'; } // Write cli code code.cli = 'cv api4 ' + entity + '.' + action + " '" + stringify(params) + "'"; } - $scope.code = code; + _.each(code, function(val, type) { + $scope.code[type] = prettyPrintOne(val); + }); } function isInt(value) { - if (_.isNumber(value)) { + if (_.isFinite(value)) { return true; } if (!_.isString(value)) { @@ -399,24 +456,30 @@ return /^-{0,1}\d+$/.test(value); } + function formatMeta(resp) { + var ret = ''; + _.each(resp, function(val, key) { + if (key !== 'values' && !_.isPlainObject(val) && !_.isFunction(val)) { + ret += (ret.length ? ', ' : '') + key + ': ' + (_.isArray(val) ? '[' + val + ']' : val); + } + }); + return prettyPrintOne(ret); + } + $scope.execute = function() { $scope.status = 'warning'; $scope.loading = true; - crmApi4($scope.entity, $scope.action, getParams(), $scope.index) - .then(function(data) { - var meta = {length: _.size(data)}, - result = JSON.stringify(data, null, 2); - if (_.isArray(data)) { - data.length = 0; - _.assign(meta, data); - } + $http.get(CRM.url('civicrm/ajax/api4/' + $scope.entity + '/' + $scope.action, { + params: angular.toJson(getParams()), + index: $scope.index + })).then(function(resp) { $scope.loading = false; $scope.status = 'success'; - $scope.result = [JSON.stringify(meta).replace('{', '').replace(/}$/, ''), result]; - }, function(data) { + $scope.result = [formatMeta(resp.data), prettyPrintOne(JSON.stringify(resp.data.values, null, 2), 'js', 1)]; + }, function(resp) { $scope.loading = false; $scope.status = 'danger'; - $scope.result = [JSON.stringify(data, null, 2)]; + $scope.result = [formatMeta(resp), prettyPrintOne(JSON.stringify(resp.data, null, 2))]; }); }; @@ -430,18 +493,19 @@ indent = (typeof indent === 'number') ? _.repeat(' ', indent) : (indent || ''); var ret = '', baseLine = indent ? indent.slice(0, -2) : '', - newLine = indent ? '\n' : ''; + newLine = indent ? '\n' : '', + trailingComma = indent ? ',' : ''; if ($.isPlainObject(val)) { $.each(val, function(k, v) { ret += (ret ? ', ' : '') + newLine + indent + "'" + k + "' => " + phpFormat(v); }); - return '[' + ret + newLine + baseLine + ']'; + return '[' + ret + trailingComma + newLine + baseLine + ']'; } if ($.isArray(val)) { $.each(val, function(k, v) { ret += (ret ? ', ' : '') + newLine + indent + phpFormat(v); }); - return '[' + ret + newLine + baseLine + ']'; + return '[' + ret + trailingComma + newLine + baseLine + ']'; } if (_.isString(val) && !_.contains(val, "'")) { return "'" + val + "'"; @@ -452,17 +516,6 @@ function fetchMeta() { crmApi4(getMetaParams) .then(function(data) { - if (data.schema) { - schema = data.schema; - entities.length = 0; - formatForSelect2(schema, entities, 'name', ['description']); - if ($scope.entity && !$scope.action) { - showEntityHelp($scope.entity); - } - } - if (data.links) { - links = data.links; - } if (data.actions) { getEntity().actions = data.actions; selectAction(); @@ -483,20 +536,14 @@ if (!$scope.entity) { $scope.helpTitle = helpTitle = ts('Help'); $scope.helpContent = helpContent = {description: ts('Welcome to the api explorer.'), comment: ts('Select an entity to begin.')}; - if (getMetaParams.schema) { - fetchMeta(); - } - } else if (!actions.length && (!schema.length || !getEntity().actions)) { - if (getMetaParams.schema) { - entities.push({id: $scope.entity, text: $scope.entity}); - } + } else if (!actions.length && !getEntity().actions) { getMetaParams.actions = [$scope.entity, 'getActions', {chain: {fields: [$scope.entity, 'getFields', {action: '$name'}]}}]; fetchMeta(); } else { selectAction(); } - if ($scope.entity && schema.length) { + if ($scope.entity) { showEntityHelp($scope.entity); } @@ -591,28 +638,12 @@ scope: { data: '=api4ExpValue' }, - link: function (scope, element, attrs) { + require: 'ngModel', + link: function (scope, element, attrs, ctrl) { var ts = scope.ts = CRM.ts('api4'), - entity = $routeParams.api4entity; - - function getField(fieldName) { - var fieldNames = fieldName.split('.'); - return get(entity, fieldNames); - - function get(entity, fieldNames) { - if (fieldNames.length === 1) { - return _.findWhere(entityFields(entity), {name: fieldNames[0]}); - } - var comboName = _.findWhere(entityFields(entity), {name: fieldNames[0] + '.' + fieldNames[1]}); - if (comboName) { - return comboName; - } - var linkName = fieldNames.shift(), - entityLinks = _.findWhere(links, {entity: entity}).links, - newEntity = _.findWhere(entityLinks, {alias: linkName}).entity; - return get(newEntity, fieldNames); - } - } + multi = _.includes(['IN', 'NOT IN'], scope.data.op), + entity = $routeParams.api4entity, + action = $routeParams.api4action; function destroyWidget() { var $el = $(element); @@ -627,22 +658,26 @@ function makeWidget(field, op) { var $el = $(element), - dataType = field.data_type, - multi = _.includes(['IN', 'NOT IN'], op); + inputType = field.input_type; + dataType = field.data_type; + if (!op) { + op = field.serialize || dataType === 'Array' ? 'IN' : '='; + } + multi = _.includes(['IN', 'NOT IN'], op); if (op === 'IS NULL' || op === 'IS NOT NULL') { $el.hide(); return; } - if (dataType === 'Timestamp' || dataType === 'Date') { + if (inputType === 'Date') { if (_.includes(['=', '!=', '<>', '<', '>=', '<', '<='], op)) { - $el.crmDatepicker({time: dataType === 'Timestamp'}); + $el.crmDatepicker({time: (field.input_attrs && field.input_attrs.time) || false}); } - } else if (_.includes(['=', '!=', '<>', 'IN', 'NOT IN'], op)) { + } else if (_.includes(['=', '!=', '<>', 'IN', 'NOT IN'], op) && (field.fk_entity || field.options || dataType === 'Boolean')) { if (field.fk_entity) { $el.crmEntityRef({entity: field.fk_entity, select:{multiple: multi}}); } else if (field.options) { $el.addClass('loading').attr('placeholder', ts('- select -')).crmSelect2({multiple: multi, data: [{id: '', text: ''}]}); - loadFieldOptions(field.entity).then(function(data) { + loadFieldOptions(field.entity || entity).then(function(data) { var options = []; _.each(_.findWhere(data, {name: field.name}).options, function(val, key) { options.push({id: key, text: val}); @@ -655,11 +690,12 @@ {id: '0', text: ts('No')} ]}); } + } else if (dataType === 'Integer') { + $el.attr('type', 'number'); } } function loadFieldOptions(entity) { - var action = $routeParams.api4action; if (!fieldOptions[entity + action]) { fieldOptions[entity + action] = crmApi4(entity, 'getFields', { loadOptions: true, @@ -671,11 +707,42 @@ return fieldOptions[entity + action]; } + // Copied from ng-list but applied conditionally if field is multi-valued + var parseList = function(viewValue) { + // If the viewValue is invalid (say required but empty) it will be `undefined` + if (_.isUndefined(viewValue)) return; + + if (!multi) { + return viewValue; + } + + var list = []; + + if (viewValue) { + _.each(viewValue.split(','), function(value) { + if (value) list.push(_.trim(value)); + }); + } + + return list; + }; + + // Copied from ng-list + ctrl.$parsers.push(parseList); + ctrl.$formatters.push(function(value) { + return _.isArray(value) ? value.join(', ') : value; + }); + + // Copied from ng-list + ctrl.$isEmpty = function(value) { + return !value || !value.length; + }; + scope.$watchCollection('data', function(data) { destroyWidget(); - var field = getField(data.field); + var field = getField(data.field, entity, action); if (field) { - makeWidget(field, data.op || '='); + makeWidget(field, data.op); } }); } @@ -749,6 +816,9 @@ } else if (link && _.contains(['create'], newAction)) { scope.chain[1][2] = '{values: {' + link[0] + ': ' + link[1] + '}}'; + } + else if (link && _.contains(['save'], newAction)) { + scope.chain[1][2] = '{records: [{' + link[0] + ': ' + link[1] + '}]}'; } else { scope.chain[1][2] = '{}'; } @@ -765,8 +835,31 @@ return _.findWhere(schema, {name: entityName}); } - function entityFields(entityName) { - return _.result(getEntity(entityName), 'fields'); + function entityFields(entityName, action) { + var entity = getEntity(entityName); + if (entity && action && entity.actions) { + return _.findWhere(entity.actions, {name: action}).fields; + } + return _.result(entity, 'fields'); + } + + function getField(fieldName, entity, action) { + var fieldNames = fieldName.split('.'); + return get(entity, fieldNames); + + function get(entity, fieldNames) { + if (fieldNames.length === 1) { + return _.findWhere(entityFields(entity, action), {name: fieldNames[0]}); + } + var comboName = _.findWhere(entityFields(entity, action), {name: fieldNames[0] + '.' + fieldNames[1]}); + if (comboName) { + return comboName; + } + var linkName = fieldNames.shift(), + entityLinks = _.findWhere(links, {entity: entity}).links, + newEntity = _.findWhere(entityLinks, {alias: linkName}).entity; + return get(newEntity, fieldNames); + } } // Collapsible optgroups for select2 diff --git a/civicrm/ext/api4/api4.php b/civicrm/ext/api4/api4.php index 7d10d492be7107f6197a532807058e708bd00836..d47872d0e5e11ce59fac978f7fb34435fb599b10 100644 --- a/civicrm/ext/api4/api4.php +++ b/civicrm/ext/api4/api4.php @@ -3,89 +3,57 @@ require_once 'api4.civix.php'; require_once 'api/Exception.php'; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\Config\FileLocator; - if (!is_callable('civicrm_api4')) { -/** - * Procedural wrapper for the OO api version 4. - * - * @param string $entity - * @param string $action - * @param array $params - * @param string|int $index - * If $index is a string, the results array will be indexed by that key. - * If $index is an integer, only the result at that index will be returned. - * - * @return \Civi\Api4\Generic\Result - * @throws \API_Exception - * @throws \Civi\API\Exception\NotImplementedException - */ -function civicrm_api4($entity, $action, $params = [], $index = NULL) { - $apiCall = \Civi\Api4\Utils\ActionUtil::getAction($entity, $action); - foreach ($params as $name => $param) { - $setter = 'set' . ucfirst($name); - $apiCall->$setter($param); - } - $result = $apiCall->execute(); - - // Index results by key - if ($index && is_string($index) && !CRM_Utils_Rule::integer($index)) { - $result->indexBy($index); - } - // Return result at index - if (CRM_Utils_Rule::integer($index)) { - $item = $result->itemAt($index); - if (is_null($item)) { - throw new \API_Exception("Index $index not found in api results"); + /** + * Procedural wrapper for the OO api version 4. + * + * @param string $entity + * @param string $action + * @param array $params + * @param string|int $index + * If $index is a string, the results array will be indexed by that key. + * If $index is an integer, only the result at that index will be returned. + * + * @return \Civi\Api4\Generic\Result + * @throws \API_Exception + * @throws \Civi\API\Exception\NotImplementedException + */ + function civicrm_api4($entity, $action, $params = [], $index = NULL) { + $apiCall = \Civi\Api4\Utils\ActionUtil::getAction($entity, $action); + foreach ($params as $name => $param) { + $setter = 'set' . ucfirst($name); + $apiCall->$setter($param); } - $result->exchangeArray($item); - - } - return $result; -} + $result = $apiCall->execute(); -/** - * @param ContainerBuilder $container - */ -function api4_civicrm_container($container) { - $loader = new XmlFileLoader($container, new FileLocator(__DIR__)); - $loader->load('services.xml'); - - $container->getDefinition('civi_api_kernel')->addMethodCall( - 'registerApiProvider', - [new Reference('action_object_provider')] - ); - - // add event subscribers$container->get( - $dispatcher = $container->getDefinition('dispatcher'); - $subscribers = $container->findTaggedServiceIds('event_subscriber'); - - foreach (array_keys($subscribers) as $subscriber) { - $dispatcher->addMethodCall( - 'addSubscriber', - [new Reference($subscriber)] - ); - } - - // add spec providers - $providers = $container->findTaggedServiceIds('spec_provider'); - $gatherer = $container->getDefinition('spec_gatherer'); + // Index results by key + if ($index && is_string($index) && !CRM_Utils_Rule::integer($index)) { + $result->indexBy($index); + } + // Return result at index + if (CRM_Utils_Rule::integer($index)) { + $item = $result->itemAt($index); + if (is_null($item)) { + throw new \API_Exception("Index $index not found in api results"); + } + // Attempt to return a Result object if item is array, otherwise just return the item + if (!is_array($item)) { + return $item; + } + $result->exchangeArray($item); - foreach (array_keys($providers) as $provider) { - $gatherer->addMethodCall( - 'addSpecProvider', - [new Reference($provider)] - ); + } + return $result; } - if (defined('CIVICRM_UF') && CIVICRM_UF === 'UnitTests') { - $loader->load('tests/services.xml'); + /** + * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + */ + function api4_civicrm_container($container) { + require_once __DIR__ . '/CRM/Api4/Services.php'; + CRM_Api4_Services::hook_container($container); } -} } diff --git a/civicrm/ext/api4/css/explorer.css b/civicrm/ext/api4/css/explorer.css index 0a5f5d17bb5dc5cc97904384081e24c741751960..a5be9c8a0655656cf9b12cc9a4dc15e58cfd7a1d 100644 --- a/civicrm/ext/api4/css/explorer.css +++ b/civicrm/ext/api4/css/explorer.css @@ -41,6 +41,10 @@ margin-bottom: 10px; } +#bootstrap-theme.api4-explorer-page .api4-input.form-inline > label { + margin-right: 12px; +} + #bootstrap-theme.api4-explorer-page .explorer-help-panel .panel-body { word-break: break-word; } diff --git a/civicrm/ext/api4/info.xml b/civicrm/ext/api4/info.xml index c61180bdd48f6f8d14bebef935108d26c532763f..59ffd4069c484fac72a7daacece208b294c61b6b 100644 --- a/civicrm/ext/api4/info.xml +++ b/civicrm/ext/api4/info.xml @@ -13,11 +13,11 @@ <url desc="Documentation">https://wiki.civicrm.org/confluence/display/CRM/API+v4+Spec</url> <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url> </urls> - <releaseDate>2019-09-16</releaseDate> - <version>4.4.3</version> + <releaseDate>2019-11-17</releaseDate> + <version>4.5.2</version> <develStage>stable</develStage> <compatibility> - <ver>5.13</ver> + <ver>5.18</ver> </compatibility> <comments>This extension does nothing on its own. Install it if other extensions require you to do so.</comments> <classloader> diff --git a/civicrm/ext/api4/services.xml b/civicrm/ext/api4/services.xml deleted file mode 100644 index 24d0b061a0668e4d92762e252d9ed370f8e3ade0..0000000000000000000000000000000000000000 --- a/civicrm/ext/api4/services.xml +++ /dev/null @@ -1,122 +0,0 @@ -<container xmlns="http://symfony.com/schema/dic/services" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - - <services> - - <service id="spec_gatherer" class="Civi\Api4\Service\Spec\SpecGatherer"/> - - <service id="schema_map_builder" class="Civi\Api4\Service\Schema\SchemaMapBuilder" public="false"> - <argument type="service" id="dispatcher" /> - </service> - - <service id="schema_map" class="Civi\Api4\Service\Schema\SchemaMap"> - <factory service="schema_map_builder" method="build"/> - </service> - - <service id="joiner" class="Civi\Api4\Service\Schema\Joiner"> - <argument type="service" id="schema_map"/> - </service> - - <service id="action_object_provider" class="Civi\Api4\Provider\ActionObjectProvider"> - <tag name="event_subscriber"/> - </service> - - <service id="contact_creation.spec_provider" class="Civi\Api4\Service\Spec\Provider\ContactCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\ContactTypeCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\AddressCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service id="option_value_creation.spec_provider" class="Civi\Api4\Service\Spec\Provider\OptionValueCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\ActivityCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\ActionScheduleCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\EmailCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\PhoneCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\EventCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\NoteCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\ContributionCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\CustomGroupCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\GroupCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\NavigationCreationSpecProvider"> - <tag name="spec_provider"/> - </service> - - <service id="custom_group.pre_creation.subscriber" class="Civi\Api4\Event\Subscriber\CustomGroupPreCreationSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="custom_field.pre_creation.subsciber" class="Civi\Api4\Event\Subscriber\CustomFieldPreCreationSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="option_value.pre_creation.subscriber" class="Civi\Api4\Event\Subscriber\OptionValuePreCreationSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="activity.pre_creation.subscriber" class="Civi\Api4\Event\Subscriber\ActivityPreCreationSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="contact.schema_map.subscriber" class="Civi\Api4\Event\Subscriber\ContactSchemaMapSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="activity.schema_map.subscriber" class="Civi\Api4\Event\Subscriber\ActivitySchemaMapSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="api4.permission_check.subscriber" class="Civi\Api4\Event\Subscriber\PermissionCheckSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="api4.required_fields.subscriber" class="Civi\Api4\Event\Subscriber\ValidateFieldsSubscriber"> - <tag name="event_subscriber"/> - </service> - - <service id="api4.post_select_query.subscriber" class="Civi\Api4\Event\Subscriber\PostSelectQuerySubscriber"> - <tag name="event_subscriber"/> - </service> - - <service class="Civi\Api4\Service\Spec\Provider\CustomValueSpecProvider"> - <tag name="spec_provider"/> - </service> - - </services> -</container> diff --git a/civicrm/ext/api4/tests/phpunit/Action/UpdateContactTest.php b/civicrm/ext/api4/tests/phpunit/Action/UpdateContactTest.php deleted file mode 100644 index 71265598a6633df432a35511f225a4ff02bf70f9..0000000000000000000000000000000000000000 --- a/civicrm/ext/api4/tests/phpunit/Action/UpdateContactTest.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php - -namespace Civi\Test\Api4\Action; - -use Civi\Api4\Contact; -use Civi\Test\Api4\UnitTestCase; - -/** - * Class UpdateContactTest - * @package Civi\Test\Api4\Action - * @group headless - */ -class UpdateContactTest extends UnitTestCase { - - public function testUpdateWillWork() { - $contactId = Contact::create() - ->setCheckPermissions(FALSE) - ->addValue('first_name', 'Johann') - ->addValue('last_name', 'Tester') - ->addValue('contact_type', 'Individual') - ->execute() - ->first()['id']; - - $contact = Contact::update() - ->setCheckPermissions(FALSE) - ->addWhere('id', '=', $contactId) - ->addValue('first_name', 'Testy') - ->execute() - ->first(); - $this->assertEquals('Testy', $contact['first_name']); - $this->assertEquals('Tester', $contact['last_name']); - } - -} diff --git a/civicrm/ext/api4/tests/phpunit/Action/BaseCustomValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BaseCustomValueTest.php similarity index 74% rename from civicrm/ext/api4/tests/phpunit/Action/BaseCustomValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/BaseCustomValueTest.php index 41fe7281c1a69c4715032a2d5f64f18e769c81d5..fd4dc717c809cd4bd3d569c8d85eb08fc50239fb 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/BaseCustomValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BaseCustomValueTest.php @@ -1,13 +1,13 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; -use Civi\Test\Api4\Traits\TableDropperTrait; +use api\v4\UnitTestCase; +use api\v4\Traits\TableDropperTrait; abstract class BaseCustomValueTest extends UnitTestCase { - use \Civi\Test\Api4\Traits\OptionCleanupTrait { + use \api\v4\Traits\OptionCleanupTrait { setUp as setUpOptionCleanup; } use TableDropperTrait; diff --git a/civicrm/ext/api4/tests/phpunit/Action/BasicActionsTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicActionsTest.php similarity index 62% rename from civicrm/ext/api4/tests/phpunit/Action/BasicActionsTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicActionsTest.php index 2952338914636b7323cd405a0ec4fbb0182b3b20..18e76e5589c0e116a5a87c7210129f0e97c64f3e 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/BasicActionsTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicActionsTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\MockBasicEntity; /** @@ -20,8 +20,8 @@ class BasicActionsTest extends UnitTestCase { $id2 = MockBasicEntity::create()->addValue('foo', 'two')->execute()->first()['id']; - $result = MockBasicEntity::get()->execute(); - $this->assertCount(2, $result); + $result = MockBasicEntity::get()->selectRowCount()->execute(); + $this->assertEquals(2, $result->count()); MockBasicEntity::update()->addWhere('id', '=', $id2)->addValue('foo', 'new')->execute(); @@ -29,9 +29,27 @@ class BasicActionsTest extends UnitTestCase { $this->assertCount(1, $result); $this->assertEquals('new', $result->first()['foo']); + $result = MockBasicEntity::save() + ->addRecord(['id' => $id1, 'foo' => 'one updated']) + ->addRecord(['id' => $id2]) + ->addRecord(['foo' => 'three']) + ->addDefault('color', 'pink') + ->setReload(TRUE) + ->execute() + ->indexBy('id'); + + $this->assertEquals('new', $result[$id2]['foo']); + $this->assertEquals('three', $result->last()['foo']); + $this->assertCount(3, $result); + foreach ($result as $item) { + $this->assertEquals('pink', $item['color']); + } + + $this->assertEquals('one updated', MockBasicEntity::get()->addWhere('id', '=', $id1)->execute()->first()['foo']); + MockBasicEntity::delete()->addWhere('id', '=', $id2); $result = MockBasicEntity::get()->execute(); - $this->assertEquals('one', $result->first()['foo']); + $this->assertEquals('one updated', $result->first()['foo']); } public function testReplace() { @@ -52,7 +70,7 @@ class BasicActionsTest extends UnitTestCase { $replacements = [ ['color' => 'red', 'id' => $objects[0]['id']], ['color' => 'not blue', 'id' => $objects[1]['id']], - ['color' => 'yellow'] + ['color' => 'yellow'], ]; MockBasicEntity::replace()->addWhere('group', '=', 'one')->setRecords($replacements)->execute(); @@ -115,40 +133,51 @@ class BasicActionsTest extends UnitTestCase { ->addWhere('color', 'NOT IN', ['yellow']) ->addWhere('color', 'IN', ['red', 'blue']) ->addWhere('color', '!=', 'green') - ->addWhere('group', '=', 'one'); - - $this->assertEquals(['red', 'blue'], $get->_itemsToGet('color')); - $this->assertEquals(['one'], $get->_itemsToGet('group')); + ->addWhere('group', '=', 'one') + ->addWhere('size', 'LIKE', 'big') + ->addWhere('shape', 'LIKE', '%a'); + + $itemsToGet = new \ReflectionMethod($get, '_itemsToGet'); + $itemsToGet->setAccessible(TRUE); + + $this->assertEquals(['red', 'blue'], $itemsToGet->invoke($get, 'color')); + $this->assertEquals(['one'], $itemsToGet->invoke($get, 'group')); + $this->assertEquals(['big'], $itemsToGet->invoke($get, 'size')); + $this->assertEmpty($itemsToGet->invoke($get, 'shape')); + $this->assertEmpty($itemsToGet->invoke($get, 'weight')); } public function testFieldsToGet() { $get = MockBasicEntity::get() ->addWhere('color', '!=', 'green'); + $isFieldSelected = new \ReflectionMethod($get, '_isFieldSelected'); + $isFieldSelected->setAccessible(TRUE); + // If no "select" is set, should always return true - $this->assertTrue($get->_isFieldSelected('color')); - $this->assertTrue($get->_isFieldSelected('shape')); - $this->assertTrue($get->_isFieldSelected('size')); + $this->assertTrue($isFieldSelected->invoke($get, 'color')); + $this->assertTrue($isFieldSelected->invoke($get, 'shape')); + $this->assertTrue($isFieldSelected->invoke($get, 'size')); // With a non-empty "select" fieldsToSelect() will return fields needed to evaluate each clause. $get->addSelect('id'); - $this->assertTrue($get->_isFieldSelected('color')); - $this->assertTrue($get->_isFieldSelected('id')); - $this->assertFalse($get->_isFieldSelected('shape')); - $this->assertFalse($get->_isFieldSelected('size')); - $this->assertFalse($get->_isFieldSelected('weight')); - $this->assertFalse($get->_isFieldSelected('group')); + $this->assertTrue($isFieldSelected->invoke($get, 'color')); + $this->assertTrue($isFieldSelected->invoke($get, 'id')); + $this->assertFalse($isFieldSelected->invoke($get, 'shape')); + $this->assertFalse($isFieldSelected->invoke($get, 'size')); + $this->assertFalse($isFieldSelected->invoke($get, 'weight')); + $this->assertFalse($isFieldSelected->invoke($get, 'group')); $get->addClause('OR', ['shape', '=', 'round'], ['AND', [['size', '=', 'big'], ['weight', '!=', 'small']]]); - $this->assertTrue($get->_isFieldSelected('color')); - $this->assertTrue($get->_isFieldSelected('id')); - $this->assertTrue($get->_isFieldSelected('shape')); - $this->assertTrue($get->_isFieldSelected('size')); - $this->assertTrue($get->_isFieldSelected('weight')); - $this->assertFalse($get->_isFieldSelected('group')); + $this->assertTrue($isFieldSelected->invoke($get, 'color')); + $this->assertTrue($isFieldSelected->invoke($get, 'id')); + $this->assertTrue($isFieldSelected->invoke($get, 'shape')); + $this->assertTrue($isFieldSelected->invoke($get, 'size')); + $this->assertTrue($isFieldSelected->invoke($get, 'weight')); + $this->assertFalse($isFieldSelected->invoke($get, 'group')); $get->addOrderBy('group'); - $this->assertTrue($get->_isFieldSelected('group')); + $this->assertTrue($isFieldSelected->invoke($get, 'group')); } } diff --git a/civicrm/ext/api4/tests/phpunit/Action/BasicCustomFieldTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php similarity index 99% rename from civicrm/ext/api4/tests/phpunit/Action/BasicCustomFieldTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php index 85687a0858e93b5c430a7d781a15b13b3cf08325..b7ec2c99773d7cbaad668aa5c8fbd3a8017f7127 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/BasicCustomFieldTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/BasicCustomFieldTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\CustomField; diff --git a/civicrm/ext/api4/tests/phpunit/Action/ChainTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ChainTest.php similarity index 95% rename from civicrm/ext/api4/tests/phpunit/Action/ChainTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ChainTest.php index bbd6a09228fbef7e6bd254cb8c4c4c539262d1e8..cd896a8293c35ab2833618db6a3e7e74d799e687 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ChainTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ChainTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -22,7 +22,7 @@ class ChainTest extends UnitTestCase { $entities = \Civi\Api4\Entity::get() ->addSelect('name') ->setChain([ - 'actions' => ['$name', 'getActions', ['select' => ['name']], 'name'] + 'actions' => ['$name', 'getActions', ['select' => ['name']], 'name'], ]) ->execute() ->indexBy('name'); diff --git a/civicrm/ext/api4/tests/phpunit/Action/ComplexQueryTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ComplexQueryTest.php similarity index 96% rename from civicrm/ext/api4/tests/phpunit/Action/ComplexQueryTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ComplexQueryTest.php index 0a320100bacb55f5eabddc438f3f7ca21057d2cb..51fb272d2f88db6afd5b76ab0df10a3f2367984c 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ComplexQueryTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ComplexQueryTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\Activity; /** diff --git a/civicrm/ext/api4/tests/phpunit/Action/ContactApiKeyTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactApiKeyTest.php similarity index 63% rename from civicrm/ext/api4/tests/phpunit/Action/ContactApiKeyTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactApiKeyTest.php index 63d85d55641c97b6cb21cc7c65fee911e31a8215..d607ce05dbeccf41675431a4e30d5a30f90d313a 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ContactApiKeyTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactApiKeyTest.php @@ -1,45 +1,70 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; +use Civi\Api4\Email; /** * @group headless */ -class ContactApiKeyTest extends \Civi\Test\Api4\UnitTestCase { +class ContactApiKeyTest extends \api\v4\UnitTestCase { public function testGetApiKey() { - \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM']; + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'add contacts', 'edit api keys', 'view all contacts', 'edit all contacts']; $key = uniqid(); $contact = Contact::create() - ->setCheckPermissions(FALSE) ->addValue('first_name', 'Api') ->addValue('last_name', 'Key0') ->addValue('api_key', $key) + ->addChain('email', Email::create() + ->addValue('contact_id', '$id') + ->addValue('email', 'test@key.get'), + 0 + ) ->execute() ->first(); + // With sufficient permission we should see the key $result = Contact::get() - ->setCheckPermissions(FALSE) ->addWhere('id', '=', $contact['id']) ->addSelect('api_key') ->execute() ->first(); + $this->assertEquals($key, $result['api_key']); - $this->assertEquals($result['api_key'], $key); + // Can also be fetched via join + $email = Email::get() + ->addSelect('contact.api_key') + ->addWhere('id', '=', $contact['email']['id']) + ->execute()->first(); + $this->assertEquals($key, $email['contact']['api_key']); + // Remove permission and we should not see the key + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM']; $result = Contact::get() ->addWhere('id', '=', $contact['id']) ->addSelect('api_key') ->execute() ->first(); + $this->assertTrue(empty($result['api_key'])); + // Also not available via join + $email = Email::get() + ->addSelect('contact.api_key') + ->addWhere('id', '=', $contact['email']['id']) + ->execute()->first(); + $this->assertTrue(empty($email['contact']['api_key'])); + + $result = Contact::get() + ->addWhere('id', '=', $contact['id']) + ->execute() + ->first(); $this->assertTrue(empty($result['api_key'])); } - public function testCreateWithApiKey() { + public function testCreateWithInsufficientPermissions() { \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'add contacts']; $key = uniqid(); @@ -59,7 +84,7 @@ class ContactApiKeyTest extends \Civi\Test\Api4\UnitTestCase { } public function testUpdateApiKey() { - \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM']; + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit all contacts']; $key = uniqid(); $contact = Contact::create() @@ -113,7 +138,7 @@ class ContactApiKeyTest extends \Civi\Test\Api4\UnitTestCase { } public function testUpdateOwnApiKey() { - \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit own api keys', 'edit my contact']; + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit own api keys', 'edit all contacts']; $key = uniqid(); $contact = Contact::create() @@ -167,4 +192,19 @@ class ContactApiKeyTest extends \Civi\Test\Api4\UnitTestCase { $this->assertEquals($result['api_key'], "MyId!"); } + public function testApiKeyWithGetFields() { + // With sufficient permissions the field should exist + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit api keys']; + $this->assertArrayHasKey('api_key', \civicrm_api4('Contact', 'getFields', [], 'name')); + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'administer CiviCRM']; + $this->assertArrayHasKey('api_key', \civicrm_api4('Contact', 'getFields', [], 'name')); + + // Field hidden from non-privileged users... + \CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM', 'edit own api keys']; + $this->assertArrayNotHasKey('api_key', \civicrm_api4('Contact', 'getFields', [], 'name')); + + // ...unless you disable 'checkPermissions' + $this->assertArrayHasKey('api_key', \civicrm_api4('Contact', 'getFields', ['checkPermissions' => FALSE], 'name')); + } + } diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactChecksumTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactChecksumTest.php new file mode 100644 index 0000000000000000000000000000000000000000..abf65cada2194724deee2c3061b1128d6d715ded --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactChecksumTest.php @@ -0,0 +1,56 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Contact; + +/** + * @group headless + */ +class ContactChecksumTest extends \api\v4\UnitTestCase { + + public function testGetChecksum() { + $contact = Contact::create() + ->setCheckPermissions(FALSE) + ->addValue('first_name', 'Check') + ->addValue('last_name', 'Sum') + ->addChain('cs', Contact::getChecksum()->setContactId('$id')->setTtl(500), 0) + ->execute() + ->first(); + + $result = Contact::validateChecksum() + ->setContactId($contact['id']) + ->setChecksum($contact['cs']['checksum']) + ->execute() + ->first(); + + $this->assertTrue($result['valid']); + } + + public function testValidateChecksum() { + $cid = Contact::create() + ->setCheckPermissions(FALSE) + ->addValue('first_name', 'Checker') + ->addValue('last_name', 'Sum') + ->execute() + ->first()['id']; + + $goodCs = \CRM_Contact_BAO_Contact_Utils::generateChecksum($cid, NULL, 500); + $badCs = \CRM_Contact_BAO_Contact_Utils::generateChecksum($cid, strtotime('now - 1 week'), 1); + + $result1 = Contact::validateChecksum() + ->setContactId($cid) + ->setChecksum($goodCs) + ->execute() + ->first(); + $this->assertTrue($result1['valid']); + + $result2 = Contact::validateChecksum() + ->setContactId($cid) + ->setChecksum($badCs) + ->execute() + ->first(); + $this->assertFalse($result2['valid']); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactGetTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactGetTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e023361dc5ed10366d3ee10bc1c9f36bd8ee5d85 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ContactGetTest.php @@ -0,0 +1,42 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Contact; + +/** + * @group headless + */ +class ContactGetTest extends \api\v4\UnitTestCase { + + public function testGetDeletedContacts() { + $last_name = uniqid('deleteContactTest'); + + $bob = Contact::create() + ->setValues(['first_name' => 'Bob', 'last_name' => $last_name]) + ->execute()->first(); + + $jan = Contact::create() + ->setValues(['first_name' => 'Jan', 'last_name' => $last_name]) + ->execute()->first(); + + $del = Contact::create() + ->setValues(['first_name' => 'Del', 'last_name' => $last_name, 'is_deleted' => 1]) + ->execute()->first(); + + // Deleted contacts are not fetched by default + $this->assertCount(2, Contact::get()->addWhere('last_name', '=', $last_name)->selectRowCount()->execute()); + + // You can search for them specifically + $contacts = Contact::get()->addWhere('last_name', '=', $last_name)->addWhere('is_deleted', '=', 1)->addSelect('id')->execute(); + $this->assertEquals($del['id'], $contacts->first()['id']); + + // Or by id + $this->assertCount(3, Contact::get()->addWhere('id', 'IN', [$bob['id'], $jan['id'], $del['id']])->selectRowCount()->execute()); + + // Putting is_deleted anywhere in the where clause will disable the default + $contacts = Contact::get()->addClause('OR', ['last_name', '=', $last_name], ['is_deleted', '=', 0])->addSelect('id')->execute(); + $this->assertContains($del['id'], $contacts->column('id')); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/Action/CreateCustomValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateCustomValueTest.php similarity index 95% rename from civicrm/ext/api4/tests/phpunit/Action/CreateCustomValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateCustomValueTest.php index 762b46173c22f465b26720146853d54733af37c9..9cb119846dbc2968f290ce7a9ffad6ee4cabb707 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/CreateCustomValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateCustomValueTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; @@ -25,7 +25,7 @@ class CreateCustomValueTest extends BaseCustomValueTest { CustomField::create() ->setCheckPermissions(FALSE) ->addValue('label', 'Color') - ->addValue('options', $optionValues) + ->addValue('option_values', $optionValues) ->addValue('custom_group_id', $customGroup['id']) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') diff --git a/civicrm/ext/api4/tests/phpunit/Action/CreateWithOptionGroupTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/CreateWithOptionGroupTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php index b4d0af85bdebdd8575c9a3397c33fccfa359d45e..c84238818f671ecf905970ffdd6b24b8f792c823 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/CreateWithOptionGroupTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CreateWithOptionGroupTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; @@ -36,7 +36,7 @@ class CreateWithOptionGroupTest extends BaseCustomValueTest { ->setCheckPermissions(FALSE) ->addValue('label', $colorField) ->addValue('name', $colorField) - ->addValue('options', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) + ->addValue('option_values', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') @@ -46,7 +46,7 @@ class CreateWithOptionGroupTest extends BaseCustomValueTest { ->setCheckPermissions(FALSE) ->addValue('label', $foodField) ->addValue('name', $foodField) - ->addValue('options', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) + ->addValue('option_values', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') @@ -114,7 +114,7 @@ class CreateWithOptionGroupTest extends BaseCustomValueTest { ->setCheckPermissions(FALSE) ->addValue('label', $colorField) ->addValue('name', $colorField) - ->addValue('options', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) + ->addValue('option_values', ['r' => 'Red', 'g' => 'Green', 'b' => 'Blue']) ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') @@ -124,7 +124,7 @@ class CreateWithOptionGroupTest extends BaseCustomValueTest { ->setCheckPermissions(FALSE) ->addValue('label', $foodField) ->addValue('name', $foodField) - ->addValue('options', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) + ->addValue('option_values', ['1' => 'Corn', '2' => 'Potatoes', '3' => 'Cheese']) ->addValue('custom_group_id', $customGroupId) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/CurrentFilterTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CurrentFilterTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4034dbed81497bfa0beabc7827ca2671a65f0767 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CurrentFilterTest.php @@ -0,0 +1,71 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Relationship; +use api\v4\UnitTestCase; +use Civi\Api4\Contact; + +/** + * @group headless + */ +class CurrentFilterTest extends UnitTestCase { + + public function testCurrentRelationship() { + $cid1 = Contact::create()->addValue('first_name', 'Bob1')->execute()->first()['id']; + $cid2 = Contact::create()->addValue('first_name', 'Bob2')->execute()->first()['id']; + + $current = Relationship::create()->setValues([ + 'relationship_type_id' => 1, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + 'end_date' => 'now + 1 week', + ])->execute()->first(); + $indefinite = Relationship::create()->setValues([ + 'relationship_type_id' => 2, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + ])->execute()->first(); + $expiring = Relationship::create()->setValues([ + 'relationship_type_id' => 3, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + 'end_date' => 'now', + ])->execute()->first(); + $past = Relationship::create()->setValues([ + 'relationship_type_id' => 3, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + 'end_date' => 'now - 1 week', + ])->execute()->first(); + $inactive = Relationship::create()->setValues([ + 'relationship_type_id' => 4, + 'contact_id_a' => $cid1, + 'contact_id_b' => $cid2, + 'is_active' => 0, + ])->execute()->first(); + + $getCurrent = (array) Relationship::get()->setCurrent(TRUE)->execute()->indexBy('id'); + $notCurrent = (array) Relationship::get()->setCurrent(FALSE)->execute()->indexBy('id'); + $getAll = (array) Relationship::get()->execute()->indexBy('id'); + + $this->assertArrayHasKey($current['id'], $getAll); + $this->assertArrayHasKey($indefinite['id'], $getAll); + $this->assertArrayHasKey($expiring['id'], $getAll); + $this->assertArrayHasKey($past['id'], $getAll); + $this->assertArrayHasKey($inactive['id'], $getAll); + + $this->assertArrayHasKey($current['id'], $getCurrent); + $this->assertArrayHasKey($indefinite['id'], $getCurrent); + $this->assertArrayHasKey($expiring['id'], $getCurrent); + $this->assertArrayNotHasKey($past['id'], $getCurrent); + $this->assertArrayNotHasKey($inactive['id'], $getCurrent); + + $this->assertArrayNotHasKey($current['id'], $notCurrent); + $this->assertArrayNotHasKey($indefinite['id'], $notCurrent); + $this->assertArrayNotHasKey($expiring['id'], $notCurrent); + $this->assertArrayHasKey($past['id'], $notCurrent); + $this->assertArrayHasKey($inactive['id'], $notCurrent); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/Action/CustomValuePerformanceTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php similarity index 97% rename from civicrm/ext/api4/tests/phpunit/Action/CustomValuePerformanceTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php index 3fa59ef465aa57a15a1de6d87fbd0a750091375c..1990f6c8e9d1d21e331d2915d35ccb93d0136196 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/CustomValuePerformanceTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValuePerformanceTest.php @@ -1,11 +1,11 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; -use Civi\Test\Api4\Traits\QueryCounterTrait; +use api\v4\Traits\QueryCounterTrait; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/CustomValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValueTest.php similarity index 90% rename from civicrm/ext/api4/tests/phpunit/Action/CustomValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValueTest.php index da954bc7f412903606ab5d59c7e1c073cd60660c..72d127508a505c6498f1f2265516d095c6142e81 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/CustomValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/CustomValueTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; @@ -22,6 +22,7 @@ class CustomValueTest extends BaseCustomValueTest { $group = uniqid('groupc'); $colorField = uniqid('colorc'); + $textField = uniqid('txt'); $customGroup = CustomGroup::create() ->setCheckPermissions(FALSE) @@ -40,6 +41,14 @@ class CustomValueTest extends BaseCustomValueTest { ->addValue('data_type', 'String') ->execute(); + CustomField::create() + ->setCheckPermissions(FALSE) + ->addValue('label', $textField) + ->addValue('custom_group_id', $customGroup['id']) + ->addValue('html_type', 'Text') + ->addValue('data_type', 'String') + ->execute(); + $this->contactID = Contact::create() ->setCheckPermissions(FALSE) ->addValue('first_name', 'Johann') @@ -55,7 +64,16 @@ class CustomValueTest extends BaseCustomValueTest { 'custom_field_id' => 1, 'custom_group' => $group, 'name' => $colorField, - 'title' => ts($colorField), + 'title' => $colorField, + 'entity' => "Custom_$group", + 'data_type' => 'String', + 'fk_entity' => NULL, + ], + [ + 'custom_field_id' => 2, + 'custom_group' => $group, + 'name' => $textField, + 'title' => $textField, 'entity' => "Custom_$group", 'data_type' => 'String', 'fk_entity' => NULL, diff --git a/civicrm/ext/api4/tests/phpunit/Action/DateTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/DateTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/DateTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/DateTest.php index 8cdbfc7c6c058b9bd854f3f957a40b8e2329465d..507d80edd03836b8951489727609ac5cba09c45a 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/DateTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/DateTest.php @@ -1,10 +1,10 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\Relationship; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/EvaluateConditionTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/EvaluateConditionTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/EvaluateConditionTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/EvaluateConditionTest.php index 3726042fd3d2e6b90dc9d2d93d83b29fb08446f8..31f7441899f01ef86763b2e3f8ab33db40b38015 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/EvaluateConditionTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/EvaluateConditionTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\MockBasicEntity; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/ExtendFromIndividualTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php similarity index 93% rename from civicrm/ext/api4/tests/phpunit/Action/ExtendFromIndividualTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php index 2d3be50ca3c903914906879dd12e4d88a8916d52..77e582b44d729d31f74a6514d4868456d552556f 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ExtendFromIndividualTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ExtendFromIndividualTest.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\CustomField; @@ -16,7 +16,8 @@ class ExtendFromIndividualTest extends BaseCustomValueTest { $customGroup = CustomGroup::create() ->setCheckPermissions(FALSE) ->addValue('name', 'MyContactFields') - ->addValue('extends', 'Individual') // not Contact + // not Contact + ->addValue('extends', 'Individual') ->execute() ->first(); diff --git a/civicrm/ext/api4/tests/phpunit/Action/FkJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/FkJoinTest.php similarity index 96% rename from civicrm/ext/api4/tests/phpunit/Action/FkJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/FkJoinTest.php index c2b044e5cdbde88c33e58011c2fd2b547d22c7cc..85bf67e9160bbb06f7685569ec3bf2b42506fe81 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/FkJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/FkJoinTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\Activity; use Civi\Api4\Contact; diff --git a/civicrm/ext/api4/tests/phpunit/Action/GetExtraFieldsTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php similarity index 89% rename from civicrm/ext/api4/tests/phpunit/Action/GetExtraFieldsTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php index bc9b10e7ade312ebc4860320b6d4c4f4b5b52f34..837d7d87e06e58d201066ae6df1bc1e6b4bdca15 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/GetExtraFieldsTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/GetExtraFieldsTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\Contact; /** diff --git a/civicrm/ext/api4/tests/phpunit/Action/GetFromArrayTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/GetFromArrayTest.php similarity index 98% rename from civicrm/ext/api4/tests/phpunit/Action/GetFromArrayTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/GetFromArrayTest.php index bee6fbf361f7d538a41a91d8b98f5c4860d9beea..06a0c17ca2e081d021061409cbb90f702948c877 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/GetFromArrayTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/GetFromArrayTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; use Civi\Api4\MockArrayEntity; /** diff --git a/civicrm/ext/api4/tests/phpunit/Action/IndexTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/IndexTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/IndexTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/IndexTest.php index 17356c92db633cfe860b4d72c5aad53ea5cf2abe..9e33ea4e21b997685a859acbbf89d476ebb24246 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/IndexTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/IndexTest.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/NullValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/NullValueTest.php similarity index 95% rename from civicrm/ext/api4/tests/phpunit/Action/NullValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/NullValueTest.php index dc4f656aadf500c5daf4e6ec8b6ebf6adfe0ea14..c8b6516f426cdc4309204113ac786992252e7d8a 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/NullValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/NullValueTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Action/ReplaceTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ReplaceTest.php similarity index 96% rename from civicrm/ext/api4/tests/phpunit/Action/ReplaceTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/ReplaceTest.php index 097e12b0ccd9a96f959831016742d22c35bbbd32..701f4e2172e5aa21b02e4af9f61c22e6e61d4baf 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/ReplaceTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/ReplaceTest.php @@ -1,13 +1,13 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; use Civi\Api4\CustomValue; use Civi\Api4\Email; -use Civi\Test\Api4\Traits\TableDropperTrait; -use Civi\Test\Api4\UnitTestCase; +use api\v4\Traits\TableDropperTrait; +use api\v4\UnitTestCase; use Civi\Api4\Contact; /** @@ -55,7 +55,7 @@ class ReplaceTest extends UnitTestCase { ->first()['id']; $replacement = [ ['email' => 'firstedited@example.com', 'id' => $e1], - ['contact_id' => $cid1, 'email' => 'third@example.com', 'location_type_id' => 1] + ['contact_id' => $cid1, 'email' => 'third@example.com', 'location_type_id' => 1], ]; $replaced = Email::replace() ->setRecords($replacement) @@ -64,7 +64,7 @@ class ReplaceTest extends UnitTestCase { // Should have saved 2 records $this->assertEquals(2, $replaced->count()); // Should have deleted email2 - $this->assertEquals([$e2], $replaced->deleted); + $this->assertEquals([['id' => $e2]], $replaced->deleted); // Verify contact now has the new email records $results = Email::get() ->addWhere('contact_id', '=', $cid1) diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/RequiredFieldTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/RequiredFieldTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2374b335cac5274b714c2b114b45d3d8d20a69e6 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/RequiredFieldTest.php @@ -0,0 +1,24 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Event; +use api\v4\UnitTestCase; + +/** + * @group headless + */ +class RequiredFieldTest extends UnitTestCase { + + public function testRequired() { + $msg = ''; + try { + Event::create()->execute(); + } + catch (\API_Exception $e) { + $msg = $e->getMessage(); + } + $this->assertEquals('Mandatory values missing from Api4 Event::create: title, event_type_id, start_date', $msg); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateContactTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateContactTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b1bffbbbf5e7a30fdbe30d0ac0cdaba470ad8860 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateContactTest.php @@ -0,0 +1,54 @@ +<?php + +namespace api\v4\Action; + +use Civi\Api4\Contact; +use api\v4\UnitTestCase; + +/** + * Class UpdateContactTest + * @package api\v4\Action + * @group headless + */ +class UpdateContactTest extends UnitTestCase { + + public function testUpdateWithIdInWhere() { + $contactId = Contact::create() + ->setCheckPermissions(FALSE) + ->addValue('first_name', 'Johann') + ->addValue('last_name', 'Tester') + ->addValue('contact_type', 'Individual') + ->execute() + ->first()['id']; + + $contact = Contact::update() + ->setCheckPermissions(FALSE) + ->addWhere('id', '=', $contactId) + ->addValue('first_name', 'Testy') + ->execute() + ->first(); + $this->assertEquals('Testy', $contact['first_name']); + $this->assertEquals('Tester', $contact['last_name']); + } + + public function testUpdateWithIdInValues() { + $contactId = Contact::create() + ->setCheckPermissions(FALSE) + ->addValue('first_name', 'Bobby') + ->addValue('last_name', 'Tester') + ->addValue('contact_type', 'Individual') + ->execute() + ->first()['id']; + + $contact = Contact::update() + ->setCheckPermissions(FALSE) + ->addValue('id', $contactId) + ->addValue('first_name', 'Billy') + ->execute(); + $this->assertCount(1, $contact); + $this->assertEquals($contactId, $contact[0]['id']); + $this->assertEquals('Billy', $contact[0]['first_name']); + $this->assertEquals('Tester', $contact[0]['last_name']); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/Action/UpdateCustomValueTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Action/UpdateCustomValueTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php index 99a9f01101f8cbf1ae42e398cfad338f24022a79..23b6d2a46d22d032d8084981ee5a80bc652610e2 100644 --- a/civicrm/ext/api4/tests/phpunit/Action/UpdateCustomValueTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Action/UpdateCustomValueTest.php @@ -1,11 +1,11 @@ <?php -namespace Civi\Test\Api4\Action; +namespace api\v4\Action; use Civi\Api4\Contact; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; -use \CRM_Core_BAO_CustomValueTable as CustomValueTable; +use CRM_Core_BAO_CustomValueTable as CustomValueTable; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/AllTests.php b/civicrm/ext/api4/tests/phpunit/api/v4/AllTests.php new file mode 100644 index 0000000000000000000000000000000000000000..aea9bf33bac0cd1059ab6024c74572d4eef8bb5a --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/AllTests.php @@ -0,0 +1,68 @@ +<?php +// vim: set si ai expandtab tabstop=4 shiftwidth=4 softtabstop=4: + +/** + * File for the api_v4_AllTests class + * + * (PHP 5) + * + * @author Walt Haas <walt@dharmatech.org> (801) 534-1262 + * @copyright Copyright CiviCRM LLC (C) 2009 + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html + * GNU Affero General Public License version 3 + * @version $Id: AllTests.php 40328 2012-05-11 23:06:13Z allen $ + * @package CiviCRM + * + * This file is part of CiviCRM + * + * CiviCRM is free software; you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * CiviCRM is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ + +/** + * Class containing the APIv4 test suite + * + * @package CiviCRM + */ +class api_v4_AllTests extends CiviTestSuite { + private static $instance = NULL; + + /** + */ + private static function getInstance() { + if (is_null(self::$instance)) { + self::$instance = new self(); + } + return self::$instance; + } + + /** + * Build test suite dynamically. + */ + public static function suite() { + $inst = self::getInstance(); + return $inst->implSuite(__FILE__); + } + +} +// class AllTests + +// -- set Emacs parameters -- +// Local variables: +// mode: php; +// tab-width: 4 +// c-basic-offset: 4 +// c-hanging-comment-ender-p: nil +// indent-tabs-mode: nil +// End: diff --git a/civicrm/ext/api4/tests/phpunit/DataSets/ConformanceTest.json b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/ConformanceTest.json similarity index 56% rename from civicrm/ext/api4/tests/phpunit/DataSets/ConformanceTest.json rename to civicrm/ext/api4/tests/phpunit/api/v4/DataSets/ConformanceTest.json index fcaf8966347df3403f5f6aa038260ef7c96bbc9e..1028c5b6f80b30c3a6302638272c8e52a46f2a83 100644 --- a/civicrm/ext/api4/tests/phpunit/DataSets/ConformanceTest.json +++ b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/ConformanceTest.json @@ -3,7 +3,8 @@ { "first_name": "Janice", "last_name": "Voss", - "contact_type": "Individual" + "contact_type": "Individual", + "@ref": "test_contact_1" } ], "CustomGroup": [ @@ -24,5 +25,18 @@ "name": "the_group", "title": "The Group" } + ], + "Mapping": [ + { + "name": "the_mapping", + "mapping_type_id": "1" + } + ], + "Activity": [ + { + "subject": "Test A Phone Activity", + "activity_type": "Phone Call", + "source_contact_id": "@ref test_contact_1.id" + } ] } diff --git a/civicrm/ext/api4/tests/phpunit/DataSets/DefaultDataSet.json b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/DefaultDataSet.json similarity index 100% rename from civicrm/ext/api4/tests/phpunit/DataSets/DefaultDataSet.json rename to civicrm/ext/api4/tests/phpunit/api/v4/DataSets/DefaultDataSet.json diff --git a/civicrm/ext/api4/tests/phpunit/DataSets/MultiContactMultiEmail.json b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/MultiContactMultiEmail.json similarity index 100% rename from civicrm/ext/api4/tests/phpunit/DataSets/MultiContactMultiEmail.json rename to civicrm/ext/api4/tests/phpunit/api/v4/DataSets/MultiContactMultiEmail.json diff --git a/civicrm/ext/api4/tests/phpunit/DataSets/SingleContact.json b/civicrm/ext/api4/tests/phpunit/api/v4/DataSets/SingleContact.json similarity index 100% rename from civicrm/ext/api4/tests/phpunit/DataSets/SingleContact.json rename to civicrm/ext/api4/tests/phpunit/api/v4/DataSets/SingleContact.json diff --git a/civicrm/ext/api4/tests/phpunit/Entity/ConformanceTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ConformanceTest.php similarity index 71% rename from civicrm/ext/api4/tests/phpunit/Entity/ConformanceTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Entity/ConformanceTest.php index 79fe5b30dee7149b0f4081e1ec9a0ff88eb86daf..a038cbf82fc32761a845fb3cc06d50781ecb5bd4 100644 --- a/civicrm/ext/api4/tests/phpunit/Entity/ConformanceTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ConformanceTest.php @@ -1,12 +1,10 @@ <?php -namespace Civi\Test\Api4\Entity; +namespace api\v4\Entity; -use Civi\Api4\Generic\AbstractEntity; use Civi\Api4\Entity; -use Civi\Test\Api4\Service\TestCreationParameterProvider; -use Civi\Test\Api4\Traits\TableDropperTrait; -use Civi\Test\Api4\UnitTestCase; +use api\v4\Traits\TableDropperTrait; +use api\v4\UnitTestCase; /** * @group headless @@ -14,12 +12,12 @@ use Civi\Test\Api4\UnitTestCase; class ConformanceTest extends UnitTestCase { use TableDropperTrait; - use \Civi\Test\Api4\Traits\OptionCleanupTrait { + use \api\v4\Traits\OptionCleanupTrait { setUp as setUpOptionCleanup; } /** - * @var TestCreationParameterProvider + * @var \api\v4\Service\TestCreationParameterProvider */ protected $creationParamProvider; @@ -45,14 +43,7 @@ class ConformanceTest extends UnitTestCase { } public function getEntities() { - $result = []; - $entities = Entity::get()->setCheckPermissions(FALSE)->execute(); - foreach ($entities as $entity) { - if ($entity['name'] != 'Entity') { - $result[] = [$entity['name']]; - } - } - return $result; + return Entity::get()->setCheckPermissions(FALSE)->execute()->column('name'); } /** @@ -63,13 +54,20 @@ class ConformanceTest extends UnitTestCase { $this->assertNotEmpty($entities); foreach ($entities as $data) { - $entity = $data[0]; + $entity = $data; $entityClass = 'Civi\Api4\\' . $entity; - $this->checkActions($entityClass); + $actions = $this->checkActions($entityClass); + + // Go no further if it's not a CRUD entity + if (array_diff(['get', 'create', 'update', 'delete'], array_keys($actions))) { + continue; + } + $this->checkFields($entityClass, $entity); $id = $this->checkCreation($entity, $entityClass); $this->checkGet($entityClass, $id, $entity); + $this->checkGetCount($entityClass, $id, $entity); $this->checkUpdateFailsFromCreate($entityClass, $id); $this->checkWrongParamType($entityClass); $this->checkDeleteWithNoId($entityClass); @@ -104,12 +102,13 @@ class ConformanceTest extends UnitTestCase { ->execute() ->indexBy('name'); - $this->assertNotEmpty($actions->getArrayCopy()); + $this->assertNotEmpty($actions); + return (array) $actions; } /** * @param string $entity - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * * @return mixed */ @@ -130,7 +129,7 @@ class ConformanceTest extends UnitTestCase { } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * @param int $id */ protected function checkUpdateFailsFromCreate($entityClass, $id) { @@ -148,7 +147,7 @@ class ConformanceTest extends UnitTestCase { } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * @param int $id * @param string $entity */ @@ -159,11 +158,34 @@ class ConformanceTest extends UnitTestCase { ->execute(); $errMsg = sprintf('Failed to fetch a %s after creation', $entity); - $this->assertEquals(1, count($getResult), $errMsg); + $this->assertEquals($id, $getResult->first()['id'], $errMsg); + $this->assertEquals(1, $getResult->count(), $errMsg); + } + + /** + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass + * @param int $id + * @param string $entity + */ + protected function checkGetCount($entityClass, $id, $entity) { + $getResult = $entityClass::get() + ->setCheckPermissions(FALSE) + ->addWhere('id', '=', $id) + ->selectRowCount() + ->execute(); + $errMsg = sprintf('%s getCount failed', $entity); + $this->assertEquals(1, $getResult->count(), $errMsg); + + $getResult = $entityClass::get() + ->setCheckPermissions(FALSE) + ->selectRowCount() + ->execute(); + $errMsg = sprintf('%s getCount failed', $entity); + $this->assertGreaterThanOrEqual(1, $getResult->count(), $errMsg); } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass */ protected function checkDeleteWithNoId($entityClass) { $exceptionThrown = ''; @@ -178,7 +200,7 @@ class ConformanceTest extends UnitTestCase { } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass */ protected function checkWrongParamType($entityClass) { $exceptionThrown = ''; @@ -195,7 +217,7 @@ class ConformanceTest extends UnitTestCase { } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * @param int $id */ protected function checkDeletion($entityClass, $id) { @@ -205,11 +227,11 @@ class ConformanceTest extends UnitTestCase { ->execute(); // should get back an array of deleted id - $this->assertEquals([$id], (array) $deleteResult); + $this->assertEquals([['id' => $id]], (array) $deleteResult); } /** - * @param AbstractEntity|string $entityClass + * @param \Civi\Api4\Generic\AbstractEntity|string $entityClass * @param int $id * @param string $entity */ diff --git a/civicrm/ext/api4/tests/phpunit/Entity/ContactJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ContactJoinTest.php similarity index 97% rename from civicrm/ext/api4/tests/phpunit/Entity/ContactJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Entity/ContactJoinTest.php index 392e0466a3a31732674dbe98ca93ed6d17e78964..f2e0eaa38fb06374b67f1868841c90987095e799 100644 --- a/civicrm/ext/api4/tests/phpunit/Entity/ContactJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ContactJoinTest.php @@ -1,10 +1,10 @@ <?php -namespace Civi\Test\Api4\Entity; +namespace api\v4\Entity; use Civi\Api4\Contact; use Civi\Api4\OptionValue; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Entity/EntityTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/EntityTest.php similarity index 91% rename from civicrm/ext/api4/tests/phpunit/Entity/EntityTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Entity/EntityTest.php index 8f7ecd00586bf6f74a527fafe179ec55dfa17e8c..7e0a392fdb0724218aee9b20e0bcbb185ad256c0 100644 --- a/civicrm/ext/api4/tests/phpunit/Entity/EntityTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/EntityTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Entity; +namespace api\v4\Entity; use Civi\Api4\Entity; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Entity/ParticipantTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ParticipantTest.php similarity index 80% rename from civicrm/ext/api4/tests/phpunit/Entity/ParticipantTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Entity/ParticipantTest.php index 8236efb05a86f24aa7e25f712dab1a8b06f6f49f..7822ae9f5b1c754aefd44577e1b101a78de63290 100644 --- a/civicrm/ext/api4/tests/phpunit/Entity/ParticipantTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/ParticipantTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Entity; +namespace api\v4\Entity; use Civi\Api4\Participant; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -62,11 +62,13 @@ class ParticipantTest extends UnitTestCase { 'contacts' => $this->createEntity([ 'type' => 'Individual', 'count' => $contactCount, - 'seq' => 1]), + 'seq' => 1, + ]), 'events' => $this->createEntity([ 'type' => 'Event', 'count' => $eventCount, - 'seq' => 1]), + 'seq' => 1, + ]), 'sources' => ['Paddington', 'Springfield', 'Central'], ]; @@ -77,8 +79,10 @@ class ParticipantTest extends UnitTestCase { 'overrides' => [ 'event_id' => $dummy['events'][$i % $eventCount]['id'], 'contact_id' => $dummy['contacts'][$i % $contactCount]['id'], - 'source' => $dummy['sources'][$i % 3], // 3 = number of sources - ]])['sample_params']; + // 3 = number of sources + 'source' => $dummy['sources'][$i % 3], + ], + ])['sample_params']; Participant::create() ->setValues($dummy['participants'][$i]) @@ -137,10 +141,9 @@ class ParticipantTest extends UnitTestCase { ->setCheckPermissions(FALSE) ->setSelect(['id']) ->addClause('NOT', [ - ['event_id', '=', $firstEventId], - ['contact_id', '=', $firstContactId], - ] - ) + ['event_id', '=', $firstEventId], + ['contact_id', '=', $firstContactId], + ]) ->execute() ->indexBy('id'); @@ -149,10 +152,9 @@ class ParticipantTest extends UnitTestCase { ->setCheckPermissions(FALSE) ->setSelect(['id']) ->addClause('NOT', 'AND', [ - ['event_id', '=', $firstEventId], - ['contact_id', '=', $firstContactId], - ] - ) + ['event_id', '=', $firstEventId], + ['contact_id', '=', $firstContactId], + ]) ->execute() ->indexBy('id'); @@ -187,7 +189,7 @@ class ParticipantTest extends UnitTestCase { ->setCheckPermissions(FALSE) ->execute(); $expectedDeletes = [2, 7, 12, 17]; - $this->assertEquals($expectedDeletes, (array) $deleteResult, + $this->assertEquals($expectedDeletes, array_column((array) $deleteResult, 'id'), "didn't delete every second record as expected"); $sqlCount = $this->getRowCount('civicrm_participant'); @@ -195,6 +197,25 @@ class ParticipantTest extends UnitTestCase { $participantCount - count($expectedDeletes), $sqlCount, "records not gone from database after delete"); + + // Try creating is_test participants + foreach ($dummy['contacts'] as $contact) { + Participant::create() + ->addValue('is_test', 1) + ->addValue('contact_id', $contact['id']) + ->addValue('event_id', $secondEventId) + ->execute(); + } + + // By default is_test participants are hidden + $this->assertCount(0, Participant::get()->selectRowCount()->addWhere('event_id', '=', $secondEventId)->execute()); + + // Test records show up if you add is_test to the query + $testParticipants = Participant::get()->addWhere('event_id', '=', $secondEventId)->addWhere('is_test', '=', 1)->addSelect('id')->execute(); + $this->assertCount($contactCount, $testParticipants); + + // Or if you search by id + $this->assertCount(1, Participant::get()->selectRowCount()->addWhere('id', '=', $testParticipants->first()['id'])->execute()); } } diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Entity/RouteTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/RouteTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d096029fde8b967e396047aaa684af2bb26c11bd --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/RouteTest.php @@ -0,0 +1,21 @@ +<?php + +namespace api\v4\Entity; + +use Civi\Api4\Route; +use api\v4\UnitTestCase; + +/** + * @group headless + */ +class RouteTest extends UnitTestCase { + + public function testGet() { + $result = Route::get()->addWhere('path', '=', 'civicrm/admin')->execute(); + $this->assertEquals(1, $result->count()); + + $result = Route::get()->addWhere('path', 'LIKE', 'civicrm/admin/%')->execute(); + $this->assertGreaterThan(10, $result->count()); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/api/v4/Entity/SettingTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/SettingTest.php new file mode 100644 index 0000000000000000000000000000000000000000..4443228366f1d431fd6e0a4d2e113e137c2b1421 --- /dev/null +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Entity/SettingTest.php @@ -0,0 +1,36 @@ +<?php + +namespace api\v4\Entity; + +use Civi\Api4\Setting; +use api\v4\UnitTestCase; + +/** + * @group headless + */ +class SettingTest extends UnitTestCase { + + public function testSettingASetting() { + $setting = Setting::set()->addValue('menubar_position', 'above-crm-container')->setCheckPermissions(FALSE)->execute()->first(); + $this->assertEquals('above-crm-container', $setting['value']); + $setting = Setting::get()->addSelect('menubar_position')->setCheckPermissions(FALSE)->execute()->first(); + $this->assertEquals('above-crm-container', $setting['value']); + + $setting = Setting::revert()->addSelect('menubar_position')->setCheckPermissions(FALSE)->execute()->indexBy('name')->column('value'); + $this->assertEquals(['menubar_position' => 'over-cms-menu'], $setting); + $setting = civicrm_api4('Setting', 'get', ['select' => ['menubar_position'], 'checkPermissions' => FALSE], 0); + $this->assertEquals('over-cms-menu', $setting['value']); + } + + public function testInvalidSetting() { + $message = ''; + try { + Setting::set()->addValue('not_a_real_setting!', 'hello')->setCheckPermissions(FALSE)->execute(); + } + catch (\API_Exception $e) { + $message = $e->getMessage(); + } + $this->assertContains('setting', $message); + } + +} diff --git a/civicrm/ext/api4/tests/phpunit/Mock/Api4/Action/MockArrayEntity/Get.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/Action/MockArrayEntity/Get.php similarity index 100% rename from civicrm/ext/api4/tests/phpunit/Mock/Api4/Action/MockArrayEntity/Get.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/Action/MockArrayEntity/Get.php diff --git a/civicrm/ext/api4/tests/phpunit/Mock/Api4/MockArrayEntity.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockArrayEntity.php similarity index 99% rename from civicrm/ext/api4/tests/phpunit/Mock/Api4/MockArrayEntity.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockArrayEntity.php index 371df50e947813886e8026e886c537450bb1daf5..b6e3fac5ea94fb5d20722f9308fda4ae9c108698 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/Api4/MockArrayEntity.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockArrayEntity.php @@ -1,6 +1,7 @@ <?php namespace Civi\Api4; + use Civi\Api4\Generic\BasicGetFieldsAction; /** diff --git a/civicrm/ext/api4/tests/phpunit/Mock/Api4/MockBasicEntity.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockBasicEntity.php similarity index 79% rename from civicrm/ext/api4/tests/phpunit/Mock/Api4/MockBasicEntity.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockBasicEntity.php index aed11e4557914e2f87f2f6148272b7241a42a6dd..cc81035a4b7112c65ef7df10d0eb1391ad6db8ed 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/Api4/MockBasicEntity.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/Api4/MockBasicEntity.php @@ -2,6 +2,8 @@ namespace Civi\Api4; +use api\v4\Mock\MockEntityDataStorage; + /** * MockBasicEntity entity. * @@ -9,8 +11,6 @@ namespace Civi\Api4; */ class MockBasicEntity extends Generic\AbstractEntity { - const STORAGE_CLASS = '\\Civi\\Test\\Api4\\Mock\\MockEntityDataStorage'; - /** * @return Generic\BasicGetFieldsAction */ @@ -26,7 +26,7 @@ class MockBasicEntity extends Generic\AbstractEntity { 'options' => [ 'one' => 'One', 'two' => 'Two', - ] + ], ], [ 'name' => 'color', @@ -48,28 +48,35 @@ class MockBasicEntity extends Generic\AbstractEntity { * @return Generic\BasicGetAction */ public static function get() { - return new Generic\BasicGetAction('MockBasicEntity', __FUNCTION__, [self::STORAGE_CLASS, 'get']); + return new Generic\BasicGetAction('MockBasicEntity', __FUNCTION__, [MockEntityDataStorage::CLASS, 'get']); } /** * @return Generic\BasicCreateAction */ public static function create() { - return new Generic\BasicCreateAction(static::class, __FUNCTION__, [self::STORAGE_CLASS, 'write']); + return new Generic\BasicCreateAction(static::class, __FUNCTION__, [MockEntityDataStorage::CLASS, 'write']); + } + + /** + * @return Generic\BasicSaveAction + */ + public static function save() { + return new Generic\BasicSaveAction(self::getEntityName(), __FUNCTION__, 'id', [MockEntityDataStorage::CLASS, 'write']); } /** * @return Generic\BasicUpdateAction */ public static function update() { - return new Generic\BasicUpdateAction(self::getEntityName(), __FUNCTION__, 'id', [self::STORAGE_CLASS, 'write']); + return new Generic\BasicUpdateAction(self::getEntityName(), __FUNCTION__, 'id', [MockEntityDataStorage::CLASS, 'write']); } /** * @return Generic\BasicBatchAction */ public static function delete() { - return new Generic\BasicBatchAction('MockBasicEntity', __FUNCTION__, 'id', [self::STORAGE_CLASS, 'delete']); + return new Generic\BasicBatchAction('MockBasicEntity', __FUNCTION__, 'id', [MockEntityDataStorage::CLASS, 'delete']); } /** diff --git a/civicrm/ext/api4/tests/phpunit/Mock/MockEntityDataStorage.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockEntityDataStorage.php similarity index 74% rename from civicrm/ext/api4/tests/phpunit/Mock/MockEntityDataStorage.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockEntityDataStorage.php index fbb10465b34eb28d0f8d5bb23ba1772bc6a77f11..1f2ad1001562e07dbbdfe7ae0ae078ef2ef5d92b 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/MockEntityDataStorage.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockEntityDataStorage.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Mock; +namespace api\v4\Mock; /** * Simple data backend for mock basic api. @@ -18,8 +18,11 @@ class MockEntityDataStorage { public static function write($record) { if (empty($record['id'])) { $record['id'] = self::$nextId++; + self::$data[$record['id']] = $record; + } + else { + self::$data[$record['id']] = $record + self::$data[$record['id']]; } - self::$data[$record['id']] = $record; return $record; } diff --git a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionBase.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionBase.php similarity index 89% rename from civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionBase.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionBase.php index e46272d2a197e5b1171636fffad742f7db10069c..c014f35adfbf5378c535c23ed7493d779a0d15ef 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionBase.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionBase.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Mock; +namespace api\v4\Mock; /** * Class TestV4ReflectionBase diff --git a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionChild.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionChild.php similarity index 86% rename from civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionChild.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionChild.php index 83966b5c903cc91d9027ac52a061ed2d00ebcb69..bb68c191c1e3e7e4291155cb50d923d2c9960702 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionChild.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionChild.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Mock; +namespace api\v4\Mock; /** * @inheritDoc diff --git a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionGrandchild.php b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionGrandchild.php similarity index 86% rename from civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionGrandchild.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionGrandchild.php index a2a93a4fa5c3b0700b57a70d7fa138a7534e2ad7..12cec53d14d8409ddea6fdcd5ec0719573f03139 100644 --- a/civicrm/ext/api4/tests/phpunit/Mock/MockV4ReflectionGrandchild.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Mock/MockV4ReflectionGrandchild.php @@ -1,7 +1,6 @@ <?php -namespace Civi\Test\Api4\Mock; - +namespace api\v4\Mock; /** * Grandchild class diff --git a/civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryComplexJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryComplexJoinTest.php similarity index 77% rename from civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryComplexJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryComplexJoinTest.php index 0e68843a186ae2061f5e54b5210a7d8f57b0212e..129db653ee4cfa833333cd8136d2572a265a04f1 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryComplexJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryComplexJoinTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Query\Api4SelectQuery; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -27,7 +27,7 @@ class Api4SelectQueryComplexJoinTest extends UnitTestCase { } public function testWithComplexRelatedEntitySelect() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'display_name'; $query->select[] = 'phones.phone'; @@ -59,10 +59,11 @@ class Api4SelectQueryComplexJoinTest extends UnitTestCase { } public function testWithSelectOfOrphanDeepValues() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'first_name'; - $query->select[] = 'emails.location_type.name'; // emails not selected + // emails not selected + $query->select[] = 'emails.location_type.name'; $results = $query->run(); $firstResult = array_shift($results); @@ -70,10 +71,11 @@ class Api4SelectQueryComplexJoinTest extends UnitTestCase { } public function testOrderDoesNotMatter() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'first_name'; - $query->select[] = 'emails.location_type.name'; // before emails selection + // before emails selection + $query->select[] = 'emails.location_type.name'; $query->select[] = 'emails.email'; $query->where[] = ['emails.email', 'IS NOT NULL']; $results = $query->run(); diff --git a/civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryTest.php similarity index 77% rename from civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryTest.php index ca9a5851eb3e6199606b6e4f191b0a97b3b3693a..0ea07762ef6fff507cf0594f39f72789eb31b5dc 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/Api4SelectQueryTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/Api4SelectQueryTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Query\Api4SelectQuery; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -32,7 +32,7 @@ class Api4SelectQueryTest extends UnitTestCase { public function testWithSingleWhereJoin() { $phoneNum = $this->getReference('test_phone_1')['phone']; - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->where[] = ['phones.phone', '=', $phoneNum]; $results = $query->run(); @@ -42,7 +42,7 @@ class Api4SelectQueryTest extends UnitTestCase { public function testOneToManyJoin() { $phoneNum = $this->getReference('test_phone_1')['phone']; - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'first_name'; $query->select[] = 'phones.phone'; @@ -60,7 +60,7 @@ class Api4SelectQueryTest extends UnitTestCase { $phoneNum = $this->getReference('test_phone_1')['phone']; $contact = $this->getReference('test_contact_1'); - $query = new Api4SelectQuery('Phone', FALSE); + $query = new Api4SelectQuery('Phone', FALSE, civicrm_api4('Phone', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'phone'; $query->select[] = 'contact.display_name'; @@ -76,7 +76,7 @@ class Api4SelectQueryTest extends UnitTestCase { } public function testOneToManyMultipleJoin() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'id'; $query->select[] = 'first_name'; $query->select[] = 'phones.phone'; diff --git a/civicrm/ext/api4/tests/phpunit/Query/OneToOneJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/OneToOneJoinTest.php similarity index 87% rename from civicrm/ext/api4/tests/phpunit/Query/OneToOneJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/OneToOneJoinTest.php index ef05f6578dcdff78ac5c68abdc3219e8d1a17f04..1721665b49089595695cd874667b1e8ff31b840c 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/OneToOneJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/OneToOneJoinTest.php @@ -1,15 +1,13 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Contact; -use Civi\Api4\OptionGroup; -use Civi\Api4\OptionValue; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * Class OneToOneJoinTest - * @package Civi\Test\Api4\Query + * @package api\v4\Query * @group headless */ class OneToOneJoinTest extends UnitTestCase { diff --git a/civicrm/ext/api4/tests/phpunit/Query/OptionValueJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/OptionValueJoinTest.php similarity index 81% rename from civicrm/ext/api4/tests/phpunit/Query/OptionValueJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/OptionValueJoinTest.php index 75d4b9771c94888f31370df92a4c67dc369d9a89..eb6bfa4d48b23853a6ad091bc9fdd080a964eb56 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/OptionValueJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/OptionValueJoinTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Query\Api4SelectQuery; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -29,7 +29,7 @@ class OptionValueJoinTest extends UnitTestCase { } public function testCommunicationMethodJoin() { - $query = new Api4SelectQuery('Contact', FALSE); + $query = new Api4SelectQuery('Contact', FALSE, civicrm_api4('Contact', 'getFields', ['includeCustom' => FALSE, 'checkPermissions' => FALSE, 'action' => 'get'], 'name')); $query->select[] = 'first_name'; $query->select[] = 'preferred_communication_method.label'; $query->where[] = ['preferred_communication_method', 'IS NOT NULL']; diff --git a/civicrm/ext/api4/tests/phpunit/Query/SelectQueryMultiJoinTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Query/SelectQueryMultiJoinTest.php similarity index 91% rename from civicrm/ext/api4/tests/phpunit/Query/SelectQueryMultiJoinTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Query/SelectQueryMultiJoinTest.php index 860bd785201afa9e72f38cb6adcb0ec04e02c0b3..748d27ffe0c068a1d7e10a5990fad9082753b961 100644 --- a/civicrm/ext/api4/tests/phpunit/Query/SelectQueryMultiJoinTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Query/SelectQueryMultiJoinTest.php @@ -1,17 +1,18 @@ <?php -namespace Civi\Test\Api4\Query; +namespace api\v4\Query; use Civi\Api4\Contact; use Civi\Api4\Email; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * Class SelectQueryMultiJoinTest - * @package Civi\Test\Api4\Query + * @package api\v4\Query * @group headless */ class SelectQueryMultiJoinTest extends UnitTestCase { + public function setUpHeadless() { $this->cleanup(['tablesToTruncate' => ['civicrm_contact', 'civicrm_email']]); $this->loadDataSet('MultiContactMultiEmail'); @@ -34,8 +35,8 @@ class SelectQueryMultiJoinTest extends UnitTestCase { $secondContactEmails = array_column($secondContact['emails'], 'email'); $expectedFirstEmails = [ - 'test_contact_one_home@fakedomain.com', - 'test_contact_one_work@fakedomain.com', + 'test_contact_one_home@fakedomain.com', + 'test_contact_one_work@fakedomain.com', ]; $expectedSecondEmails = [ 'test_contact_two_home@fakedomain.com', diff --git a/civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapRealTableTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapRealTableTest.php similarity index 85% rename from civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapRealTableTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapRealTableTest.php index 183d34dc8f6729a98025538a6b6241035c3eecf0..fb5710fe34b420dcbb09a909d468f4ef1e6bb51e 100644 --- a/civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapRealTableTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapRealTableTest.php @@ -1,13 +1,14 @@ <?php -namespace Civi\Test\Api4\Service\Schema; +namespace api\v4\Service\Schema; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless */ class SchemaMapRealTableTest extends UnitTestCase { + public function testAutoloadWillPopulateTablesByDefault() { $map = \Civi::container()->get('schema_map'); $this->assertNotEmpty($map->getTables()); diff --git a/civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapperTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapperTest.php similarity index 97% rename from civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapperTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapperTest.php index 04952f7bfdf370d06392b0560e0446f384ea5f33..0c47982d5a3e4e55e2dd1c3c409258aca17a54cc 100644 --- a/civicrm/ext/api4/tests/phpunit/Service/Schema/SchemaMapperTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Service/Schema/SchemaMapperTest.php @@ -1,11 +1,11 @@ <?php -namespace Civi\Test\Api4\Service\Schema; +namespace api\v4\Service\Schema; use Civi\Api4\Service\Schema\Joinable\Joinable; use Civi\Api4\Service\Schema\SchemaMap; use Civi\Api4\Service\Schema\Table; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Service/TestCreationParameterProvider.php b/civicrm/ext/api4/tests/phpunit/api/v4/Service/TestCreationParameterProvider.php similarity index 75% rename from civicrm/ext/api4/tests/phpunit/Service/TestCreationParameterProvider.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Service/TestCreationParameterProvider.php index ef10cea981f205ad586089bdb2a823ea698d5e7a..477c43f9bdfc52d8ce925215f8c919e0cf8d6125 100644 --- a/civicrm/ext/api4/tests/phpunit/Service/TestCreationParameterProvider.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Service/TestCreationParameterProvider.php @@ -1,20 +1,19 @@ <?php -namespace Civi\Test\Api4\Service; +namespace api\v4\Service; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\SpecGatherer; -use \CRM_Utils_String as StringHelper; class TestCreationParameterProvider { /** - * @var SpecGatherer + * @var \Civi\Api4\Service\Spec\SpecGatherer */ protected $gatherer; /** - * @param SpecGatherer $gatherer + * @param \Civi\Api4\Service\Spec\SpecGatherer $gatherer */ public function __construct(SpecGatherer $gatherer) { $this->gatherer = $gatherer; @@ -49,7 +48,7 @@ class TestCreationParameterProvider { * Attempt to get a value using field option, defaults, FKEntity, or a random * value based on the data type. * - * @param FieldSpec $field + * @param \Civi\Api4\Service\Spec\FieldSpec $field * * @return mixed * @throws \Exception @@ -63,7 +62,10 @@ class TestCreationParameterProvider { return $field->getDefaultValue(); } elseif ($field->getFkEntity()) { - return $this->getFkID($field); + return $this->getFkID($field, $field->getFkEntity()); + } + elseif (in_array($field->getName(), ['entity_id', 'contact_id'])) { + return $this->getFkID($field, 'Contact'); } $randomValue = $this->getRandomValue($field->getDataType()); @@ -76,32 +78,23 @@ class TestCreationParameterProvider { } /** - * @param FieldSpec $field + * @param \Civi\Api4\Service\Spec\FieldSpec $field * * @return mixed */ private function getOption(FieldSpec $field) { $options = $field->getOptions(); - $useKeyNames = ['data_type', 'html_type']; - $shouldUseKey = in_array($field->getName(), $useKeyNames); - $isIdField = substr($field->getName(), -3) === '_id'; - - if ($isIdField || $shouldUseKey) { - return array_rand($options); // return key (ID) - } - else { - return $options[array_rand($options)]; - } + return array_rand($options); } /** - * @param FieldSpec $field + * @param \Civi\Api4\Service\Spec\FieldSpec $field + * @param string $fkEntity * * @return mixed * @throws \Exception */ - private function getFkID(FieldSpec $field) { - $fkEntity = $field->getFkEntity(); + private function getFkID(FieldSpec $field, $fkEntity) { $params = ['checkPermissions' => FALSE]; // Be predictable about what type of contact we select if ($fkEntity === 'Contact') { @@ -130,16 +123,19 @@ class TestCreationParameterProvider { return rand(1, 2000); case 'String': - return StringHelper::createRandom(10, implode('', range('a', 'z'))); + return \CRM_Utils_String::createRandom(10, implode('', range('a', 'z'))); case 'Text': - return StringHelper::createRandom(100, implode('', range('a', 'z'))); + return \CRM_Utils_String::createRandom(100, implode('', range('a', 'z'))); case 'Money': - return sprintf('%d.%2d', rand(0, 2000), rand(1, 99)); + return sprintf('%d.%2d', rand(0, 2000), rand(10, 99)); case 'Date': return '20100102'; + + case 'Timestamp': + return 'now'; } return NULL; diff --git a/civicrm/ext/api4/tests/phpunit/Spec/RequestSpecTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/RequestSpecTest.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Spec/RequestSpecTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Spec/RequestSpecTest.php index 45aa41b2dd5dfcf6760adb13d6a58f2fdac03ef0..81db0023463127527a3093a4991162839e85de7f 100644 --- a/civicrm/ext/api4/tests/phpunit/Spec/RequestSpecTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/RequestSpecTest.php @@ -1,10 +1,10 @@ <?php -namespace Civi\Test\Api4\Spec; +namespace api\v4\Spec; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/phpunit/Spec/SpecFormatterTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecFormatterTest.php similarity index 82% rename from civicrm/ext/api4/tests/phpunit/Spec/SpecFormatterTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecFormatterTest.php index bdb1c4599a41cdc260f5a5d0f1c43f404e977341..9c18da569f3c6c25401ad1c2bfa5db05bfb2e2d8 100644 --- a/civicrm/ext/api4/tests/phpunit/Spec/SpecFormatterTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecFormatterTest.php @@ -1,12 +1,12 @@ <?php -namespace Civi\Test\Api4\Spec; +namespace api\v4\Spec; use Civi\Api4\Service\Spec\CustomFieldSpec; use Civi\Api4\Service\Spec\FieldSpec; use Civi\Api4\Service\Spec\RequestSpec; use Civi\Api4\Service\Spec\SpecFormatter; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -48,16 +48,18 @@ class SpecFormatterTest extends UnitTestCase { 'id' => $customFieldId, 'name' => $name, 'data_type' => 'String', - 'html_type' => 'MultiSelect', + 'html_type' => 'Multi-Select', ]; - /** @var CustomFieldSpec $field */ + /** @var \Civi\Api4\Service\Spec\CustomFieldSpec $field */ $field = SpecFormatter::arrayToField($data, 'TestEntity'); $this->assertInstanceOf(CustomFieldSpec::class, $field); $this->assertEquals('my_group', $field->getCustomGroupName()); $this->assertEquals($customFieldId, $field->getCustomFieldId()); $this->assertEquals(\CRM_Core_DAO::SERIALIZE_SEPARATOR_BOOKEND, $field->getSerialize()); + $this->assertEquals('Select', $field->getInputType()); + $this->assertTrue($field->getInputAttrs()['multiple']); } /** @@ -69,20 +71,21 @@ class SpecFormatterTest extends UnitTestCase { [ 'name' => 'Foo', 'title' => 'Bar', - 'type' => \CRM_Utils_Type::T_STRING + 'type' => \CRM_Utils_Type::T_STRING, ], 'Foo', - 'String' + 'String', ], [ [ 'name' => 'MyField', 'title' => 'Bar', 'type' => \CRM_Utils_Type::T_STRING, - 'data_type' => 'Boolean' // this should take precedence + // this should take precedence + 'data_type' => 'Boolean', ], 'MyField', - 'Boolean' + 'Boolean', ], ]; } diff --git a/civicrm/ext/api4/tests/phpunit/Spec/SpecGathererTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecGathererTest.php similarity index 88% rename from civicrm/ext/api4/tests/phpunit/Spec/SpecGathererTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecGathererTest.php index bf5b92b9c2d83fc589a3a0fe7dec521fb9d313c4..c030952f5b1491d204365815661efb0043d1bf24 100644 --- a/civicrm/ext/api4/tests/phpunit/Spec/SpecGathererTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Spec/SpecGathererTest.php @@ -1,16 +1,15 @@ <?php -namespace Civi\Test\Api4\Spec; +namespace api\v4\Spec; use Civi\Api4\Service\Spec\FieldSpec; -use Civi\Api4\Service\Spec\Provider\SpecProviderInterface; -use Civi\Api4\Service\Spec\RequestSpec; +use Civi\Api4\Service\Spec\Provider\Generic\SpecProviderInterface; use Civi\Api4\Service\Spec\SpecGatherer; -use Civi\Test\Api4\Traits\OptionCleanupTrait; -use Civi\Test\Api4\UnitTestCase; +use api\v4\Traits\OptionCleanupTrait; +use api\v4\UnitTestCase; use Civi\Api4\CustomField; use Civi\Api4\CustomGroup; -use Civi\Test\Api4\Traits\TableDropperTrait; +use api\v4\Traits\TableDropperTrait; use Prophecy\Argument; /** @@ -26,7 +25,7 @@ class SpecGathererTest extends UnitTestCase { $this->cleanup([ 'tablesToTruncate' => [ 'civicrm_custom_group', - 'civicrm_custom_field' + 'civicrm_custom_field', ], ]); return parent::setUpHeadless(); @@ -49,7 +48,7 @@ class SpecGathererTest extends UnitTestCase { $provider = $this->prophesize(SpecProviderInterface::class); $provider->applies('Contact', 'create')->willReturn(TRUE); $provider->modifySpec(Argument::any())->will(function ($args) { - /** @var RequestSpec $spec */ + /** @var \Civi\Api4\Service\Spec\RequestSpec $spec */ $spec = $args[0]; $spec->addFieldSpec(new FieldSpec('foo', 'Contact')); }); @@ -75,7 +74,7 @@ class SpecGathererTest extends UnitTestCase { ->setCheckPermissions(FALSE) ->addValue('label', 'FavColor') ->addValue('custom_group_id', $customGroupId) - ->addValue('options', $options) + ->addValue('option_values', $options) ->addValue('html_type', 'Select') ->addValue('data_type', 'String') ->execute(); diff --git a/civicrm/ext/api4/tests/phpunit/Traits/OptionCleanupTrait.php b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/OptionCleanupTrait.php similarity index 95% rename from civicrm/ext/api4/tests/phpunit/Traits/OptionCleanupTrait.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Traits/OptionCleanupTrait.php index 06f432352652fed4069c5f6800c734bf9bf7b873..a848516249362aefc1e6fcb2967d7577c092a05d 100644 --- a/civicrm/ext/api4/tests/phpunit/Traits/OptionCleanupTrait.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/OptionCleanupTrait.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Traits; +namespace api\v4\Traits; trait OptionCleanupTrait { diff --git a/civicrm/ext/api4/tests/phpunit/Traits/QueryCounterTrait.php b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/QueryCounterTrait.php similarity index 91% rename from civicrm/ext/api4/tests/phpunit/Traits/QueryCounterTrait.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Traits/QueryCounterTrait.php index c7e10f1b93e372d1924584d4afea42465f246284..988d8c2adf07ca001161fe04c6dfb0481fcb869b 100644 --- a/civicrm/ext/api4/tests/phpunit/Traits/QueryCounterTrait.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/QueryCounterTrait.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4\Traits; +namespace api\v4\Traits; -use \CRM_Utils_Array as ArrayHelper; +use CRM_Utils_Array as ArrayHelper; trait QueryCounterTrait { diff --git a/civicrm/ext/api4/tests/phpunit/Traits/TableDropperTrait.php b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/TableDropperTrait.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/Traits/TableDropperTrait.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Traits/TableDropperTrait.php index 6e54347334ac52e3a3737d376b192d5260075aeb..a623e5ac62475c47fb70bc0bb6ef7a40a88c338b 100644 --- a/civicrm/ext/api4/tests/phpunit/Traits/TableDropperTrait.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/TableDropperTrait.php @@ -1,8 +1,9 @@ <?php -namespace Civi\Test\Api4\Traits; +namespace api\v4\Traits; trait TableDropperTrait { + /** * @param $prefix */ diff --git a/civicrm/ext/api4/tests/phpunit/Traits/TestDataLoaderTrait.php b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/TestDataLoaderTrait.php similarity index 98% rename from civicrm/ext/api4/tests/phpunit/Traits/TestDataLoaderTrait.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Traits/TestDataLoaderTrait.php index 1db220904663ae3646f9e158d0218bb7659c685a..b03ad8c4b6de2a948d27c188205a2ea44d82490c 100644 --- a/civicrm/ext/api4/tests/phpunit/Traits/TestDataLoaderTrait.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Traits/TestDataLoaderTrait.php @@ -1,6 +1,6 @@ <?php -namespace Civi\Test\Api4\Traits; +namespace api\v4\Traits; /** * This probably should be a separate class diff --git a/civicrm/ext/api4/tests/phpunit/UnitTestCase.php b/civicrm/ext/api4/tests/phpunit/api/v4/UnitTestCase.php similarity index 94% rename from civicrm/ext/api4/tests/phpunit/UnitTestCase.php rename to civicrm/ext/api4/tests/phpunit/api/v4/UnitTestCase.php index 4f872d120d37090e07183478494685743b5dfe98..49f462831a379a6e4990b2ecb31b6c201a6e6983 100644 --- a/civicrm/ext/api4/tests/phpunit/UnitTestCase.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/UnitTestCase.php @@ -1,8 +1,8 @@ <?php -namespace Civi\Test\Api4; +namespace api\v4; -use Civi\Test\Api4\Traits\TestDataLoaderTrait; +use api\v4\Traits\TestDataLoaderTrait; use Civi\Test\HeadlessInterface; use Civi\Test\TransactionalInterface; @@ -70,8 +70,12 @@ class UnitTestCase extends \PHPUnit_Framework_TestCase implements HeadlessInterf /** * Create sample entities (using V3 for now). * - * @param array $params (type, seq, overrides, count) - * @return array (either single, or array of array if count >1) + * @param array $params + * (type, seq, overrides, count) + * @return array + * (either single, or array of array if count >1) + * @throws \CiviCRM_API3_Exception + * @throws \Exception */ public static function createEntity($params) { $params += [ @@ -154,7 +158,8 @@ class UnitTestCase extends \PHPUnit_Framework_TestCase implements HeadlessInterf if (substr($value, 0, 6) === 'dummy.') { $foreign_entity = self::createEntity([ 'type' => substr($value, 6), - 'seq' => $params['seq']]); + 'seq' => $params['seq'], + ]); $sample_params[$key] = $foreign_entity['id']; } } @@ -217,7 +222,8 @@ class UnitTestCase extends \PHPUnit_Framework_TestCase implements HeadlessInterf ], 'Contribution' => [ 'contact_id' => 'dummy.Individual', - 'financial_type_id' => 1, // donation, 2 = member, 3 = campaign contribution, 4=event + // donation, 2 = member, 3 = campaign contribution, 4=event + 'financial_type_id' => 1, 'total_amount' => 7.3, ], 'Activity' => [ diff --git a/civicrm/ext/api4/tests/phpunit/Utils/ArrayInsertionServiceTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Utils/ArrayInsertionServiceTest.php similarity index 85% rename from civicrm/ext/api4/tests/phpunit/Utils/ArrayInsertionServiceTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Utils/ArrayInsertionServiceTest.php index 462f07cc32f19556eebd6abbaa1e8c1e017d5c48..81d7878052fdfecaab62b33d6d85f6ac0dc2bcf1 100644 --- a/civicrm/ext/api4/tests/phpunit/Utils/ArrayInsertionServiceTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Utils/ArrayInsertionServiceTest.php @@ -1,9 +1,9 @@ <?php -namespace Civi\Test\Api4\Utils; +namespace api\v4\Utils; use Civi\Api4\Utils\ArrayInsertionUtil; -use Civi\Test\Api4\UnitTestCase; +use api\v4\UnitTestCase; /** * @group headless @@ -18,7 +18,7 @@ class ArrayInsertionServiceTest extends UnitTestCase { $expected = [ 'foo' => [ - 'bar' => 'LALA' + 'bar' => 'LALA', ], ]; @@ -29,25 +29,25 @@ class ArrayInsertionServiceTest extends UnitTestCase { $contacts = [ [ 'id' => 1, - 'first_name' => 'Jim' + 'first_name' => 'Jim', ], [ 'id' => 2, - 'first_name' => 'Karen' + 'first_name' => 'Karen', ], ]; $emails = [ [ 'email' => 'jim@jim.com', 'id' => 2, - '_parent_id' => 1 + '_parent_id' => 1, ], ]; $locationTypes = [ [ 'name' => 'Home', 'id' => 3, - '_parent_id' => 2 + '_parent_id' => 2, ], ]; diff --git a/civicrm/ext/api4/tests/phpunit/Utils/ReflectionUtilsTest.php b/civicrm/ext/api4/tests/phpunit/api/v4/Utils/ReflectionUtilsTest.php similarity index 91% rename from civicrm/ext/api4/tests/phpunit/Utils/ReflectionUtilsTest.php rename to civicrm/ext/api4/tests/phpunit/api/v4/Utils/ReflectionUtilsTest.php index d94de337254509d0fb3d207d5ab105a625c23004..57b5aad877df6e4e59e9a89ad98bb74561f3005b 100644 --- a/civicrm/ext/api4/tests/phpunit/Utils/ReflectionUtilsTest.php +++ b/civicrm/ext/api4/tests/phpunit/api/v4/Utils/ReflectionUtilsTest.php @@ -1,10 +1,10 @@ <?php -namespace Civi\Test\Api4\Utils; +namespace api\v4\Utils; use Civi\Api4\Utils\ReflectionUtils; -use Civi\Test\Api4\Mock\MockV4ReflectionGrandchild; -use Civi\Test\Api4\UnitTestCase; +use api\v4\Mock\MockV4ReflectionGrandchild; +use api\v4\UnitTestCase; /** * @group headless diff --git a/civicrm/ext/api4/tests/services.xml b/civicrm/ext/api4/tests/phpunit/api/v4/services.xml similarity index 78% rename from civicrm/ext/api4/tests/services.xml rename to civicrm/ext/api4/tests/phpunit/api/v4/services.xml index 220ba910ab6e097c11132cca118d516729ece218..3310b03e939d398ff1c7da3cd0bd3bac2271fb63 100644 --- a/civicrm/ext/api4/tests/services.xml +++ b/civicrm/ext/api4/tests/phpunit/api/v4/services.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> <services> - <service id="test.param_provider" class="Civi\Test\Api4\Service\TestCreationParameterProvider"> + <service id="test.param_provider" class="api\v4\Service\TestCreationParameterProvider"> <argument type="service" id="spec_gatherer"/> </service> </services> diff --git a/civicrm/ext/api4/tests/phpunit/bootstrap.php b/civicrm/ext/api4/tests/phpunit/bootstrap.php index 1c28e611935222b2507f4cb31d21dd581e4c3eeb..c9572477e7f3c033aa925897020bd505aee00bab 100644 --- a/civicrm/ext/api4/tests/phpunit/bootstrap.php +++ b/civicrm/ext/api4/tests/phpunit/bootstrap.php @@ -8,8 +8,8 @@ eval($bootCode); preg_match('/require_once\s*\'(.*)\'/', $bootCode, $matches); $loader = require sprintf('%s/vendor/autoload.php', $matches[1]); -$loader->addPsr4('Civi\\Test\\Api4\\', __DIR__); -$loader->addPsr4('Civi\\Api4\\', __DIR__ . '/Mock/Api4'); +$loader->addPsr4('api\\v4\\', __DIR__ . '/api/v4'); +$loader->addPsr4('Civi\\Api4\\', __DIR__ . '/api/v4' . '/Mock/Api4'); /** * Call the "cv" command. diff --git a/civicrm/packages/DB/DataObject.php b/civicrm/packages/DB/DataObject.php index a18932c7565818b95cec6fd1c697b9671997c5c2..87edfbfbebe146c81cffe20aa725dd0033945112 100644 --- a/civicrm/packages/DB/DataObject.php +++ b/civicrm/packages/DB/DataObject.php @@ -2303,6 +2303,7 @@ class DB_DataObject extends DB_DataObject_Overload // change the connection and results charsets to UTF-8 if we're using MySQL 4.1+ $civicrmConfig = CRM_Core_Config::singleton(); $this->query("/*!40101 SET NAMES utf8 */"); + $this->query("/*!50503 SET NAMES utf8mb4 */"); if (!empty($_DB_DATAOBJECT['CONFIG']['debug'])) { $this->debug(serialize($_DB_DATAOBJECT['CONNECTIONS']), "CONNECT",5); @@ -2415,16 +2416,22 @@ class DB_DataObject extends DB_DataObject_Overload $result = $DB->query($string); } catch (PEAR_Exception $e) { + if ($tries == 0) { + // The original sin was what triggered the retry. Sometimes the retry fails because mysql has done an internal rollback + // of previous queries in the transaction so it has essentially failed to recover from the deadlock. If we can't + // recover we should return the original error. + $firstError = $e; + } // CRM-21489 If we have caught a DB lock - let it go around the loop until our tries limit is hit. // else rethrow the exception. The 2 locks we are looking at are mysql code 1205 (lock) and // 1213 (deadlock). $dbErrorMessage = $e->getCause()->getUserInfo(); if (!stristr($dbErrorMessage, 'nativecode=1205') && !stristr($dbErrorMessage, 'nativecode=1213')) { - throw $e; + throw $firstError; } $message = (stristr($dbErrorMessage, 'nativecode=1213') ? 'Database deadlock encountered' : 'Database lock encountered'); if (($tries + 1) === $maxTries) { - throw new CRM_Core_Exception($message, 0, array('sql' => $string, 'trace' => $e->getTrace())); + throw new CRM_Core_Exception($message, 0, array('sql' => $string, 'trace' => $firstError->getTrace())); } CRM_Core_Error::debug_log_message("Retrying after $message hit on attempt " . ($tries + 1) . ' at query : ' . $string); continue; diff --git a/civicrm/packages/HTML/QuickForm/hierselect.php b/civicrm/packages/HTML/QuickForm/hierselect.php index 21e4110aa7dd85ce21e21e203b604a166ecfbf3b..c7ce5e199f1b3034c387123b5e35ca42dac2c63b 100644 --- a/civicrm/packages/HTML/QuickForm/hierselect.php +++ b/civicrm/packages/HTML/QuickForm/hierselect.php @@ -259,7 +259,10 @@ class HTML_QuickForm_hierselect extends HTML_QuickForm_group */ function setValue($value) { - $this->_nbElements = count($value); + // $value could be a string or an array - prior to php 7.2 count handled both, returning 0 for NULL + // or an empty array. + // https://stackoverflow.com/questions/20257983/why-the-count-function-returns-1-for-false-and-0-for-null + $this->_nbElements = is_array($value) ? count($value) : ($value === NULL ? 0 : 1); parent::setValue($value); $this->_setOptions(); } // end func setValue diff --git a/civicrm/release-notes.md b/civicrm/release-notes.md index 75f98c7dff4e32a7d0cf85b9611ab858a9832ae7..c6185f5755f5f05e89b3434e7543b94cb4a5cd7e 100644 --- a/civicrm/release-notes.md +++ b/civicrm/release-notes.md @@ -15,6 +15,17 @@ Other resources for identifying changes are: * https://github.com/civicrm/civicrm-joomla * https://github.com/civicrm/civicrm-wordpress +# CiviCRM 5.18.0 + +Released October 2, 2019 + +- **[Synopsis](release-notes/5.18.0.md#synopsis)** +- **[Features](release-notes/5.18.0.md#features)** +- **[Bugs resolved](release-notes/5.18.0.md#bugs)** +- **[Miscellany](release-notes/5.18.0.md#misc)** +- **[Credits](release-notes/5.18.0.md#credits)** +- **[Feedback](release-notes/5.18.0.md#feedback)** + ## CiviCRM 5.17.5 Released September 26, 2019 diff --git a/civicrm/release-notes/5.18.0.md b/civicrm/release-notes/5.18.0.md new file mode 100644 index 0000000000000000000000000000000000000000..35178222dded741e2d7d30a0bfb65e4956d2b21a --- /dev/null +++ b/civicrm/release-notes/5.18.0.md @@ -0,0 +1,876 @@ +# CiviCRM 5.18.0 + +Released October 2, 2019 + +- **[Synopsis](#synopsis)** +- **[Features](#features)** +- **[Bugs resolved](#bugs)** +- **[Miscellany](#misc)** +- **[Credits](#credits)** +- **[Feedback](#feedback)** + +## <a name="synopsis"></a>Synopsis + +| *Does this version...?* | | +|:--------------------------------------------------------------- |:-------:| +| Fix security vulnerabilities? | no | +| **Change the database schema?** | **yes** | +| **Alter the API?** | **yes** | +| Require attention to configuration options? | no | +| **Fix problems installing or upgrading to a previous version?** | **yes** | +| **Introduce features?** | **yes** | +| **Fix bugs?** | **yes** | + +## <a name="features"></a>Features + +### Core CiviCRM + +- **Enable view/revert delete action for detail logging + ([15045](https://github.com/civicrm/civicrm-core/pull/15045))** + + If detailed logging is enabled, you can now view and revert deleted + information. + +- **Download Bower dependencies using Composer + ([dev/drupal#8](https://lab.civicrm.org/dev/drupal/issues/8): + [15044](https://github.com/civicrm/civicrm-core/pull/15044))** + + This improves performance and caching by downloading Javascript libraries + using Composer with `composer-downloads-plugin` and specified zip files rather + than Bower. + +- **Add `hook_civicrm_pre` and `hook_civicrm_post` to Domain create and edit + operations ([dev/core#1203](https://lab.civicrm.org/dev/core/issues/1203): + [15104](https://github.com/civicrm/civicrm-core/pull/15104))** + + Makes it so one can detect when a new Domain has been created or when a Domain + has been edited with the usual `hook_civicrm_pre` and `hook_civicrm_post` + callbacks. + +- **Api support for deduping + (Work Towards [dev/core#1230](https://lab.civicrm.org/dev/core/issues/1230): + [15196](https://github.com/civicrm/civicrm-core/pull/15196), + [15188](https://github.com/civicrm/civicrm-core/pull/15188), + [15187](https://github.com/civicrm/civicrm-core/pull/15187), + [15227](https://github.com/civicrm/civicrm-core/pull/15227) and + [15154](https://github.com/civicrm/civicrm-core/pull/15154))** + + Work toward improving the new API support for deduping including: not + geocoding when merging for performance reasons, giving contacts with 'merge + duplicate contacts' permission to get dedupe rules, ensuring the API call + Dedupe.getstatistics requires "Access CiviCRM" and adds a check for 'force + merge duplicate contacts' if mode is aggressive. + +- **Add cid parameter in custom group form url & set it for Activity form + ([dev/core#752](https://lab.civicrm.org/dev/core/issues/752): + [15012](https://github.com/civicrm/civicrm-core/pull/15012))** + + Adds a contact id parameter (cid=) when loading custom data via back end forms + so that hooks can modify behavior based on the `contact_id` being viewed. + +- **Make report listing actions links hookable + ([dev/core#1077](https://lab.civicrm.org/dev/core/issues/1077): + [15074](https://github.com/civicrm/civicrm-core/pull/15074))** + + The actions list on the report listing screen can now be altered by developers + using `hook_civicrm_links`. + +- **Fixes inconsistency between constituency summary and constituency detail + ([15222](https://github.com/civicrm/civicrm-core/pull/15222))** + + This improves the consistency of how the "Print Report" action link functions + on the reports listing. Before this change, some "Print Report" links would + take the user to the report in print view, and some would trigger a print + pop-up. + +- **Add index to civicrm_contact.created_date & modified_date + ([15203](https://github.com/civicrm/civicrm-core/pull/15203))** + + This adds an index to the `created_date` and `modified_date` columns in the + `civicrm_contact` table. + +- **Added field title for Cache table + ([15204](https://github.com/civicrm/civicrm-core/pull/15204))** + + The Data Access Object for the `civicrm_cache` table now stores titles for + each field. + +- **Allow Manual Geo Code flag to be exported + ([14998](https://github.com/civicrm/civicrm-core/pull/14998))** + + The field denoting that an address has been manually geocoded can now be + exported. + +- **Use merge duplicate contacts as api permission for merging + ([15155](https://github.com/civicrm/civicrm-core/pull/15155))** + + Changes the API call `Contact.merge` to require 'merge duplicate contacts' + instead of 'Administer CiviCRM'. + +- **Adjust permissions on dedupe exception api to 'merge duplicate contacts' + ([15157](https://github.com/civicrm/civicrm-core/pull/15157))** + + The API for managing dedupe exceptions now requires the permission "merge + duplicate contacts" instead of "Administer CiviCRM". + +- **Open up permissions on Dedupe.getduplicates + ([15152](https://github.com/civicrm/civicrm-core/pull/15152))** + + Less restrictive permissions on the `Dedupe.getduplicates` API (currently only + used from unit tests) specifically moves from requiring the permission + "Administer CiviCRM" to "Access CiviCRM". + +- **Fix inconsistencies in duplicate retrieval + ([15160](https://github.com/civicrm/civicrm-core/pull/15160))** + + Ensures the API call `Dedupe.getduplicates` respects both 'limit' and + 'search_limit' parameters. + +- **Error log improvements: Provide priority level + ([14995](https://github.com/civicrm/civicrm-core/pull/14995))** + + Improves error logging by adding the ability to pass a priority level argument + to `CRM_Core_Error::debug_var()`. + +- **Improve deadlock error handling + ([258](https://github.com/civicrm/civicrm-packages/pull/258))** + + Improves deadlock error handling by capturing the error when the deadlock is + first hit so the backtrace is retained. + +- **Better error handling in CRM_Utils_JS::decode + ([15145](https://github.com/civicrm/civicrm-core/pull/15145))** + + Improves handling of malformed Javascript so as to reduce PHP notices. + +- **Replace some calls to CRM_Core_Error::fatal with exceptions + ([15156](https://github.com/civicrm/civicrm-core/pull/15156))** + + Instead of exiting with a fatal error, certain dedupe error situations now + throw an exception. + +### CiviEvent + +- **Creating an event clears the cache + ([dev/event#14](https://lab.civicrm.org/dev/event/issues/14): + [15140](https://github.com/civicrm/civicrm-core/pull/15140))** + + This change improves performance by not clearing caches every time an event is + created. + +### CiviMembership + +- **Convert jcalendar date fields to date picker for membership fields to + support date picker conversion + ([15177](https://github.com/civicrm/civicrm-core/pull/15177), + [15186](https://github.com/civicrm/civicrm-core/pull/15186), + [15198](https://github.com/civicrm/civicrm-core/pull/15198) and + [15200](https://github.com/civicrm/civicrm-core/pull/15200))** + + Date fields on membership search screens now use datepicker rather than + jCalendar. + + The `join_date` column on the `civicrm_membership` table is now keyed as + `membership_join_date` within the DAO in order to support the change to date + picker format for Membership date fields. + +- **Add default domain to membershiptype API + ([15120](https://github.com/civicrm/civicrm-core/pull/15120))** + + The domain ID now defaults to the current domain when using the membership + type API. + +- **Fix readability & caching on + CRM_Contact_BAO_Relationship::isInheritedMembershipInvalidated + ([15061](https://github.com/civicrm/civicrm-core/pull/15061))** + + Improves caching and performance when calculating inherited memberships. + +### CiviPledge + +- **Update Pledge XML to support date picker conversion + ([15180](https://github.com/civicrm/civicrm-core/pull/15180))** + + Updates the XML and associated files to support the change to date picker + format for Pledge date fields. + +### Backdrop Integration + +- **Fail more gracefully when upgrading on PHP5.x + ([98](https://github.com/civicrm/civicrm-backdrop/pull/98))** + + Provides a clearer error when someone tries to upgrade with PHP 5.x. + +### Drupal Integration + +- **Automatically tag the drupal-8 repository + (Work Towards [dev/release#9](https://lab.civicrm.org/dev/release/issues/9): + [15149](https://github.com/civicrm/civicrm-core/pull/15149))** + + Continues work to automatically tag a Drupal8 version when new CiviCRM + versions are released as is done for other CMS's. + +- **Error when upgrading to 5.16.0 + ([dev/drupal#79](https://lab.civicrm.org/dev/drupal/issues/79): + [583](https://github.com/civicrm/civicrm-drupal/pull/583))** + + Provides a clearer error when someone tries to upgrade with PHP 5.x. + +## <a name="bugs"></a>Bugs resolved + +### Core CiviCRM + +- **Warnings on importing contacts - PHP 7.2 + (Work Towards [dev/core#772](https://lab.civicrm.org/dev/core/issues/772): + [262](https://github.com/civicrm/civicrm-packages/pull/262))** + + This fixes a PHP warning on PHP 7.2 using hierarchical select fields, such as + selecting the matching fields for import columns. Some fields have no fields + nested below them, and those would trigger an error on the `count()` function. + +- **Warnings on CRM_Contribute_Import_Parser re countable + ([dev/core#1001](https://lab.civicrm.org/dev/core/issues/1001): + [14989](https://github.com/civicrm/civicrm-core/pull/14989))** + + Fixes a few PHP 7.2 count warnings when importing. + +- **Changing the label for the Inbound Email activity type lets you edit/delete + them even if the permission disallows + ([dev/core#1123](https://lab.civicrm.org/dev/core/issues/1123): + [15240](https://github.com/civicrm/civicrm-core/pull/15240) and + [15147](https://github.com/civicrm/civicrm-core/pull/15147))** + +- **Regression: Can't use CiviCRM menu on 5.16.0 + ([dev/core#1182](https://lab.civicrm.org/dev/core/issues/1182): + [15020](https://github.com/civicrm/civicrm-core/pull/15020) and + [15019](https://github.com/civicrm/civicrm-core/pull/15019))** + + Fixes a bug in CiviCRM 5.16.0 where a race condition was causing the CiviCRM + Admin Menu to break. + +- **csv import only import one phone number + ([dev/core#1187](https://lab.civicrm.org/dev/core/issues/1187): + [15190](https://github.com/civicrm/civicrm-core/pull/15190))** + + Fixes a bug whereby one phone number is not imported if 2 of the same location + type but different phone types are in an import. + +- **Fix Psalm issue Class or interface CiviCRM_API3_Exception does not exist + ([dev/core#1188](https://lab.civicrm.org/dev/core/issues/1188): + [15043](https://github.com/civicrm/civicrm-core/pull/15043))** + + Ensures that the Psalm Autoloader can find `CiviCRM_API3_Exception`. + +- **File attachment uploads - pptx issue + ([dev/core#1190](https://lab.civicrm.org/dev/core/issues/1190): + [15239](https://github.com/civicrm/civicrm-core/pull/15239))** + + Fixes the upgrade function for adding ".pptx" to the list of safe file types. + +- **ENOTICE when creating activity from contact search results / aka Repeat + Activity accordion section missing when using Add Activity from contact search + results ([dev/core#1192](https://lab.civicrm.org/dev/core/issues/1192): + [15079](https://github.com/civicrm/civicrm-core/pull/15079))** + + Fixes a PHP notice when using the "Add Activity" action from the contact + search results list. + +- **CiviCRM Dashboard does not respect multiple domains + ([dev/core#1200](https://lab.civicrm.org/dev/core/issues/1200): + [15099](https://github.com/civicrm/civicrm-core/pull/15099))** + + For sites with multisite enabled ensures that the CiviCRM Dashboard respects + multiple domains and shows unique dashlets depending on what domain you are + using. + +- **Contact subtype is removed after being cached incorrectly + ([dev/core#1222](https://lab.civicrm.org/dev/core/issues/1222): + [15171](https://github.com/civicrm/civicrm-core/pull/15171))** + + Ensures the static cache is cleared whenever updating or deleting a DAO + object. + +- **Regression: Searching on Email broken in advanced search + ([dev/core#1244](https://lab.civicrm.org/dev/core/issues/1244): + [15255](https://github.com/civicrm/civicrm-core/pull/15255))** + + This fixes a problem where attempting to search on email on the Advanced + search form resulted in a warning and no results. + +- **Trim form values when adding LIKE operator + ([15275](https://github.com/civicrm/civicrm-core/pull/15275))** + + Fixes a 5.17 regression whereby the email string is no longer being trimmed + when searching. + +- **Ensure filtering on email via the api looks for an exact match + ([15276](https://github.com/civicrm/civicrm-core/pull/15276))** + + Fixes a released regression whereby a wildcard was being added to API + Contact.get requests with the email parameter. + +- **Fix fatal when saving import mapping with a relationship but 'Primary' + location type ([15115](https://github.com/civicrm/civicrm-core/pull/15115))** + + When an import column was mapped to a field with the "Primary" location type + that was on a related contact, it would result in a fatal error. + +- **Fix export header for 'Contact ID' + ([15118](https://github.com/civicrm/civicrm-core/pull/15118))** + + This ensures when exporting a contact id column the header is "Contact ID" not + "contact_id". + +- **Changed ClassName for ACL cache + ([15193](https://github.com/civicrm/civicrm-core/pull/15193))** + + Ensures `civicrm_acl_cache` and `civicrm_cache` use different entity names. + +- **Set contact communication_style_id as importable + ([15205](https://github.com/civicrm/civicrm-core/pull/15205))** + + Ensures the "Contact Communication Style" is visible in profile view mode. + +- **Incorporate searchLimit in dedupe cacheKey + ([15185](https://github.com/civicrm/civicrm-core/pull/15185))** + + When you change the search limit after a duplicate search has been performed, + this ensures that a new search is run. + +- **Allow for the deselection of sorting filters + ([15029](https://github.com/civicrm/civicrm-core/pull/15029))** + + Fixes a bug where removing sorting filters on reports and refreshing the + results would nevertheless retain the sorting filters. + +- **CRM_Utils_Array::crmInArray() should recurse properly + ([dev/core#1196](https://lab.civicrm.org/dev/core/issues/1196): + [15092](https://github.com/civicrm/civicrm-core/pull/15092))** + +- **Add ts() to deceased string + ([15211](https://github.com/civicrm/civicrm-core/pull/15211))** + + The word "deceased" when appended to a contact's name is now translatable. + +- **Fatal Error in "Search Builder" if "Household" Contact type is disabled. + ([dev/core#1246](https://lab.civicrm.org/dev/core/issues/1246): + [15289](https://github.com/civicrm/civicrm-core/pull/15289))** + +- **Do not show Activity Separation on when viewing an Activity + ([15046](https://github.com/civicrm/civicrm-core/pull/15046))** + + The option to create separate activities for each contact, only applicable + when creating a new activity, would erroneously appear when viewing an + activity. + +- **Activity profile on Update multiple activities action displays duplicate + assignees ([dev/core#1185](https://lab.civicrm.org/dev/core/issues/1185): + [15035](https://github.com/civicrm/civicrm-core/pull/15035))** + + The list of assignees would display all of the assignees for each previous row + in addition to the assignee(s) for that activity. + +- **Ensure that civicrm_dashboard has a foreign key to civicrm_domain + ([15119](https://github.com/civicrm/civicrm-core/pull/15119))** + +- **Manage Group search message fix + ([15052](https://github.com/civicrm/civicrm-core/pull/15052))** + + When no the group listing is filtered and no groups match the criteria, the + message says that more clearly rather than stating there are no groups on the + site. + +### CiviCampaign + +- **Actions in campaign dashboard not working with pop-up disabled + ([dev/core#1233](https://lab.civicrm.org/dev/core/issues/1233): + [15233](https://github.com/civicrm/civicrm-core/pull/15233))** + + Ensures users with pop ups deactivated can edit and delete campaigns. + +### CiviCase + +- **Proposal to fix longstanding name vs label problems for case roles (Work + Towards [dev/core#1046](https://lab.civicrm.org/dev/core/issues/1046): + [15192](https://github.com/civicrm/civicrm-core/pull/15192) and + [15182](https://github.com/civicrm/civicrm-core/pull/15182))** + + These changes work towards fixing the label being used as the name in some + places in CiviCase by allowing for an override tag in the xml to specify the + actual "name". + +- **Changing a civicase activity's label breaks the max_instances check + (Work Towards [dev/core#1116](https://lab.civicrm.org/dev/core/issues/1116): + [14999](https://github.com/civicrm/civicrm-core/pull/14999), + [15002](https://github.com/civicrm/civicrm-core/pull/15002), + [15000](https://github.com/civicrm/civicrm-core/pull/15000) and + [15032](https://github.com/civicrm/civicrm-core/pull/15032))** + + Refactors and cleans up code in preparation for fixing a bug where CiviCase + activity's label breaks the max_instances check. + +- **Fix search for case tags that are part of tag sets + ([15212](https://github.com/civicrm/civicrm-core/pull/15212))** + + Fixes a DB Error when searching for tags that are a part of a tag set. + +- **Switch to relationship BAO when modifying relationships in change case + status so we don't bypass hooks + ([15030](https://github.com/civicrm/civicrm-core/pull/15030))** + +- **Word Replacements not working on manage case Roles + ([dev/core#1218](https://lab.civicrm.org/dev/core/issues/1218): + [15161](https://github.com/civicrm/civicrm-core/pull/15161))** + +### CiviContribute + +- **Renaming a price option / fee level breaks event participant lists + ([CRM-17182](https://issues.civicrm.org/jira/browse/CRM-17182): + [15064](https://github.com/civicrm/civicrm-core/pull/15064) and + [15350](https://github.com/civicrm/civicrm-core/pull/15350))** + + Fixes a bug where the `fee_amount` was being changed whenever a label was + changed and moves from searching based on regex on the `fee_amount` column to + searching based on the `price_field_value` id. + +- **Add pre/post hooks for price set / field/option + ([dev/core#870](https://lab.civicrm.org/dev/core/issues/870): + [15076](https://github.com/civicrm/civicrm-core/pull/15076))** + + The `hook_civicrm_pre` and `hook_civicrm_post` hooks get invoked when adding + price sets, fields, and options. + +- **Event/Contribution amounts are duplicated when the form is saved + ([dev/core#1240](https://lab.civicrm.org/dev/core/issues/1240): + [15245](https://github.com/civicrm/civicrm-core/pull/15245))** + + Fixes a bug where saving the "amounts" tab of either an event or contribution + page (when using that form to enter options, rather than a price set) results in the + duplication of the amount options listed. + +- **Fix PayPalImpl Contribution Status PseudoConstant for non-English + ([15164](https://github.com/civicrm/civicrm-core/pull/15164))** + + Ensures contribution statuses are set correctly for sites using PayPal Express + and a language other than English by switching to using the name property + instead of the label. + +- **Fix an HTML error in Calculate.tpl + ([15102](https://github.com/civicrm/civicrm-core/pull/15102))** + + This resolves a `<span>` that was not closed correctly on the calculation of a + price set's total amount due. + +- **Use api to create activity and removed hardcoded status id + ([14621](https://github.com/civicrm/civicrm-core/pull/14621))** + + When exporting an accounting batch, the activity that is created is now done + so using the API, and it uses the status name `Completed` rather than a + hard-coded status ID `2`. + +- **Fix wrong variable in check for profiles on contributionpage + ([15093](https://github.com/civicrm/civicrm-core/pull/15093))** + + Ensures the correct variable is being checked for pre profile types when + configuring a Contribution Page. + +- **Batch payment page breaks when an exported activity has no file to download + ([dev/financial#58](https://lab.civicrm.org/dev/financial/issues/58): + [14367](https://github.com/civicrm/civicrm-core/pull/14367))** + +- **Stop adding a refund payment from creating extraneous financial items + ([15143](https://github.com/civicrm/civicrm-core/pull/15143))** + +### CiviEvent + +- **Most recent contact note exposed in event confirmation emails + ([dev/event#10](https://lab.civicrm.org/dev/event/issues/10): + [15060](https://github.com/civicrm/civicrm-core/pull/15060))** + + Fixes a bug where when submitting an event registration which contains a + profile which contains a note field. If the note was left blank, then the + confirmation/notification emails would contain the most recent note in the + contact's record, potentially exposing confidential information. + +- **Custom field values for a new Event based on an Event Template are not + checked causing false validation message and Event not to + save ([dev/core#1241](https://lab.civicrm.org/dev/core/issues/1241): + [15296](https://github.com/civicrm/civicrm-core/pull/15296))** + +- **Confirmation emails include flawed subtitle for post-profiles + ([dev/event#15](https://lab.civicrm.org/dev/event/issues/15): [#15380](https://github.com/civicrm/civicrm-core/pull/15380))** + + Fixes a regression from 5.17.0 when sending a confirmation email. + The confirmation email includes subsections to summarize any + post-profile data, but the title was miscomputed. This manifested + as either a page crash or an inaccurate title. + +### CiviGrant + +- **Grant in Edit mode doesn't show the associated contact + ([dev/core#1065](https://lab.civicrm.org/dev/core/issues/1065): + [15238](https://github.com/civicrm/civicrm-core/pull/15238) and + [15209](https://github.com/civicrm/civicrm-core/pull/15209))** + + Ensures that the associated contact field is shown when editing a grant. + +- **Fixes for taking dynamic form name in grant search + ([15075](https://github.com/civicrm/civicrm-core/pull/15075))** + + This removes the hard-coded form name when retrieving the search results in + preparation for a search action. + +### CiviMail + +- **SMTP help text is misleading - references the wrong admin screen + ([dev/core#879](https://lab.civicrm.org/dev/core/issues/879): + [15165](https://github.com/civicrm/civicrm-core/pull/15165))** + + Fixes up the help text displayed when testing the SMTP configuration fails. + +- **Remove template field if using Mosaico in non shoreditch mode + ([14927](https://github.com/civicrm/civicrm-core/pull/14927))** + +### CiviMember + +- **Fix metadata on member export + ([14916](https://github.com/civicrm/civicrm-core/pull/14916))** + + Ensures when exporting memberships headings are set appropriately for the + following columns: `member_is_override`, `membership_recur_id` and + `max_related`. + +- **Incorrect line item created for back-end membership sign-up using price set + and CiviDiscount ([dev/core#860](https://lab.civicrm.org/dev/core/issues/860): + [15004](https://github.com/civicrm/civicrm-core/pull/15004))** + +- **[regression] Recurring contributions no longer properly update memberships + (on PayPal Pro, maybe others) + ([dev/membership#13](https://lab.civicrm.org/dev/membership/issues/13): + [15053](https://github.com/civicrm/civicrm-core/pull/15053))** + +- **Make sure inherited memberships are not themselves inherited + ([15114](https://github.com/civicrm/civicrm-core/pull/15114))** + + This prevents contacts from inheriting memberships that were inherited from + them. + +- **{Membership.Fee} appears on Membership Renewal Reminder emails with 9 + decimal places ([dev/core#377](https://lab.civicrm.org/dev/core/issues/377): + [14992](https://github.com/civicrm/civicrm-core/pull/14992))** + +### Drupal Integration + +- **Drupal8: getUrlPath: avoid relying on the deprecated 'q' variable + (Work Towards [dev/drupal#52](https://lab.civicrm.org/dev/drupal/issues/52): + [15268](https://github.com/civicrm/civicrm-core/pull/15268))** + + In Drupal8, the 'q' variable has been deprecated which has resulted in CiviCRM + throwing a bunch of PHP notices. This PR silences those notices while a more + long term fix is developed. + +### Joomla Integration + +- **Some error messages render a chunk of markup as plain text + ([dev/joomla#10](https://lab.civicrm.org/dev/joomla/issues/10): + [15159](https://github.com/civicrm/civicrm-core/pull/15159))** + + Removes Joomla-specific error display and use native CiviCRM display to avoid + some error messages rendering as plain text. + +- **PHP 7.2 countable warning after installation + ([dev/joomla#15](https://lab.civicrm.org/dev/joomla/issues/15): + [53](https://github.com/civicrm/civicrm-joomla/pull/53))** + +- **[Joomla 4.0] CiviCRM's CSS interferes with Joomla's top header background + colour ([dev/joomla#24](https://lab.civicrm.org/dev/joomla/issues/24): + [15137](https://github.com/civicrm/civicrm-core/pull/15137))** + +## <a name="misc"></a>Miscellany + +- **Swap CRM_Utils_Array::value for empty() in conditionals + ([15005](https://github.com/civicrm/civicrm-core/pull/15005))** + +- **Possible timing issue with test phpunit/api/v3/AttachmentTest::testCreate + ([dev/core#938](https://lab.civicrm.org/dev/core/issues/938): + [15216](https://github.com/civicrm/civicrm-core/pull/15216))** + +- **Change connection and results charsets to utf8mb4 on MySQL 5.5.3+ + ([241](https://github.com/civicrm/civicrm-packages/pull/241))** + +- **Fix upgrade version for #13487 + ([15031](https://github.com/civicrm/civicrm-core/pull/15031))** + +- **Update select2 to latest 3.x + patches + ([15054](https://github.com/civicrm/civicrm-core/pull/15054))** + +- **Further work on payment.create consolidation - always handle financials from + payment.create ([14673](https://github.com/civicrm/civicrm-core/pull/14673))** + +- **Extract function to create email activity when sending an email to contact + ([15133](https://github.com/civicrm/civicrm-core/pull/15133))** + +- **Extract cancelParticipant and cancelMembership functions in baseIPN + ([15134](https://github.com/civicrm/civicrm-core/pull/15134))** + +- **Rewrite subTypeInfo to use caching mechanism + ([14715](https://github.com/civicrm/civicrm-core/pull/14715))** + +- **providing clear indication that civicrm_engage module is deprecated. + ([582](https://github.com/civicrm/civicrm-drupal/pull/582))** + +- **distmaker - Finish migrating bower.json => composer.json + ([15148](https://github.com/civicrm/civicrm-core/pull/15148))** + +- **Switch recordAdditionalPayment fully over to api + ([14408](https://github.com/civicrm/civicrm-core/pull/14408))** + +- **Add note about testRenewMembership failing on certain days + ([15167](https://github.com/civicrm/civicrm-core/pull/15167))** + +- **Someimes ya just gotta say enough already + ([15175](https://github.com/civicrm/civicrm-core/pull/15175))** + +- **Extend loadSavedMapping to check defaults + ([15179](https://github.com/civicrm/civicrm-core/pull/15179))** + +- **Initial refactor of BaseIPN + ([15129](https://github.com/civicrm/civicrm-core/pull/15129))** + +- **Convert pledge date fields to use datepicker rather than jcalendar + ([15170](https://github.com/civicrm/civicrm-core/pull/15170))** + +- **Use metadata for pledgeDateRange fields + ([15191](https://github.com/civicrm/civicrm-core/pull/15191))** + +- **Add minimal test for testExportFinancialBatch + ([15136](https://github.com/civicrm/civicrm-core/pull/15136))** + +- **Code cleanup in CRM_Core_Permission::check + ([15141](https://github.com/civicrm/civicrm-core/pull/15141))** + +- **Event confirm - (very) minor cleanup + test + ([15010](https://github.com/civicrm/civicrm-core/pull/15010))** + +- **Stabalize Attachment API Test + ([15066](https://github.com/civicrm/civicrm-core/pull/15066))** + +- **Remove ?last? instances of ->free() + ([dev/core#562](https://lab.civicrm.org/dev/core/issues/562): + [14990](https://github.com/civicrm/civicrm-core/pull/14990))** + +- **Add myself to the contributor list + ([15036](https://github.com/civicrm/civicrm-core/pull/15036))** + +- **Remove silly dumb unreachable lines + ([15033](https://github.com/civicrm/civicrm-core/pull/15033))** + +- **Deprecate CRM_Core_Config::addressSequence() + ([15126](https://github.com/civicrm/civicrm-core/pull/15126))** + +- **Deprecate CRM_Core_Config::defaultContactCountry and + defaultContactCountryName + ([15127](https://github.com/civicrm/civicrm-core/pull/15127))** + +- **Use metadata for dataPatterns + ([15224](https://github.com/civicrm/civicrm-core/pull/15224))** + +- **SyntaxConformanceTest::testSqlOperators - Skip "Dedupe" entity on MySQL 5.5 + ([15234](https://github.com/civicrm/civicrm-core/pull/15234))** + +- **Add in 5.17.1 Release notes and migrate .tpl file for 5.17.1 to 5.18 to + support upgrade + ([15253](https://github.com/civicrm/civicrm-core/pull/15253))** + +- **(NFC) Add comments to relate to gitlab ticket + ([dev/core#927](https://lab.civicrm.org/dev/core/issues/927): + [15128](https://github.com/civicrm/civicrm-core/pull/15128))** + +- **Remove unused method CRM_Contact_BAO_Contact_Utils::maxLocations + ([15091](https://github.com/civicrm/civicrm-core/pull/15091))** + +- **Remove unused Selenium binaries + ([263](https://github.com/civicrm/civicrm-packages/pull/263))** + +- **Remove a few unused scripts from tools/bin/scripts + ([15078](https://github.com/civicrm/civicrm-core/pull/15078))** + +- **Remove deprecated unused function. + ([15070](https://github.com/civicrm/civicrm-core/pull/15070))** + +- **Remove unused skipRedirect param + ([15125](https://github.com/civicrm/civicrm-core/pull/15125))** + +- **[clean up][ export] Remove membership_auto_renew from defaultReturn + properties ([14980](https://github.com/civicrm/civicrm-core/pull/14980))** + +- **[Ref] [Import] Use processor to determine website type, location type, test + ([15116](https://github.com/civicrm/civicrm-core/pull/15116))** + +- **[Import] [ref] - minor cleanup to reduce code complexity + ([15097](https://github.com/civicrm/civicrm-core/pull/15097))** + +- **[ref] [ import] Extend tests & simpler retrieval to relationship_type_id + ([15130](https://github.com/civicrm/civicrm-core/pull/15130))** + +- **[REF] Import - minor cleanup - generate js on the processor class + ([15183](https://github.com/civicrm/civicrm-core/pull/15183))** + +- **[Import] Minor cleanup on membership import + ([15013](https://github.com/civicrm/civicrm-core/pull/15013))** + +- **[Import][ref] Minor code improvement - move setDefaults to processor + ([15189](https://github.com/civicrm/civicrm-core/pull/15189))** + +- **[Ref] [Import] more code cleanup + ([15219](https://github.com/civicrm/civicrm-core/pull/15219))** + +- **[Ref] [Import] Final round in the cleanup Load Mapping form epic + ([15226](https://github.com/civicrm/civicrm-core/pull/15226))** + +- **[Import] [REF] code cleanup & test on the code to 'guess the intended + field from the column name' + ([15220](https://github.com/civicrm/civicrm-core/pull/15220))** + +- **[REF] [Import] Minor cleanup on status setting. + ([15015](https://github.com/civicrm/civicrm-core/pull/15015))** + +- **[REF] [Import] extract saved mapping code to parent class + ([15017](https://github.com/civicrm/civicrm-core/pull/15017))** + +- **[Import] [Cleanup] remove unused parameters + ([14981](https://github.com/civicrm/civicrm-core/pull/14981))** + +- **[Ref] [Import] move metadata calculations to a trait + ([15018](https://github.com/civicrm/civicrm-core/pull/15018))** + +- **[Test] [Ref] [Import]Add wrapper class for importProcessor + ([15028](https://github.com/civicrm/civicrm-core/pull/15028))** + +- **Refactor CRM_Contact_BAO_Relationship::add to autoload missing params from + existing record ([15103](https://github.com/civicrm/civicrm-core/pull/15103) + and [15123](https://github.com/civicrm/civicrm-core/pull/15123))** + +- **[Ref] Extract addInheritedMembership + ([15113](https://github.com/civicrm/civicrm-core/pull/15113))** + +- **[REF] minor code refactor on import - Pass ProcessorObject into + loadSavedMapping & use it to load the formName + ([15068](https://github.com/civicrm/civicrm-core/pull/15068))** + +- **Minor refactor of 'Pending' parameter for processMembership + ([15124](https://github.com/civicrm/civicrm-core/pull/15124))** + +- **[REF] Very minor code cleanup on import code with good test cover + ([15173](https://github.com/civicrm/civicrm-core/pull/15173))** + +- **[REF] Move clone template functionality from api to bao + ([15163](https://github.com/civicrm/civicrm-core/pull/15163))** + +- **[REF] Extract chunk of code relating to whether to disabled an inherited + relationship ([14955](https://github.com/civicrm/civicrm-core/pull/14955))** + +- **[REF] Move calculation of js for import fields WITH relationship keys to + processor. ([15218](https://github.com/civicrm/civicrm-core/pull/15218))** + +- **[Datepicker][REF] Convert mailing date field on mailing search screen… + ([15181](https://github.com/civicrm/civicrm-core/pull/15181))** + +- **[Ref] Import use process for relationship defaults, add test + ([15215](https://github.com/civicrm/civicrm-core/pull/15215))** + +- **[REF] extract send receipt in MembershipRenewal fn + ([15117](https://github.com/civicrm/civicrm-core/pull/15117))** + +- **[NFC] Fix test syntax + ([15067](https://github.com/civicrm/civicrm-core/pull/15067))** + +- **[NFC] swap instances where double = is used but it should be triple = + ([15049](https://github.com/civicrm/civicrm-core/pull/15049))** + +- **[NFC] Update Upgrade Template to use short array syntax + ([15057](https://github.com/civicrm/civicrm-core/pull/15057))** + +- **[NFC] Remove redundant annotation + ([15172](https://github.com/civicrm/civicrm-core/pull/15172))** + +- **(NFC) assertPhpSupport - Code cleanup + ([164](https://github.com/civicrm/civicrm-wordpress/pull/164))** + +- **(NFC) civicrm.drush.inc - Cleanup style + ([99](https://github.com/civicrm/civicrm-backdrop/pull/99))** + +- **[NFC] Update Default report instances that filter on join date to be … + ([15247](https://github.com/civicrm/civicrm-core/pull/15247))** + +- **[NFC] Add ImportProcessor class & unit tests + extend existing cover + ([15072](https://github.com/civicrm/civicrm-core/pull/15072))** + +- **[NFC] Update the APIv3 documentation links. + ([15077](https://github.com/civicrm/civicrm-core/pull/15077))** + +- **(NFC) GenericAssertionsTrait - Improve docblocks + ([15071](https://github.com/civicrm/civicrm-core/pull/15071))** + +- **[NFC] Update Examples + ([15085](https://github.com/civicrm/civicrm-core/pull/15085))** + +- **[Test] [NFC] upgrade remaining export tests + ([15095](https://github.com/civicrm/civicrm-core/pull/15095))** + +- **[Test] Bring to life dormant test + ([15150](https://github.com/civicrm/civicrm-core/pull/15150))** + +- **[TEST] Enable apiv4 testing for GroupNesting and GroupOrganization entities + ([15217](https://github.com/civicrm/civicrm-core/pull/15217))** + +- **[Test] Demonstrate the truthiness of CRM_Utils_System::isNull + ([15027](https://github.com/civicrm/civicrm-core/pull/15027))** + +- **Unit test for custom date parsing + ([14988](https://github.com/civicrm/civicrm-core/pull/14988))** + +- **[NFC] [Test] dev/core#1098 Add unit test & code comments relating to the + slow activity search + ([15016](https://github.com/civicrm/civicrm-core/pull/15016))** + +- **[Import] [Test] Initial test on loadSavedMapping function. + ([15050](https://github.com/civicrm/civicrm-core/pull/15050))** + +- **[Test] Tolerance parameter in attachmenttest needs to be one higher for + integers ([15069](https://github.com/civicrm/civicrm-core/pull/15069))** + +- **[Test] Fix Last_name in CiviUnitTestCase::activityCreate + ([15112](https://github.com/civicrm/civicrm-core/pull/15112))** + +- **test for PR + ([15121](https://github.com/civicrm/civicrm-core/pull/15121))** + +## <a name="credits"></a>Credits + +This release was developed by the following code authors: + +19ATF77; AGH Strategies - Andrew Hunt; Agileware - Justin Freeman; Andrew +Thompson; Australian Greens - Seamus Lee; Caltha - Tomasz Pietrzkowski; +Christian Wach; Circle Interactive - Dave Jenkins, Pradeep Nayak, Reece Benson; +CiviCoop - Jaap Jansma; CiviCRM - Coleman Watts, Tim Otten; CiviDesk - Yashodha +Chaku; Coop SymbioTIC - Mathieu Lutfy; Dave D; Electronic Frontier Foundation - +Mark Burdett; Florian Kohrt; Greenpeace CEE - Patrick Figel; JMA Consulting - +Monish Deb; John Kingsnorth; Megaphone Technology Consulting - Jon Goldberg; MJW +Consulting - Matthew Wire; mmyriam; Onyemenam Ndubuisi; Progressive Technology +Project - Jamie McClelland; Tadpole Collective - Kevin Cristiano; Wikimedia +Foundation - Eileen McNaughton + +Most authors also reviewed code for this release; in addition, the following +reviewers contributed their comments: + +AGH Strategies - Alice Frumin; Agileware - Francis Whittle, Pengyi Zhang; +don-alejandro-z; Fuzion - Jitendra Purohit; iXiam - Luciano Spiegel; JMA +Consulting - Joe Murray; Nicol Wistreich; Semper IT - Karin Gerritsen; Squiffle +Consulting - Aidan Saunders; + +## <a name="feedback"></a>Feedback + +These release notes are edited by Alice Frumin and Andrew Hunt. If you'd like +to provide feedback on them, please log in to https://chat.civicrm.org/civicrm +and contact `@agh1`. diff --git a/civicrm/sql/civicrm.mysql b/civicrm/sql/civicrm.mysql index a3cf1c0588dfb7a10df81fde99a4d0a91ef3120f..14488af2433a082770129a7301db450d408ec031 100644 --- a/civicrm/sql/civicrm.mysql +++ b/civicrm/sql/civicrm.mysql @@ -764,6 +764,12 @@ CREATE TABLE `civicrm_contact` ( , sort_name , id ) + , INDEX `index_created_date`( + created_date + ) + , INDEX `index_modified_date`( + modified_date + ) , CONSTRAINT FK_civicrm_contact_primary_contact_id FOREIGN KEY (`primary_contact_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL, CONSTRAINT FK_civicrm_contact_employer_id FOREIGN KEY (`employer_id`) REFERENCES `civicrm_contact`(`id`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ; @@ -1732,7 +1738,7 @@ CREATE TABLE `civicrm_cxn` ( CREATE TABLE `civicrm_cache` ( - `id` int unsigned NOT NULL AUTO_INCREMENT , + `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique table ID', `group_name` varchar(32) NOT NULL COMMENT 'group name for cache element, useful in cleaning cache elements', `path` varchar(255) COMMENT 'Unique path name for cache element', `data` longtext COMMENT 'data associated with this path', @@ -3381,7 +3387,7 @@ CREATE TABLE `civicrm_dashboard` ( PRIMARY KEY (`id`) -, CONSTRAINT FK_civicrm_dashboard_domain_id FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain`(`id`) +, CONSTRAINT FK_civicrm_dashboard_domain_id FOREIGN KEY (`domain_id`) REFERENCES `civicrm_domain`(`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ; -- /******************************************************* diff --git a/civicrm/sql/civicrm_data.mysql b/civicrm/sql/civicrm_data.mysql index 375e6eec428ba0c7dcaebbbbe7e477bbb114bd6d..204eacab443739e4f2364a2a0ef83255c34f2f05 100644 --- a/civicrm/sql/civicrm_data.mysql +++ b/civicrm/sql/civicrm_data.mysql @@ -6437,7 +6437,7 @@ INSERT INTO civicrm_uf_field ( 10, 'soft_credit', 0, 0, 10, 'User and User Admin Only', 0, 0, NULL, 'Soft Credit', 'Contribution', NULL, NULL ), ( 10, 'soft_credit_type', 0, 0, 11, 'User and User Admin Only', 0, 0, NULL, 'Soft Credit Type', 'Contribution', NULL, NULL ), ( 11, 'membership_type', 1, 1, 1, 'User and User Admin Only', 0, 0, NULL, 'Membership Type', 'Membership', NULL, NULL ), - ( 11, 'join_date', 1, 1, 2, 'User and User Admin Only', 0, 0, NULL, 'Member Since', 'Membership', NULL, NULL ), + ( 11, 'membership_join_date', 1, 1, 2, 'User and User Admin Only', 0, 0, NULL, 'Member Since', 'Membership', NULL, NULL ), ( 11, 'membership_start_date', 0, 1, 3, 'User and User Admin Only', 0, 0, NULL, 'Start Date', 'Membership', NULL, NULL ), ( 11, 'membership_end_date', 0, 1, 4, 'User and User Admin Only', 0, 0, NULL, 'End Date', 'Membership', NULL, NULL ), ( 11, 'membership_source', 0, 0, 5, 'User and User Admin Only', 0, 0, NULL, 'Source', 'Membership', NULL, NULL ), @@ -23970,17 +23970,17 @@ VALUES INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Membership Summary', 'member/summary', 'Provides a summary of memberships by type and join date.', 'access CiviMember', 'a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Membership Summary', 'member/summary', 'Provides a summary of memberships by type and join date.', 'access CiviMember', 'a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Membership Details', 'member/detail', 'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.', 'access CiviMember', 'a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Membership Details', 'member/detail', 'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.', 'access CiviMember', 'a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Contribution and Membership Details', 'member/contributionDetail', 'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.', 'access CiviMember', 'a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Contribution and Membership Details', 'member/contributionDetail', 'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.', 'access CiviMember', 'a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) @@ -24050,4 +24050,4 @@ INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES ( @domainID, 'Survey Details', 'survey/detail', 'Detailed report for canvassing, phone-banking, walk lists or other surveys.', 'access CiviReport', 'a:39:{s:6:"fields";a:2:{s:9:"sort_name";s:1:"1";s:6:"result";s:1:"1";}s:22:"assignee_contact_id_op";s:2:"eq";s:25:"assignee_contact_id_value";s:0:"";s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:12:"survey_id_op";s:2:"in";s:15:"survey_id_value";a:0:{}s:12:"status_id_op";s:2:"eq";s:15:"status_id_value";s:1:"1";s:11:"custom_1_op";s:2:"in";s:14:"custom_1_value";a:0:{}s:11:"custom_2_op";s:2:"in";s:14:"custom_2_value";a:0:{}s:17:"custom_3_relative";s:1:"0";s:13:"custom_3_from";s:0:"";s:11:"custom_3_to";s:0:"";s:11:"description";s:75:"Detailed report for canvassing, phone-banking, walk lists or other surveys.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviReport";s:6:"groups";s:0:"";s:9:"domain_id";i:1;}'); -UPDATE civicrm_domain SET version = '5.17.5'; +UPDATE civicrm_domain SET version = '5.18.0'; diff --git a/civicrm/sql/civicrm_generated.mysql b/civicrm/sql/civicrm_generated.mysql index 96b54b644d5d25282f2bacda5d70affa9967c97f..570e310bdfc1c2ee2e822f60b02e61018a026172 100644 --- a/civicrm/sql/civicrm_generated.mysql +++ b/civicrm/sql/civicrm_generated.mysql @@ -399,7 +399,7 @@ UNLOCK TABLES; LOCK TABLES `civicrm_domain` WRITE; /*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */; -INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.17.5',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}'); +INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'5.18.0',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}'); /*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */; UNLOCK TABLES; @@ -1289,7 +1289,7 @@ UNLOCK TABLES; LOCK TABLES `civicrm_report_instance` WRITE; /*!40000 ALTER TABLE `civicrm_report_instance` DISABLE KEYS */; -INSERT INTO `civicrm_report_instance` (`id`, `domain_id`, `title`, `report_id`, `name`, `args`, `description`, `permission`, `grouprole`, `form_values`, `is_active`, `created_id`, `owner_id`, `email_subject`, `email_to`, `email_cc`, `header`, `footer`, `navigation_id`, `drilldown_id`, `is_reserved`) VALUES (1,1,'Constituent Summary','contact/summary',NULL,NULL,'Provides a list of address and telephone information for constituent records in your system.','view all contacts',NULL,'a:31:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:14:\"street_address\";s:1:\"1\";s:4:\"city\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:92:\"Provides a list of address and telephone information for constituent records in your system.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(2,1,'Constituent Detail','contact/detail',NULL,NULL,'Provides contact-related information on contributions, memberships, events and activities.','view all contacts',NULL,'a:25:{s:6:\"fields\";a:30:{s:9:\"sort_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";s:15:\"contribution_id\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:13:\"membership_id\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:20:\"membership_status_id\";s:1:\"1\";s:14:\"participant_id\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:21:\"participant_status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";s:25:\"participant_register_date\";s:1:\"1\";s:9:\"fee_level\";s:1:\"1\";s:10:\"fee_amount\";s:1:\"1\";s:15:\"relationship_id\";s:1:\"1\";s:20:\"relationship_type_id\";s:1:\"1\";s:12:\"contact_id_b\";s:1:\"1\";s:2:\"id\";s:1:\"1\";s:16:\"activity_type_id\";s:1:\"1\";s:7:\"subject\";s:1:\"1\";s:17:\"source_contact_id\";s:1:\"1\";s:18:\"activity_date_time\";s:1:\"1\";s:18:\"activity_status_id\";s:1:\"1\";s:17:\"target_contact_id\";s:1:\"1\";s:19:\"assignee_contact_id\";s:1:\"1\";}s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:90:\"Provides contact-related information on contributions, memberships, events and activities.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(3,1,'Activity Details','activity',NULL,NULL,'Provides a list of constituent activity including activity statistics for one/all contacts during a given date range(required)','view all contacts',NULL,'a:26:{s:6:\"fields\";a:6:{s:16:\"contact_assignee\";s:1:\"1\";s:14:\"contact_target\";s:1:\"1\";s:16:\"activity_type_id\";s:1:\"1\";s:16:\"activity_subject\";s:1:\"1\";s:18:\"activity_date_time\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:17:\"contact_source_op\";s:3:\"has\";s:20:\"contact_source_value\";s:0:\"\";s:19:\"contact_assignee_op\";s:3:\"has\";s:22:\"contact_assignee_value\";s:0:\"\";s:17:\"contact_target_op\";s:3:\"has\";s:20:\"contact_target_value\";s:0:\"\";s:15:\"current_user_op\";s:2:\"eq\";s:18:\"current_user_value\";s:1:\"0\";s:27:\"activity_date_time_relative\";s:10:\"this.month\";s:23:\"activity_date_time_from\";s:0:\"\";s:21:\"activity_date_time_to\";s:0:\"\";s:19:\"activity_subject_op\";s:3:\"has\";s:22:\"activity_subject_value\";s:0:\"\";s:19:\"activity_type_id_op\";s:2:\"in\";s:22:\"activity_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:11:\"description\";s:126:\"Provides a list of constituent activity including activity statistics for one/all contacts during a given date range(required)\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"group_bys\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(4,1,'Current Employers','contact/currentEmployer',NULL,NULL,'Provides detail list of employer employee relationships along with employment details.','view all contacts',NULL,'a:33:{s:6:\"fields\";a:5:{s:17:\"organization_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:9:\"job_title\";s:1:\"1\";s:10:\"start_date\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:20:\"organization_name_op\";s:3:\"has\";s:23:\"organization_name_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:19:\"start_date_relative\";s:1:\"0\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:98:\"Provides detail list of employer employee relationships along with employment details Ex Join Date\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(5,1,'Relationships','contact/relationship',NULL,NULL,'Gives relationship details between two contacts','view all contacts',NULL,'a:28:{s:6:\"fields\";a:4:{s:11:\"sort_name_a\";s:1:\"1\";s:11:\"sort_name_b\";s:1:\"1\";s:9:\"label_a_b\";s:1:\"1\";s:9:\"label_b_a\";s:1:\"1\";}s:14:\"sort_name_a_op\";s:3:\"has\";s:17:\"sort_name_a_value\";s:0:\"\";s:14:\"sort_name_b_op\";s:3:\"has\";s:17:\"sort_name_b_value\";s:0:\"\";s:17:\"contact_type_a_op\";s:2:\"in\";s:20:\"contact_type_a_value\";a:0:{}s:17:\"contact_type_b_op\";s:2:\"in\";s:20:\"contact_type_b_value\";a:0:{}s:12:\"is_active_op\";s:2:\"eq\";s:15:\"is_active_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:19:\"Relationship Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(6,1,'Activity Summary','activitySummary',NULL,NULL,'Shows activity statistics by type / date','view all contacts',NULL,'a:26:{s:6:\"fields\";a:4:{s:16:\"activity_type_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:8:\"duration\";s:1:\"1\";s:2:\"id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:27:\"activity_date_time_relative\";s:0:\"\";s:23:\"activity_date_time_from\";s:0:\"\";s:21:\"activity_date_time_to\";s:0:\"\";s:19:\"activity_type_id_op\";s:2:\"in\";s:22:\"activity_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:14:\"priority_id_op\";s:2:\"in\";s:17:\"priority_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:9:\"group_bys\";a:2:{s:16:\"activity_type_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:18:\"activity_date_time\";s:5:\"MONTH\";}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:16:\"activity_type_id\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:40:\"Shows activity statistics by type / date\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:9:\"row_count\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:11:\"instance_id\";N;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(7,1,'Contribution Summary','contribute/summary',NULL,NULL,'Groups and totals contributions by criteria including contact, time period, contribution type, contributor location, etc.','access CiviContribute',NULL,'a:42:{s:6:\"fields\";a:1:{s:12:\"total_amount\";s:1:\"1\";}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:13:\"total_sum_min\";s:0:\"\";s:13:\"total_sum_max\";s:0:\"\";s:12:\"total_sum_op\";s:3:\"lte\";s:15:\"total_sum_value\";s:0:\"\";s:15:\"total_count_min\";s:0:\"\";s:15:\"total_count_max\";s:0:\"\";s:14:\"total_count_op\";s:3:\"lte\";s:17:\"total_count_value\";s:0:\"\";s:13:\"total_avg_min\";s:0:\"\";s:13:\"total_avg_max\";s:0:\"\";s:12:\"total_avg_op\";s:3:\"lte\";s:15:\"total_avg_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"group_bys\";a:1:{s:12:\"receive_date\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:12:\"receive_date\";s:5:\"MONTH\";}s:11:\"description\";s:80:\"Shows contribution statistics by month / week / year .. country / state .. type.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(8,1,'Contribution Details','contribute/detail',NULL,NULL,'Lists specific contributions by criteria including contact, time period, contribution type, contributor location, etc. Contribution summary report points to this report for contribution details.','access CiviContribute',NULL,'a:56:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:0:\"\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:7:\"note_op\";s:3:\"has\";s:10:\"note_value\";s:0:\"\";s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:9:\"sort_name\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:194:\"Lists specific contributions by criteria including contact, time period, contribution type, contributor location, etc. Contribution summary report points to this report for contribution details.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(9,1,'Repeat Contributions','contribute/repeat',NULL,NULL,'Given two date ranges, shows contacts who contributed in both the date ranges with the amount contributed in each and the percentage increase / decrease.','access CiviContribute',NULL,'a:29:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:13:\"total_amount1\";s:1:\"1\";s:13:\"total_amount2\";s:1:\"1\";}s:22:\"receive_date1_relative\";s:13:\"previous.year\";s:18:\"receive_date1_from\";s:0:\"\";s:16:\"receive_date1_to\";s:0:\"\";s:22:\"receive_date2_relative\";s:9:\"this.year\";s:18:\"receive_date2_from\";s:0:\"\";s:16:\"receive_date2_to\";s:0:\"\";s:17:\"total_amount1_min\";s:0:\"\";s:17:\"total_amount1_max\";s:0:\"\";s:16:\"total_amount1_op\";s:3:\"lte\";s:19:\"total_amount1_value\";s:0:\"\";s:17:\"total_amount2_min\";s:0:\"\";s:17:\"total_amount2_max\";s:0:\"\";s:16:\"total_amount2_op\";s:3:\"lte\";s:19:\"total_amount2_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"group_bys\";a:1:{s:2:\"id\";s:1:\"1\";}s:11:\"description\";s:140:\"Given two date ranges, shows contacts (and their contributions) who contributed in both the date ranges with percentage increase / decrease.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(10,1,'SYBUNT (some year but not this year)','contribute/sybunt',NULL,NULL,'Some year(s) but not this year. Provides a list of constituents who donated at some time in the history of your organization but did not donate during the time period you specify.','access CiviContribute',NULL,'a:18:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"yid_op\";s:2:\"eq\";s:9:\"yid_value\";s:4:\"2011\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:179:\"Some year(s) but not this year. Provides a list of constituents who donated at some time in the history of your organization but did not donate during the time period you specify.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(11,1,'LYBUNT (last year but not this year)','contribute/lybunt',NULL,NULL,'Last year but not this year. Provides a list of constituents who donated last year but did not donate during the time period you specify as the current year.','access CiviContribute',NULL,'a:19:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"yid_op\";s:2:\"eq\";s:9:\"yid_value\";s:4:\"2011\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:157:\"Last year but not this year. Provides a list of constituents who donated last year but did not donate during the time period you specify as the current year.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(12,1,'Contributions by Organization','contribute/organizationSummary',NULL,NULL,'Displays a detailed list of contributions grouped by organization, which includes contributions made by employees for the organisation.','access CiviContribute',NULL,'a:20:{s:6:\"fields\";a:5:{s:17:\"organization_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:20:\"organization_name_op\";s:3:\"has\";s:23:\"organization_name_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:5:\"4_b_a\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:11:\"description\";s:193:\"Displays a detailed contribution report for Organization relationships with contributors, as to if contribution done was from an employee of some organization or from that Organization itself.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(13,1,'Contributions by Household','contribute/householdSummary',NULL,NULL,'Displays a detailed list of contributions grouped by household which includes contributions made by members of the household.','access CiviContribute',NULL,'a:21:{s:6:\"fields\";a:5:{s:14:\"household_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:17:\"household_name_op\";s:3:\"has\";s:20:\"household_name_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:5:\"6_b_a\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:11:\"description\";s:213:\"Provides a detailed report for Contributions made by contributors(Or Household itself) who are having a relationship with household (For ex a Contributor is Head of Household for some household or is a member of.)\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(14,1,'Top Donors','contribute/topDonor',NULL,NULL,'Provides a list of the top donors during a time period you define. You can include as many donors as you want (for example, top 100 of your donors).','access CiviContribute',NULL,'a:20:{s:6:\"fields\";a:2:{s:12:\"display_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";}s:21:\"receive_date_relative\";s:9:\"this.year\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:15:\"total_range_min\";s:0:\"\";s:15:\"total_range_max\";s:0:\"\";s:14:\"total_range_op\";s:2:\"eq\";s:17:\"total_range_value\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:11:\"description\";s:148:\"Provides a list of the top donors during a time period you define. You can include as many donors as you want (for example, top 100 of your donors).\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(15,1,'Soft Credits','contribute/softcredit',NULL,NULL,'Shows contributions made by contacts that have been soft-credited to other contacts.','access CiviContribute',NULL,'a:23:{s:6:\"fields\";a:5:{s:21:\"display_name_creditor\";s:1:\"1\";s:24:\"display_name_constituent\";s:1:\"1\";s:14:\"email_creditor\";s:1:\"1\";s:14:\"phone_creditor\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";}s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:10:\"amount_min\";s:0:\"\";s:10:\"amount_max\";s:0:\"\";s:9:\"amount_op\";s:3:\"lte\";s:12:\"amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:20:\"Soft Credit details.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(16,1,'Contribution Aggregate by Relationship','contribute/history',NULL,NULL,'List contact\'s donation history, grouped by year, along with contributions attributed to any of the contact\'s related contacts.','access CiviContribute',NULL,'a:41:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:20:\"relationship_type_id\";s:1:\"1\";s:17:\"civicrm_upto_2009\";s:1:\"1\";i:2010;s:1:\"1\";i:2011;s:1:\"1\";i:2012;s:1:\"1\";i:2013;s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"in\";s:26:\"relationship_type_id_value\";a:0:{}s:12:\"this_year_op\";s:2:\"eq\";s:15:\"this_year_value\";s:0:\"\";s:13:\"other_year_op\";s:2:\"eq\";s:16:\"other_year_value\";s:0:\"\";s:21:\"receive_date_relative\";s:0:\"\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:13:\"total_sum_min\";s:0:\"\";s:13:\"total_sum_max\";s:0:\"\";s:12:\"total_sum_op\";s:3:\"lte\";s:15:\"total_sum_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:127:\"List contact\'s donation history, grouped by year, along with contributions attributed to any of the contact\'s related contacts.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(17,1,'Personal Campaign Page Summary','contribute/pcp',NULL,NULL,'Summarizes amount raised and number of contributors for each Personal Campaign Page.','access CiviContribute',NULL,'a:22:{s:6:\"fields\";a:8:{s:9:\"sort_name\";s:1:\"1\";s:10:\"page_title\";s:1:\"1\";s:5:\"title\";s:1:\"1\";s:11:\"goal_amount\";s:1:\"1\";s:8:\"amount_1\";s:1:\"1\";s:8:\"amount_2\";s:1:\"1\";s:7:\"soft_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"page_title_op\";s:3:\"has\";s:16:\"page_title_value\";s:0:\"\";s:8:\"title_op\";s:3:\"has\";s:11:\"title_value\";s:0:\"\";s:12:\"amount_2_min\";s:0:\"\";s:12:\"amount_2_max\";s:0:\"\";s:11:\"amount_2_op\";s:3:\"lte\";s:14:\"amount_2_value\";s:0:\"\";s:11:\"description\";s:35:\"Shows Personal Campaign Page Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(18,1,'Pledge Detail','pledge/detail',NULL,NULL,'List of pledges including amount pledged, pledge status, next payment date, balance due, total amount paid etc.','access CiviPledge',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:27:\"pledge_create_date_relative\";s:1:\"0\";s:23:\"pledge_create_date_from\";s:0:\"\";s:21:\"pledge_create_date_to\";s:0:\"\";s:17:\"pledge_amount_min\";s:0:\"\";s:17:\"pledge_amount_max\";s:0:\"\";s:16:\"pledge_amount_op\";s:3:\"lte\";s:19:\"pledge_amount_value\";s:0:\"\";s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:13:\"Pledge Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviPledge\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(19,1,'Pledged But not Paid','pledge/pbnp',NULL,NULL,'Pledged but not Paid Report','access CiviPledge',NULL,'a:17:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"pledge_create_date\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:14:\"scheduled_date\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:27:\"pledge_create_date_relative\";s:1:\"0\";s:23:\"pledge_create_date_from\";s:0:\"\";s:21:\"pledge_create_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:27:\"Pledged but not Paid Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviPledge\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(20,1,'Bookkeeping Transactions','contribute/bookkeeping',NULL,NULL,'Provides transaction details for all contributions and payments, including Transaction #, Invoice ID, Payment Instrument and Check #.','access CiviContribute',NULL,'a:40:{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:21:\"debit_accounting_code\";s:1:\"1\";s:22:\"credit_accounting_code\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:2:\"id\";s:1:\"1\";s:12:\"check_number\";s:1:\"1\";s:21:\"payment_instrument_id\";s:1:\"1\";s:9:\"trxn_date\";s:1:\"1\";s:7:\"trxn_id\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:24:\"debit_accounting_code_op\";s:2:\"in\";s:27:\"debit_accounting_code_value\";a:0:{}s:25:\"credit_accounting_code_op\";s:2:\"in\";s:28:\"credit_accounting_code_value\";a:0:{}s:13:\"debit_name_op\";s:2:\"in\";s:16:\"debit_name_value\";a:0:{}s:14:\"credit_name_op\";s:2:\"in\";s:17:\"credit_name_value\";a:0:{}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:18:\"trxn_date_relative\";s:1:\"0\";s:14:\"trxn_date_from\";s:0:\"\";s:12:\"trxn_date_to\";s:0:\"\";s:10:\"amount_min\";s:0:\"\";s:10:\"amount_max\";s:0:\"\";s:9:\"amount_op\";s:3:\"lte\";s:12:\"amount_value\";s:0:\"\";s:11:\"description\";s:133:\"Provides transaction details for all contributions and payments, including Transaction #, Invoice ID, Payment Instrument and Check #.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(21,1,'Recurring Contributions','contribute/recur',NULL,NULL,'Provides information about the status of recurring contributions','access CiviContribute',NULL,'a:39:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:18:\"frequency_interval\";s:1:\"1\";s:14:\"frequency_unit\";s:1:\"1\";s:12:\"installments\";s:1:\"1\";s:8:\"end_date\";s:1:\"1\";}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"5\";}s:11:\"currency_op\";s:2:\"in\";s:14:\"currency_value\";a:0:{}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:17:\"frequency_unit_op\";s:2:\"in\";s:20:\"frequency_unit_value\";a:0:{}s:22:\"frequency_interval_min\";s:0:\"\";s:22:\"frequency_interval_max\";s:0:\"\";s:21:\"frequency_interval_op\";s:3:\"lte\";s:24:\"frequency_interval_value\";s:0:\"\";s:16:\"installments_min\";s:0:\"\";s:16:\"installments_max\";s:0:\"\";s:15:\"installments_op\";s:3:\"lte\";s:18:\"installments_value\";s:0:\"\";s:19:\"start_date_relative\";s:0:\"\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:37:\"next_sched_contribution_date_relative\";s:0:\"\";s:33:\"next_sched_contribution_date_from\";s:0:\"\";s:31:\"next_sched_contribution_date_to\";s:0:\"\";s:17:\"end_date_relative\";s:0:\"\";s:13:\"end_date_from\";s:0:\"\";s:11:\"end_date_to\";s:0:\"\";s:28:\"calculated_end_date_relative\";s:0:\"\";s:24:\"calculated_end_date_from\";s:0:\"\";s:22:\"calculated_end_date_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:41:\"Shows all pending recurring contributions\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:9:\"row_count\";s:0:\"\";s:14:\"addToDashboard\";s:1:\"1\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:11:\"instance_id\";N;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(22,1,'Membership Summary','member/summary',NULL,NULL,'Provides a summary of memberships by type and join date.','access CiviMember',NULL,'a:18:{s:6:\"fields\";a:2:{s:18:\"membership_type_id\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";}s:18:\"join_date_relative\";s:1:\"0\";s:14:\"join_date_from\";s:0:\"\";s:12:\"join_date_to\";s:0:\"\";s:21:\"membership_type_id_op\";s:2:\"in\";s:24:\"membership_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:9:\"group_bys\";a:2:{s:9:\"join_date\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:9:\"join_date\";s:5:\"MONTH\";}s:11:\"description\";s:56:\"Provides a summary of memberships by type and join date.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(23,1,'Membership Details','member/detail',NULL,NULL,'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.','access CiviMember',NULL,'a:28:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:4:\"name\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:18:\"join_date_relative\";s:1:\"0\";s:14:\"join_date_from\";s:0:\"\";s:12:\"join_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:119:\"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(24,1,'Contribution and Membership Details','member/contributionDetail',NULL,NULL,'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.','access CiviMember',NULL,'a:67:{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:9:\"join_date\";s:1:\"1\";s:22:\"membership_status_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:18:\"join_date_relative\";s:1:\"0\";s:14:\"join_date_from\";s:0:\"\";s:12:\"join_date_to\";s:0:\"\";s:30:\"membership_start_date_relative\";s:1:\"0\";s:26:\"membership_start_date_from\";s:0:\"\";s:24:\"membership_start_date_to\";s:0:\"\";s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:35:\"Contribution and Membership Details\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:1:\"0\";s:9:\"domain_id\";i:1;}{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:9:\"join_date\";s:1:\"1\";s:22:\"membership_status_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:18:\"join_date_relative\";s:1:\"0\";s:14:\"join_date_from\";s:0:\"\";s:12:\"join_date_to\";s:0:\"\";s:30:\"membership_start_date_relative\";s:1:\"0\";s:26:\"membership_start_date_from\";s:0:\"\";s:24:\"membership_start_date_to\";s:0:\"\";s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:35:\"Contribution and Membership Details\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(25,1,'Lapsed Memberships','member/lapse',NULL,NULL,'Provides a list of memberships that have lapsed or will lapse by the date you specify.','access CiviMember',NULL,'a:16:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:4:\"name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:85:\"Provides a list of memberships that lapsed or will lapse before the date you specify.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(26,1,'Event Participants List','event/participantListing',NULL,NULL,'Provides lists of participants for an event.','access CiviEvent',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:8:\"email_op\";s:3:\"has\";s:11:\"email_value\";s:0:\"\";s:11:\"event_id_op\";s:2:\"in\";s:14:\"event_id_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"rid_op\";s:2:\"in\";s:9:\"rid_value\";a:0:{}s:34:\"participant_register_date_relative\";s:1:\"0\";s:30:\"participant_register_date_from\";s:0:\"\";s:28:\"participant_register_date_to\";s:0:\"\";s:6:\"eid_op\";s:2:\"in\";s:9:\"eid_value\";a:0:{}s:11:\"custom_4_op\";s:2:\"in\";s:14:\"custom_4_value\";a:0:{}s:16:\"blank_column_end\";s:0:\"\";s:11:\"description\";s:44:\"Provides lists of participants for an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"groups\";s:0:\"\";s:7:\"options\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(27,1,'Event Income Summary','event/summary',NULL,NULL,'Provides an overview of event income. You can include key information such as event ID, registration, attendance, and income generated to help you determine the success of an event.','access CiviEvent',NULL,'a:18:{s:6:\"fields\";a:2:{s:5:\"title\";s:1:\"1\";s:13:\"event_type_id\";s:1:\"1\";}s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";a:0:{}s:16:\"event_type_id_op\";s:2:\"in\";s:19:\"event_type_id_value\";a:0:{}s:25:\"event_start_date_relative\";s:1:\"0\";s:21:\"event_start_date_from\";s:0:\"\";s:19:\"event_start_date_to\";s:0:\"\";s:23:\"event_end_date_relative\";s:1:\"0\";s:19:\"event_end_date_from\";s:0:\"\";s:17:\"event_end_date_to\";s:0:\"\";s:11:\"description\";s:181:\"Provides an overview of event income. You can include key information such as event ID, registration, attendance, and income generated to help you determine the success of an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(28,1,'Event Income Details','event/income',NULL,NULL,'Helps you to analyze the income generated by an event. The report can include details by participant type, status and payment method.','access CiviEvent',NULL,'a:7:{s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";N;s:11:\"description\";s:133:\"Helps you to analyze the income generated by an event. The report can include details by participant type, status and payment method.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(29,1,'Attendee List','event/participantListing',NULL,NULL,'Provides lists of event attendees.','access CiviEvent',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:8:\"email_op\";s:3:\"has\";s:11:\"email_value\";s:0:\"\";s:11:\"event_id_op\";s:2:\"in\";s:14:\"event_id_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"rid_op\";s:2:\"in\";s:9:\"rid_value\";a:0:{}s:34:\"participant_register_date_relative\";s:1:\"0\";s:30:\"participant_register_date_from\";s:0:\"\";s:28:\"participant_register_date_to\";s:0:\"\";s:6:\"eid_op\";s:2:\"in\";s:9:\"eid_value\";a:0:{}s:11:\"custom_4_op\";s:2:\"in\";s:14:\"custom_4_value\";a:0:{}s:16:\"blank_column_end\";s:0:\"\";s:11:\"description\";s:44:\"Provides lists of participants for an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"groups\";s:0:\"\";s:7:\"options\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(30,1,'Grant Details','grant/detail',NULL,NULL,'Grant Report Detail','access CiviGrant',NULL,'a:40:{s:6:\"fields\";a:2:{s:9:\"sort_name\";s:1:\"1\";s:25:\"application_received_date\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:12:\"gender_id_op\";s:2:\"in\";s:15:\"gender_id_value\";a:0:{}s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"grant_type_op\";s:2:\"in\";s:16:\"grant_type_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:18:\"amount_granted_min\";s:0:\"\";s:18:\"amount_granted_max\";s:0:\"\";s:17:\"amount_granted_op\";s:3:\"lte\";s:20:\"amount_granted_value\";s:0:\"\";s:20:\"amount_requested_min\";s:0:\"\";s:20:\"amount_requested_max\";s:0:\"\";s:19:\"amount_requested_op\";s:3:\"lte\";s:22:\"amount_requested_value\";s:0:\"\";s:34:\"application_received_date_relative\";s:1:\"0\";s:30:\"application_received_date_from\";s:0:\"\";s:28:\"application_received_date_to\";s:0:\"\";s:28:\"money_transfer_date_relative\";s:1:\"0\";s:24:\"money_transfer_date_from\";s:0:\"\";s:22:\"money_transfer_date_to\";s:0:\"\";s:23:\"grant_due_date_relative\";s:1:\"0\";s:19:\"grant_due_date_from\";s:0:\"\";s:17:\"grant_due_date_to\";s:0:\"\";s:11:\"description\";s:19:\"Grant Report Detail\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviGrant\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(31,1,'Grant Statistics','grant/statistics',NULL,NULL,'Grant Report Statistics','access CiviGrant',NULL,'a:42:{s:6:\"fields\";a:2:{s:18:\"summary_statistics\";s:1:\"1\";s:13:\"grant_type_id\";s:1:\"1\";}s:34:\"application_received_date_relative\";s:1:\"0\";s:30:\"application_received_date_from\";s:0:\"\";s:28:\"application_received_date_to\";s:0:\"\";s:22:\"decision_date_relative\";s:1:\"0\";s:18:\"decision_date_from\";s:0:\"\";s:16:\"decision_date_to\";s:0:\"\";s:28:\"money_transfer_date_relative\";s:1:\"0\";s:24:\"money_transfer_date_from\";s:0:\"\";s:22:\"money_transfer_date_to\";s:0:\"\";s:23:\"grant_due_date_relative\";s:1:\"0\";s:19:\"grant_due_date_from\";s:0:\"\";s:17:\"grant_due_date_to\";s:0:\"\";s:13:\"grant_type_op\";s:2:\"in\";s:16:\"grant_type_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:20:\"amount_requested_min\";s:0:\"\";s:20:\"amount_requested_max\";s:0:\"\";s:19:\"amount_requested_op\";s:3:\"lte\";s:22:\"amount_requested_value\";s:0:\"\";s:18:\"amount_granted_min\";s:0:\"\";s:18:\"amount_granted_max\";s:0:\"\";s:17:\"amount_granted_op\";s:3:\"lte\";s:20:\"amount_granted_value\";s:0:\"\";s:24:\"grant_report_received_op\";s:2:\"eq\";s:27:\"grant_report_received_value\";s:0:\"\";s:12:\"gender_id_op\";s:2:\"in\";s:15:\"gender_id_value\";a:0:{}s:15:\"contact_type_op\";s:2:\"in\";s:18:\"contact_type_value\";a:0:{}s:12:\"region_id_op\";s:2:\"in\";s:15:\"region_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:11:\"description\";s:23:\"Grant Report Statistics\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviGrant\";s:9:\"parent_id\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(32,1,'Mail Bounces','Mailing/bounce',NULL,NULL,'Bounce Report for mailings','access CiviMail',NULL,'a:33:{s:6:\"fields\";a:5:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:11:\"bounce_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:19:\"bounce_type_name_op\";s:2:\"eq\";s:22:\"bounce_type_name_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:26:\"Bounce Report for mailings\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(33,1,'Mailing Summary','Mailing/summary',NULL,NULL,'Summary statistics for mailings','access CiviMail',NULL,'a:25:{s:6:\"fields\";a:5:{s:4:\"name\";s:1:\"1\";s:11:\"queue_count\";s:1:\"1\";s:15:\"delivered_count\";s:1:\"1\";s:12:\"bounce_count\";s:1:\"1\";s:17:\"unique_open_count\";s:1:\"1\";}s:15:\"is_completed_op\";s:2:\"eq\";s:18:\"is_completed_value\";s:1:\"1\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:9:\"status_op\";s:3:\"has\";s:12:\"status_value\";s:8:\"Complete\";s:11:\"is_test_min\";s:0:\"\";s:11:\"is_test_max\";s:0:\"\";s:10:\"is_test_op\";s:3:\"lte\";s:13:\"is_test_value\";s:1:\"0\";s:19:\"start_date_relative\";s:9:\"this.year\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:17:\"end_date_relative\";s:9:\"this.year\";s:13:\"end_date_from\";s:0:\"\";s:11:\"end_date_to\";s:0:\"\";s:11:\"description\";s:31:\"Summary statistics for mailings\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(34,1,'Mail Opened','Mailing/opened',NULL,NULL,'Display contacts who opened emails from a mailing','access CiviMail',NULL,'a:31:{s:6:\"fields\";a:5:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:49:\"Display contacts who opened emails from a mailing\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(35,1,'Mail Clickthroughs','Mailing/clicks',NULL,NULL,'Display clicks from each mailing','access CiviMail',NULL,'a:31:{s:6:\"fields\";a:6:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:3:\"url\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:32:\"Display clicks from each mailing\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(36,1,'Mailing Details','mailing/detail',NULL,NULL,'Provides reporting on Intended and Successful Deliveries, Unsubscribes and Opt-outs, Replies and Forwards.','access CiviMail',NULL,'a:30:{s:6:\"fields\";a:6:{s:9:\"sort_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:11:\"delivery_id\";s:1:\"1\";s:14:\"unsubscribe_id\";s:1:\"1\";s:9:\"optout_id\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"mailing_id_op\";s:2:\"in\";s:16:\"mailing_id_value\";a:0:{}s:18:\"delivery_status_op\";s:2:\"eq\";s:21:\"delivery_status_value\";s:0:\"\";s:18:\"is_unsubscribed_op\";s:2:\"eq\";s:21:\"is_unsubscribed_value\";s:0:\"\";s:12:\"is_optout_op\";s:2:\"eq\";s:15:\"is_optout_value\";s:0:\"\";s:13:\"is_replied_op\";s:2:\"eq\";s:16:\"is_replied_value\";s:0:\"\";s:15:\"is_forwarded_op\";s:2:\"eq\";s:18:\"is_forwarded_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:9:\"sort_name\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:21:\"Mailing Detail Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(37,1,'Survey Details','survey/detail',NULL,NULL,'Detailed report for canvassing, phone-banking, walk lists or other surveys.','access CiviReport',NULL,'a:39:{s:6:\"fields\";a:2:{s:9:\"sort_name\";s:1:\"1\";s:6:\"result\";s:1:\"1\";}s:22:\"assignee_contact_id_op\";s:2:\"eq\";s:25:\"assignee_contact_id_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:12:\"survey_id_op\";s:2:\"in\";s:15:\"survey_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"eq\";s:15:\"status_id_value\";s:1:\"1\";s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:75:\"Detailed report for canvassing, phone-banking, walk lists or other surveys.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviReport\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0); +INSERT INTO `civicrm_report_instance` (`id`, `domain_id`, `title`, `report_id`, `name`, `args`, `description`, `permission`, `grouprole`, `form_values`, `is_active`, `created_id`, `owner_id`, `email_subject`, `email_to`, `email_cc`, `header`, `footer`, `navigation_id`, `drilldown_id`, `is_reserved`) VALUES (1,1,'Constituent Summary','contact/summary',NULL,NULL,'Provides a list of address and telephone information for constituent records in your system.','view all contacts',NULL,'a:31:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:14:\"street_address\";s:1:\"1\";s:4:\"city\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:92:\"Provides a list of address and telephone information for constituent records in your system.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(2,1,'Constituent Detail','contact/detail',NULL,NULL,'Provides contact-related information on contributions, memberships, events and activities.','view all contacts',NULL,'a:25:{s:6:\"fields\";a:30:{s:9:\"sort_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";s:15:\"contribution_id\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:13:\"membership_id\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:20:\"membership_status_id\";s:1:\"1\";s:14:\"participant_id\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:21:\"participant_status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";s:25:\"participant_register_date\";s:1:\"1\";s:9:\"fee_level\";s:1:\"1\";s:10:\"fee_amount\";s:1:\"1\";s:15:\"relationship_id\";s:1:\"1\";s:20:\"relationship_type_id\";s:1:\"1\";s:12:\"contact_id_b\";s:1:\"1\";s:2:\"id\";s:1:\"1\";s:16:\"activity_type_id\";s:1:\"1\";s:7:\"subject\";s:1:\"1\";s:17:\"source_contact_id\";s:1:\"1\";s:18:\"activity_date_time\";s:1:\"1\";s:18:\"activity_status_id\";s:1:\"1\";s:17:\"target_contact_id\";s:1:\"1\";s:19:\"assignee_contact_id\";s:1:\"1\";}s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:90:\"Provides contact-related information on contributions, memberships, events and activities.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(3,1,'Activity Details','activity',NULL,NULL,'Provides a list of constituent activity including activity statistics for one/all contacts during a given date range(required)','view all contacts',NULL,'a:26:{s:6:\"fields\";a:6:{s:16:\"contact_assignee\";s:1:\"1\";s:14:\"contact_target\";s:1:\"1\";s:16:\"activity_type_id\";s:1:\"1\";s:16:\"activity_subject\";s:1:\"1\";s:18:\"activity_date_time\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:17:\"contact_source_op\";s:3:\"has\";s:20:\"contact_source_value\";s:0:\"\";s:19:\"contact_assignee_op\";s:3:\"has\";s:22:\"contact_assignee_value\";s:0:\"\";s:17:\"contact_target_op\";s:3:\"has\";s:20:\"contact_target_value\";s:0:\"\";s:15:\"current_user_op\";s:2:\"eq\";s:18:\"current_user_value\";s:1:\"0\";s:27:\"activity_date_time_relative\";s:10:\"this.month\";s:23:\"activity_date_time_from\";s:0:\"\";s:21:\"activity_date_time_to\";s:0:\"\";s:19:\"activity_subject_op\";s:3:\"has\";s:22:\"activity_subject_value\";s:0:\"\";s:19:\"activity_type_id_op\";s:2:\"in\";s:22:\"activity_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:11:\"description\";s:126:\"Provides a list of constituent activity including activity statistics for one/all contacts during a given date range(required)\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"group_bys\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(4,1,'Current Employers','contact/currentEmployer',NULL,NULL,'Provides detail list of employer employee relationships along with employment details.','view all contacts',NULL,'a:33:{s:6:\"fields\";a:5:{s:17:\"organization_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:9:\"job_title\";s:1:\"1\";s:10:\"start_date\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:20:\"organization_name_op\";s:3:\"has\";s:23:\"organization_name_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:19:\"start_date_relative\";s:1:\"0\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:98:\"Provides detail list of employer employee relationships along with employment details Ex Join Date\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(5,1,'Relationships','contact/relationship',NULL,NULL,'Gives relationship details between two contacts','view all contacts',NULL,'a:28:{s:6:\"fields\";a:4:{s:11:\"sort_name_a\";s:1:\"1\";s:11:\"sort_name_b\";s:1:\"1\";s:9:\"label_a_b\";s:1:\"1\";s:9:\"label_b_a\";s:1:\"1\";}s:14:\"sort_name_a_op\";s:3:\"has\";s:17:\"sort_name_a_value\";s:0:\"\";s:14:\"sort_name_b_op\";s:3:\"has\";s:17:\"sort_name_b_value\";s:0:\"\";s:17:\"contact_type_a_op\";s:2:\"in\";s:20:\"contact_type_a_value\";a:0:{}s:17:\"contact_type_b_op\";s:2:\"in\";s:20:\"contact_type_b_value\";a:0:{}s:12:\"is_active_op\";s:2:\"eq\";s:15:\"is_active_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:19:\"Relationship Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(6,1,'Activity Summary','activitySummary',NULL,NULL,'Shows activity statistics by type / date','view all contacts',NULL,'a:26:{s:6:\"fields\";a:4:{s:16:\"activity_type_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:8:\"duration\";s:1:\"1\";s:2:\"id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:27:\"activity_date_time_relative\";s:0:\"\";s:23:\"activity_date_time_from\";s:0:\"\";s:21:\"activity_date_time_to\";s:0:\"\";s:19:\"activity_type_id_op\";s:2:\"in\";s:22:\"activity_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:14:\"priority_id_op\";s:2:\"in\";s:17:\"priority_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:9:\"group_bys\";a:2:{s:16:\"activity_type_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:18:\"activity_date_time\";s:5:\"MONTH\";}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:16:\"activity_type_id\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:40:\"Shows activity statistics by type / date\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:9:\"row_count\";s:0:\"\";s:10:\"permission\";s:17:\"view all contacts\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:11:\"instance_id\";N;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(7,1,'Contribution Summary','contribute/summary',NULL,NULL,'Groups and totals contributions by criteria including contact, time period, contribution type, contributor location, etc.','access CiviContribute',NULL,'a:42:{s:6:\"fields\";a:1:{s:12:\"total_amount\";s:1:\"1\";}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:13:\"total_sum_min\";s:0:\"\";s:13:\"total_sum_max\";s:0:\"\";s:12:\"total_sum_op\";s:3:\"lte\";s:15:\"total_sum_value\";s:0:\"\";s:15:\"total_count_min\";s:0:\"\";s:15:\"total_count_max\";s:0:\"\";s:14:\"total_count_op\";s:3:\"lte\";s:17:\"total_count_value\";s:0:\"\";s:13:\"total_avg_min\";s:0:\"\";s:13:\"total_avg_max\";s:0:\"\";s:12:\"total_avg_op\";s:3:\"lte\";s:15:\"total_avg_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"group_bys\";a:1:{s:12:\"receive_date\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:12:\"receive_date\";s:5:\"MONTH\";}s:11:\"description\";s:80:\"Shows contribution statistics by month / week / year .. country / state .. type.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(8,1,'Contribution Details','contribute/detail',NULL,NULL,'Lists specific contributions by criteria including contact, time period, contribution type, contributor location, etc. Contribution summary report points to this report for contribution details.','access CiviContribute',NULL,'a:56:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:0:\"\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:7:\"note_op\";s:3:\"has\";s:10:\"note_value\";s:0:\"\";s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:9:\"sort_name\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:194:\"Lists specific contributions by criteria including contact, time period, contribution type, contributor location, etc. Contribution summary report points to this report for contribution details.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(9,1,'Repeat Contributions','contribute/repeat',NULL,NULL,'Given two date ranges, shows contacts who contributed in both the date ranges with the amount contributed in each and the percentage increase / decrease.','access CiviContribute',NULL,'a:29:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:13:\"total_amount1\";s:1:\"1\";s:13:\"total_amount2\";s:1:\"1\";}s:22:\"receive_date1_relative\";s:13:\"previous.year\";s:18:\"receive_date1_from\";s:0:\"\";s:16:\"receive_date1_to\";s:0:\"\";s:22:\"receive_date2_relative\";s:9:\"this.year\";s:18:\"receive_date2_from\";s:0:\"\";s:16:\"receive_date2_to\";s:0:\"\";s:17:\"total_amount1_min\";s:0:\"\";s:17:\"total_amount1_max\";s:0:\"\";s:16:\"total_amount1_op\";s:3:\"lte\";s:19:\"total_amount1_value\";s:0:\"\";s:17:\"total_amount2_min\";s:0:\"\";s:17:\"total_amount2_max\";s:0:\"\";s:16:\"total_amount2_op\";s:3:\"lte\";s:19:\"total_amount2_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:9:\"group_bys\";a:1:{s:2:\"id\";s:1:\"1\";}s:11:\"description\";s:140:\"Given two date ranges, shows contacts (and their contributions) who contributed in both the date ranges with percentage increase / decrease.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(10,1,'SYBUNT (some year but not this year)','contribute/sybunt',NULL,NULL,'Some year(s) but not this year. Provides a list of constituents who donated at some time in the history of your organization but did not donate during the time period you specify.','access CiviContribute',NULL,'a:18:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"yid_op\";s:2:\"eq\";s:9:\"yid_value\";s:4:\"2011\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:179:\"Some year(s) but not this year. Provides a list of constituents who donated at some time in the history of your organization but did not donate during the time period you specify.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(11,1,'LYBUNT (last year but not this year)','contribute/lybunt',NULL,NULL,'Last year but not this year. Provides a list of constituents who donated last year but did not donate during the time period you specify as the current year.','access CiviContribute',NULL,'a:19:{s:6:\"fields\";a:3:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"yid_op\";s:2:\"eq\";s:9:\"yid_value\";s:4:\"2011\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:157:\"Last year but not this year. Provides a list of constituents who donated last year but did not donate during the time period you specify as the current year.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(12,1,'Contributions by Organization','contribute/organizationSummary',NULL,NULL,'Displays a detailed list of contributions grouped by organization, which includes contributions made by employees for the organisation.','access CiviContribute',NULL,'a:20:{s:6:\"fields\";a:5:{s:17:\"organization_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:20:\"organization_name_op\";s:3:\"has\";s:23:\"organization_name_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:5:\"4_b_a\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:11:\"description\";s:193:\"Displays a detailed contribution report for Organization relationships with contributors, as to if contribution done was from an employee of some organization or from that Organization itself.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(13,1,'Contributions by Household','contribute/householdSummary',NULL,NULL,'Displays a detailed list of contributions grouped by household which includes contributions made by members of the household.','access CiviContribute',NULL,'a:21:{s:6:\"fields\";a:5:{s:14:\"household_name\";s:1:\"1\";s:9:\"sort_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:17:\"household_name_op\";s:3:\"has\";s:20:\"household_name_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"eq\";s:26:\"relationship_type_id_value\";s:5:\"6_b_a\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:11:\"description\";s:213:\"Provides a detailed report for Contributions made by contributors(Or Household itself) who are having a relationship with household (For ex a Contributor is Head of Household for some household or is a member of.)\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(14,1,'Top Donors','contribute/topDonor',NULL,NULL,'Provides a list of the top donors during a time period you define. You can include as many donors as you want (for example, top 100 of your donors).','access CiviContribute',NULL,'a:20:{s:6:\"fields\";a:2:{s:12:\"display_name\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";}s:21:\"receive_date_relative\";s:9:\"this.year\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:15:\"total_range_min\";s:0:\"\";s:15:\"total_range_max\";s:0:\"\";s:14:\"total_range_op\";s:2:\"eq\";s:17:\"total_range_value\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:11:\"description\";s:148:\"Provides a list of the top donors during a time period you define. You can include as many donors as you want (for example, top 100 of your donors).\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(15,1,'Soft Credits','contribute/softcredit',NULL,NULL,'Shows contributions made by contacts that have been soft-credited to other contacts.','access CiviContribute',NULL,'a:23:{s:6:\"fields\";a:5:{s:21:\"display_name_creditor\";s:1:\"1\";s:24:\"display_name_constituent\";s:1:\"1\";s:14:\"email_creditor\";s:1:\"1\";s:14:\"phone_creditor\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";}s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:10:\"amount_min\";s:0:\"\";s:10:\"amount_max\";s:0:\"\";s:9:\"amount_op\";s:3:\"lte\";s:12:\"amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:20:\"Soft Credit details.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(16,1,'Contribution Aggregate by Relationship','contribute/history',NULL,NULL,'List contact\'s donation history, grouped by year, along with contributions attributed to any of the contact\'s related contacts.','access CiviContribute',NULL,'a:41:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:20:\"relationship_type_id\";s:1:\"1\";s:17:\"civicrm_upto_2009\";s:1:\"1\";i:2010;s:1:\"1\";i:2011;s:1:\"1\";i:2012;s:1:\"1\";i:2013;s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:23:\"relationship_type_id_op\";s:2:\"in\";s:26:\"relationship_type_id_value\";a:0:{}s:12:\"this_year_op\";s:2:\"eq\";s:15:\"this_year_value\";s:0:\"\";s:13:\"other_year_op\";s:2:\"eq\";s:16:\"other_year_value\";s:0:\"\";s:21:\"receive_date_relative\";s:0:\"\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:13:\"total_sum_min\";s:0:\"\";s:13:\"total_sum_max\";s:0:\"\";s:12:\"total_sum_op\";s:3:\"lte\";s:15:\"total_sum_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:127:\"List contact\'s donation history, grouped by year, along with contributions attributed to any of the contact\'s related contacts.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(17,1,'Personal Campaign Page Summary','contribute/pcp',NULL,NULL,'Summarizes amount raised and number of contributors for each Personal Campaign Page.','access CiviContribute',NULL,'a:22:{s:6:\"fields\";a:8:{s:9:\"sort_name\";s:1:\"1\";s:10:\"page_title\";s:1:\"1\";s:5:\"title\";s:1:\"1\";s:11:\"goal_amount\";s:1:\"1\";s:8:\"amount_1\";s:1:\"1\";s:8:\"amount_2\";s:1:\"1\";s:7:\"soft_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"page_title_op\";s:3:\"has\";s:16:\"page_title_value\";s:0:\"\";s:8:\"title_op\";s:3:\"has\";s:11:\"title_value\";s:0:\"\";s:12:\"amount_2_min\";s:0:\"\";s:12:\"amount_2_max\";s:0:\"\";s:11:\"amount_2_op\";s:3:\"lte\";s:14:\"amount_2_value\";s:0:\"\";s:11:\"description\";s:35:\"Shows Personal Campaign Page Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(18,1,'Pledge Detail','pledge/detail',NULL,NULL,'List of pledges including amount pledged, pledge status, next payment date, balance due, total amount paid etc.','access CiviPledge',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:27:\"pledge_create_date_relative\";s:1:\"0\";s:23:\"pledge_create_date_from\";s:0:\"\";s:21:\"pledge_create_date_to\";s:0:\"\";s:17:\"pledge_amount_min\";s:0:\"\";s:17:\"pledge_amount_max\";s:0:\"\";s:16:\"pledge_amount_op\";s:3:\"lte\";s:19:\"pledge_amount_value\";s:0:\"\";s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:13:\"Pledge Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviPledge\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(19,1,'Pledged But not Paid','pledge/pbnp',NULL,NULL,'Pledged but not Paid Report','access CiviPledge',NULL,'a:17:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"pledge_create_date\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:14:\"scheduled_date\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:27:\"pledge_create_date_relative\";s:1:\"0\";s:23:\"pledge_create_date_from\";s:0:\"\";s:21:\"pledge_create_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:27:\"Pledged but not Paid Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviPledge\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(20,1,'Bookkeeping Transactions','contribute/bookkeeping',NULL,NULL,'Provides transaction details for all contributions and payments, including Transaction #, Invoice ID, Payment Instrument and Check #.','access CiviContribute',NULL,'a:40:{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:21:\"debit_accounting_code\";s:1:\"1\";s:22:\"credit_accounting_code\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:2:\"id\";s:1:\"1\";s:12:\"check_number\";s:1:\"1\";s:21:\"payment_instrument_id\";s:1:\"1\";s:9:\"trxn_date\";s:1:\"1\";s:7:\"trxn_id\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:24:\"debit_accounting_code_op\";s:2:\"in\";s:27:\"debit_accounting_code_value\";a:0:{}s:25:\"credit_accounting_code_op\";s:2:\"in\";s:28:\"credit_accounting_code_value\";a:0:{}s:13:\"debit_name_op\";s:2:\"in\";s:16:\"debit_name_value\";a:0:{}s:14:\"credit_name_op\";s:2:\"in\";s:17:\"credit_name_value\";a:0:{}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"1\";}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:18:\"trxn_date_relative\";s:1:\"0\";s:14:\"trxn_date_from\";s:0:\"\";s:12:\"trxn_date_to\";s:0:\"\";s:10:\"amount_min\";s:0:\"\";s:10:\"amount_max\";s:0:\"\";s:9:\"amount_op\";s:3:\"lte\";s:12:\"amount_value\";s:0:\"\";s:11:\"description\";s:133:\"Provides transaction details for all contributions and payments, including Transaction #, Invoice ID, Payment Instrument and Check #.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;s:11:\"is_reserved\";b:0;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(21,1,'Recurring Contributions','contribute/recur',NULL,NULL,'Provides information about the status of recurring contributions','access CiviContribute',NULL,'a:39:{s:6:\"fields\";a:7:{s:9:\"sort_name\";s:1:\"1\";s:6:\"amount\";s:1:\"1\";s:22:\"contribution_status_id\";s:1:\"1\";s:18:\"frequency_interval\";s:1:\"1\";s:14:\"frequency_unit\";s:1:\"1\";s:12:\"installments\";s:1:\"1\";s:8:\"end_date\";s:1:\"1\";}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:1:{i:0;s:1:\"5\";}s:11:\"currency_op\";s:2:\"in\";s:14:\"currency_value\";a:0:{}s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:17:\"frequency_unit_op\";s:2:\"in\";s:20:\"frequency_unit_value\";a:0:{}s:22:\"frequency_interval_min\";s:0:\"\";s:22:\"frequency_interval_max\";s:0:\"\";s:21:\"frequency_interval_op\";s:3:\"lte\";s:24:\"frequency_interval_value\";s:0:\"\";s:16:\"installments_min\";s:0:\"\";s:16:\"installments_max\";s:0:\"\";s:15:\"installments_op\";s:3:\"lte\";s:18:\"installments_value\";s:0:\"\";s:19:\"start_date_relative\";s:0:\"\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:37:\"next_sched_contribution_date_relative\";s:0:\"\";s:33:\"next_sched_contribution_date_from\";s:0:\"\";s:31:\"next_sched_contribution_date_to\";s:0:\"\";s:17:\"end_date_relative\";s:0:\"\";s:13:\"end_date_from\";s:0:\"\";s:11:\"end_date_to\";s:0:\"\";s:28:\"calculated_end_date_relative\";s:0:\"\";s:24:\"calculated_end_date_from\";s:0:\"\";s:22:\"calculated_end_date_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:41:\"Shows all pending recurring contributions\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:9:\"row_count\";s:0:\"\";s:14:\"addToDashboard\";s:1:\"1\";s:10:\"permission\";s:21:\"access CiviContribute\";s:9:\"parent_id\";s:0:\"\";s:11:\"instance_id\";N;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(22,1,'Membership Summary','member/summary',NULL,NULL,'Provides a summary of memberships by type and join date.','access CiviMember',NULL,'a:18:{s:6:\"fields\";a:2:{s:18:\"membership_type_id\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";}s:29:\"membership_join_date_relative\";s:1:\"0\";s:25:\"membership_join_date_from\";s:0:\"\";s:23:\"membership_join_date_to\";s:0:\"\";s:21:\"membership_type_id_op\";s:2:\"in\";s:24:\"membership_type_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:9:\"group_bys\";a:2:{s:9:\"join_date\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";}s:14:\"group_bys_freq\";a:1:{s:9:\"join_date\";s:5:\"MONTH\";}s:11:\"description\";s:56:\"Provides a summary of memberships by type and join date.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(23,1,'Membership Details','member/detail',NULL,NULL,'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.','access CiviMember',NULL,'a:28:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:4:\"name\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:29:\"membership_join_date_relative\";s:1:\"0\";s:25:\"membership_join_date_from\";s:0:\"\";s:23:\"membership_join_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:119:\"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(24,1,'Contribution and Membership Details','member/contributionDetail',NULL,NULL,'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.','access CiviMember',NULL,'a:67:{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:9:\"join_date\";s:1:\"1\";s:22:\"membership_status_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:29:\"membership_join_date_relative\";s:1:\"0\";s:25:\"membership_join_date_from\";s:0:\"\";s:23:\"membership_join_date_to\";s:0:\"\";s:30:\"membership_start_date_relative\";s:1:\"0\";s:26:\"membership_start_date_from\";s:0:\"\";s:24:\"membership_start_date_to\";s:0:\"\";s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:35:\"Contribution and Membership Details\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:1:\"0\";s:9:\"domain_id\";i:1;}{s:6:\"fields\";a:12:{s:9:\"sort_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:5:\"phone\";s:1:\"1\";s:17:\"financial_type_id\";s:1:\"1\";s:12:\"receive_date\";s:1:\"1\";s:12:\"total_amount\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:21:\"membership_start_date\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:9:\"join_date\";s:1:\"1\";s:22:\"membership_status_name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:21:\"receive_date_relative\";s:1:\"0\";s:17:\"receive_date_from\";s:0:\"\";s:15:\"receive_date_to\";s:0:\"\";s:20:\"financial_type_id_op\";s:2:\"in\";s:23:\"financial_type_id_value\";a:0:{}s:24:\"payment_instrument_id_op\";s:2:\"in\";s:27:\"payment_instrument_id_value\";a:0:{}s:25:\"contribution_status_id_op\";s:2:\"in\";s:28:\"contribution_status_id_value\";a:0:{}s:16:\"total_amount_min\";s:0:\"\";s:16:\"total_amount_max\";s:0:\"\";s:15:\"total_amount_op\";s:3:\"lte\";s:18:\"total_amount_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:13:\"ordinality_op\";s:2:\"in\";s:16:\"ordinality_value\";a:0:{}s:29:\"membership_join_date_relative\";s:1:\"0\";s:25:\"membership_join_date_from\";s:0:\"\";s:23:\"membership_join_date_to\";s:0:\"\";s:30:\"membership_start_date_relative\";s:1:\"0\";s:26:\"membership_start_date_from\";s:0:\"\";s:24:\"membership_start_date_to\";s:0:\"\";s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:23:\"owner_membership_id_min\";s:0:\"\";s:23:\"owner_membership_id_max\";s:0:\"\";s:22:\"owner_membership_id_op\";s:3:\"lte\";s:25:\"owner_membership_id_value\";s:0:\"\";s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:12:\"county_id_op\";s:2:\"in\";s:15:\"county_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:35:\"Contribution and Membership Details\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(25,1,'Lapsed Memberships','member/lapse',NULL,NULL,'Provides a list of memberships that have lapsed or will lapse by the date you specify.','access CiviMember',NULL,'a:16:{s:6:\"fields\";a:5:{s:9:\"sort_name\";s:1:\"1\";s:18:\"membership_type_id\";s:1:\"1\";s:19:\"membership_end_date\";s:1:\"1\";s:4:\"name\";s:1:\"1\";s:10:\"country_id\";s:1:\"1\";}s:6:\"tid_op\";s:2:\"in\";s:9:\"tid_value\";a:0:{}s:28:\"membership_end_date_relative\";s:1:\"0\";s:24:\"membership_end_date_from\";s:0:\"\";s:22:\"membership_end_date_to\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"description\";s:85:\"Provides a list of memberships that lapsed or will lapse before the date you specify.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviMember\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(26,1,'Event Participants List','event/participantListing',NULL,NULL,'Provides lists of participants for an event.','access CiviEvent',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:8:\"email_op\";s:3:\"has\";s:11:\"email_value\";s:0:\"\";s:11:\"event_id_op\";s:2:\"in\";s:14:\"event_id_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"rid_op\";s:2:\"in\";s:9:\"rid_value\";a:0:{}s:34:\"participant_register_date_relative\";s:1:\"0\";s:30:\"participant_register_date_from\";s:0:\"\";s:28:\"participant_register_date_to\";s:0:\"\";s:6:\"eid_op\";s:2:\"in\";s:9:\"eid_value\";a:0:{}s:11:\"custom_4_op\";s:2:\"in\";s:14:\"custom_4_value\";a:0:{}s:16:\"blank_column_end\";s:0:\"\";s:11:\"description\";s:44:\"Provides lists of participants for an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"groups\";s:0:\"\";s:7:\"options\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(27,1,'Event Income Summary','event/summary',NULL,NULL,'Provides an overview of event income. You can include key information such as event ID, registration, attendance, and income generated to help you determine the success of an event.','access CiviEvent',NULL,'a:18:{s:6:\"fields\";a:2:{s:5:\"title\";s:1:\"1\";s:13:\"event_type_id\";s:1:\"1\";}s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";a:0:{}s:16:\"event_type_id_op\";s:2:\"in\";s:19:\"event_type_id_value\";a:0:{}s:25:\"event_start_date_relative\";s:1:\"0\";s:21:\"event_start_date_from\";s:0:\"\";s:19:\"event_start_date_to\";s:0:\"\";s:23:\"event_end_date_relative\";s:1:\"0\";s:19:\"event_end_date_from\";s:0:\"\";s:17:\"event_end_date_to\";s:0:\"\";s:11:\"description\";s:181:\"Provides an overview of event income. You can include key information such as event ID, registration, attendance, and income generated to help you determine the success of an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(28,1,'Event Income Details','event/income',NULL,NULL,'Helps you to analyze the income generated by an event. The report can include details by participant type, status and payment method.','access CiviEvent',NULL,'a:7:{s:5:\"id_op\";s:2:\"in\";s:8:\"id_value\";N;s:11:\"description\";s:133:\"Helps you to analyze the income generated by an event. The report can include details by participant type, status and payment method.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(29,1,'Attendee List','event/participantListing',NULL,NULL,'Provides lists of event attendees.','access CiviEvent',NULL,'a:27:{s:6:\"fields\";a:4:{s:9:\"sort_name\";s:1:\"1\";s:8:\"event_id\";s:1:\"1\";s:9:\"status_id\";s:1:\"1\";s:7:\"role_id\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:8:\"email_op\";s:3:\"has\";s:11:\"email_value\";s:0:\"\";s:11:\"event_id_op\";s:2:\"in\";s:14:\"event_id_value\";a:0:{}s:6:\"sid_op\";s:2:\"in\";s:9:\"sid_value\";a:0:{}s:6:\"rid_op\";s:2:\"in\";s:9:\"rid_value\";a:0:{}s:34:\"participant_register_date_relative\";s:1:\"0\";s:30:\"participant_register_date_from\";s:0:\"\";s:28:\"participant_register_date_to\";s:0:\"\";s:6:\"eid_op\";s:2:\"in\";s:9:\"eid_value\";a:0:{}s:11:\"custom_4_op\";s:2:\"in\";s:14:\"custom_4_value\";a:0:{}s:16:\"blank_column_end\";s:0:\"\";s:11:\"description\";s:44:\"Provides lists of participants for an event.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviEvent\";s:6:\"groups\";s:0:\"\";s:7:\"options\";N;s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(30,1,'Grant Details','grant/detail',NULL,NULL,'Grant Report Detail','access CiviGrant',NULL,'a:40:{s:6:\"fields\";a:2:{s:9:\"sort_name\";s:1:\"1\";s:25:\"application_received_date\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:12:\"gender_id_op\";s:2:\"in\";s:15:\"gender_id_value\";a:0:{}s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"grant_type_op\";s:2:\"in\";s:16:\"grant_type_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:18:\"amount_granted_min\";s:0:\"\";s:18:\"amount_granted_max\";s:0:\"\";s:17:\"amount_granted_op\";s:3:\"lte\";s:20:\"amount_granted_value\";s:0:\"\";s:20:\"amount_requested_min\";s:0:\"\";s:20:\"amount_requested_max\";s:0:\"\";s:19:\"amount_requested_op\";s:3:\"lte\";s:22:\"amount_requested_value\";s:0:\"\";s:34:\"application_received_date_relative\";s:1:\"0\";s:30:\"application_received_date_from\";s:0:\"\";s:28:\"application_received_date_to\";s:0:\"\";s:28:\"money_transfer_date_relative\";s:1:\"0\";s:24:\"money_transfer_date_from\";s:0:\"\";s:22:\"money_transfer_date_to\";s:0:\"\";s:23:\"grant_due_date_relative\";s:1:\"0\";s:19:\"grant_due_date_from\";s:0:\"\";s:17:\"grant_due_date_to\";s:0:\"\";s:11:\"description\";s:19:\"Grant Report Detail\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviGrant\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(31,1,'Grant Statistics','grant/statistics',NULL,NULL,'Grant Report Statistics','access CiviGrant',NULL,'a:42:{s:6:\"fields\";a:2:{s:18:\"summary_statistics\";s:1:\"1\";s:13:\"grant_type_id\";s:1:\"1\";}s:34:\"application_received_date_relative\";s:1:\"0\";s:30:\"application_received_date_from\";s:0:\"\";s:28:\"application_received_date_to\";s:0:\"\";s:22:\"decision_date_relative\";s:1:\"0\";s:18:\"decision_date_from\";s:0:\"\";s:16:\"decision_date_to\";s:0:\"\";s:28:\"money_transfer_date_relative\";s:1:\"0\";s:24:\"money_transfer_date_from\";s:0:\"\";s:22:\"money_transfer_date_to\";s:0:\"\";s:23:\"grant_due_date_relative\";s:1:\"0\";s:19:\"grant_due_date_from\";s:0:\"\";s:17:\"grant_due_date_to\";s:0:\"\";s:13:\"grant_type_op\";s:2:\"in\";s:16:\"grant_type_value\";a:0:{}s:12:\"status_id_op\";s:2:\"in\";s:15:\"status_id_value\";a:0:{}s:20:\"amount_requested_min\";s:0:\"\";s:20:\"amount_requested_max\";s:0:\"\";s:19:\"amount_requested_op\";s:3:\"lte\";s:22:\"amount_requested_value\";s:0:\"\";s:18:\"amount_granted_min\";s:0:\"\";s:18:\"amount_granted_max\";s:0:\"\";s:17:\"amount_granted_op\";s:3:\"lte\";s:20:\"amount_granted_value\";s:0:\"\";s:24:\"grant_report_received_op\";s:2:\"eq\";s:27:\"grant_report_received_value\";s:0:\"\";s:12:\"gender_id_op\";s:2:\"in\";s:15:\"gender_id_value\";a:0:{}s:15:\"contact_type_op\";s:2:\"in\";s:18:\"contact_type_value\";a:0:{}s:12:\"region_id_op\";s:2:\"in\";s:15:\"region_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:11:\"description\";s:23:\"Grant Report Statistics\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:16:\"access CiviGrant\";s:9:\"parent_id\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(32,1,'Mail Bounces','Mailing/bounce',NULL,NULL,'Bounce Report for mailings','access CiviMail',NULL,'a:33:{s:6:\"fields\";a:5:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:11:\"bounce_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:19:\"bounce_type_name_op\";s:2:\"eq\";s:22:\"bounce_type_name_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:26:\"Bounce Report for mailings\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(33,1,'Mailing Summary','Mailing/summary',NULL,NULL,'Summary statistics for mailings','access CiviMail',NULL,'a:25:{s:6:\"fields\";a:5:{s:4:\"name\";s:1:\"1\";s:11:\"queue_count\";s:1:\"1\";s:15:\"delivered_count\";s:1:\"1\";s:12:\"bounce_count\";s:1:\"1\";s:17:\"unique_open_count\";s:1:\"1\";}s:15:\"is_completed_op\";s:2:\"eq\";s:18:\"is_completed_value\";s:1:\"1\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:9:\"status_op\";s:3:\"has\";s:12:\"status_value\";s:8:\"Complete\";s:11:\"is_test_min\";s:0:\"\";s:11:\"is_test_max\";s:0:\"\";s:10:\"is_test_op\";s:3:\"lte\";s:13:\"is_test_value\";s:1:\"0\";s:19:\"start_date_relative\";s:9:\"this.year\";s:15:\"start_date_from\";s:0:\"\";s:13:\"start_date_to\";s:0:\"\";s:17:\"end_date_relative\";s:9:\"this.year\";s:13:\"end_date_from\";s:0:\"\";s:11:\"end_date_to\";s:0:\"\";s:11:\"description\";s:31:\"Summary statistics for mailings\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(34,1,'Mail Opened','Mailing/opened',NULL,NULL,'Display contacts who opened emails from a mailing','access CiviMail',NULL,'a:31:{s:6:\"fields\";a:5:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:49:\"Display contacts who opened emails from a mailing\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(35,1,'Mail Clickthroughs','Mailing/clicks',NULL,NULL,'Display clicks from each mailing','access CiviMail',NULL,'a:31:{s:6:\"fields\";a:6:{s:2:\"id\";s:1:\"1\";s:10:\"first_name\";s:1:\"1\";s:9:\"last_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:5:\"email\";s:1:\"1\";s:3:\"url\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:9:\"source_op\";s:3:\"has\";s:12:\"source_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:15:\"mailing_name_op\";s:2:\"in\";s:18:\"mailing_name_value\";a:0:{}s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:8:\"tagid_op\";s:2:\"in\";s:11:\"tagid_value\";a:0:{}s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:9:\"order_bys\";a:1:{i:1;a:1:{s:6:\"column\";s:1:\"-\";}}s:11:\"description\";s:32:\"Display clicks from each mailing\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:6:\"groups\";s:0:\"\";s:6:\"charts\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(36,1,'Mailing Details','mailing/detail',NULL,NULL,'Provides reporting on Intended and Successful Deliveries, Unsubscribes and Opt-outs, Replies and Forwards.','access CiviMail',NULL,'a:30:{s:6:\"fields\";a:6:{s:9:\"sort_name\";s:1:\"1\";s:12:\"mailing_name\";s:1:\"1\";s:11:\"delivery_id\";s:1:\"1\";s:14:\"unsubscribe_id\";s:1:\"1\";s:9:\"optout_id\";s:1:\"1\";s:5:\"email\";s:1:\"1\";}s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:6:\"id_min\";s:0:\"\";s:6:\"id_max\";s:0:\"\";s:5:\"id_op\";s:3:\"lte\";s:8:\"id_value\";s:0:\"\";s:13:\"mailing_id_op\";s:2:\"in\";s:16:\"mailing_id_value\";a:0:{}s:18:\"delivery_status_op\";s:2:\"eq\";s:21:\"delivery_status_value\";s:0:\"\";s:18:\"is_unsubscribed_op\";s:2:\"eq\";s:21:\"is_unsubscribed_value\";s:0:\"\";s:12:\"is_optout_op\";s:2:\"eq\";s:15:\"is_optout_value\";s:0:\"\";s:13:\"is_replied_op\";s:2:\"eq\";s:16:\"is_replied_value\";s:0:\"\";s:15:\"is_forwarded_op\";s:2:\"eq\";s:18:\"is_forwarded_value\";s:0:\"\";s:6:\"gid_op\";s:2:\"in\";s:9:\"gid_value\";a:0:{}s:9:\"order_bys\";a:1:{i:1;a:2:{s:6:\"column\";s:9:\"sort_name\";s:5:\"order\";s:3:\"ASC\";}}s:11:\"description\";s:21:\"Mailing Detail Report\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:15:\"access CiviMail\";s:9:\"parent_id\";s:0:\"\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0),(37,1,'Survey Details','survey/detail',NULL,NULL,'Detailed report for canvassing, phone-banking, walk lists or other surveys.','access CiviReport',NULL,'a:39:{s:6:\"fields\";a:2:{s:9:\"sort_name\";s:1:\"1\";s:6:\"result\";s:1:\"1\";}s:22:\"assignee_contact_id_op\";s:2:\"eq\";s:25:\"assignee_contact_id_value\";s:0:\"\";s:12:\"sort_name_op\";s:3:\"has\";s:15:\"sort_name_value\";s:0:\"\";s:17:\"street_number_min\";s:0:\"\";s:17:\"street_number_max\";s:0:\"\";s:16:\"street_number_op\";s:3:\"lte\";s:19:\"street_number_value\";s:0:\"\";s:14:\"street_name_op\";s:3:\"has\";s:17:\"street_name_value\";s:0:\"\";s:15:\"postal_code_min\";s:0:\"\";s:15:\"postal_code_max\";s:0:\"\";s:14:\"postal_code_op\";s:3:\"lte\";s:17:\"postal_code_value\";s:0:\"\";s:7:\"city_op\";s:3:\"has\";s:10:\"city_value\";s:0:\"\";s:20:\"state_province_id_op\";s:2:\"in\";s:23:\"state_province_id_value\";a:0:{}s:13:\"country_id_op\";s:2:\"in\";s:16:\"country_id_value\";a:0:{}s:12:\"survey_id_op\";s:2:\"in\";s:15:\"survey_id_value\";a:0:{}s:12:\"status_id_op\";s:2:\"eq\";s:15:\"status_id_value\";s:1:\"1\";s:11:\"custom_1_op\";s:2:\"in\";s:14:\"custom_1_value\";a:0:{}s:11:\"custom_2_op\";s:2:\"in\";s:14:\"custom_2_value\";a:0:{}s:17:\"custom_3_relative\";s:1:\"0\";s:13:\"custom_3_from\";s:0:\"\";s:11:\"custom_3_to\";s:0:\"\";s:11:\"description\";s:75:\"Detailed report for canvassing, phone-banking, walk lists or other surveys.\";s:13:\"email_subject\";s:0:\"\";s:8:\"email_to\";s:0:\"\";s:8:\"email_cc\";s:0:\"\";s:10:\"permission\";s:17:\"access CiviReport\";s:6:\"groups\";s:0:\"\";s:9:\"domain_id\";i:1;}',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0); /*!40000 ALTER TABLE `civicrm_report_instance` ENABLE KEYS */; UNLOCK TABLES; @@ -1402,7 +1402,7 @@ UNLOCK TABLES; LOCK TABLES `civicrm_uf_field` WRITE; /*!40000 ALTER TABLE `civicrm_uf_field` DISABLE KEYS */; -INSERT INTO `civicrm_uf_field` (`id`, `uf_group_id`, `field_name`, `is_active`, `is_view`, `is_required`, `weight`, `help_post`, `help_pre`, `visibility`, `in_selector`, `is_searchable`, `location_type_id`, `phone_type_id`, `website_type_id`, `label`, `field_type`, `is_reserved`, `is_multi_summary`) VALUES (1,1,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(2,1,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(3,1,'street_address',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Street Address (Home)','Contact',0,0),(4,1,'city',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'City (Home)','Contact',0,0),(5,1,'postal_code',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Postal Code (Home)','Contact',0,0),(6,1,'country',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Country (Home)','Contact',0,0),(7,1,'state_province',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'State (Home)','Contact',0,0),(8,2,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(9,2,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(10,2,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(11,3,'participant_status',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Participant Status','Participant',1,0),(12,4,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(13,4,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(14,4,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(15,5,'organization_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Organization Name','Organization',0,0),(16,5,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(17,6,'household_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Household Name','Household',0,0),(18,6,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(19,7,'phone',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,1,1,NULL,'Home Phone','Contact',0,0),(20,7,'phone',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,1,2,NULL,'Home Mobile','Contact',0,0),(21,7,'street_address',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Primary Address','Contact',0,0),(22,7,'city',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'City','Contact',0,0),(23,7,'state_province',1,0,1,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'State','Contact',0,0),(24,7,'postal_code',1,0,1,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Postal Code','Contact',0,0),(25,7,'email',1,0,1,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Primary Email','Contact',0,0),(26,7,'group',1,0,1,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Groups','Contact',0,0),(27,7,'tag',1,0,1,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Tags','Contact',0,0),(28,7,'gender_id',1,0,1,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Gender','Individual',0,0),(29,7,'birth_date',1,0,1,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Date of Birth','Individual',0,0),(30,8,'street_address',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Street Address (Home)','Contact',1,0),(31,8,'city',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'City (Home)','Contact',1,0),(32,8,'postal_code',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Postal Code (Home)','Contact',0,0),(33,8,'country',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Country (Home)','Contact',0,0),(34,8,'state_province',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'State (Home)','Contact',0,0),(35,9,'organization_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Organization Name','Organization',0,0),(36,9,'phone',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,3,1,NULL,'Phone (Main) ','Contact',0,0),(37,9,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Email (Main) ','Contact',0,0),(38,9,'street_address',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Street Address','Contact',0,0),(39,9,'city',1,0,1,5,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'City','Contact',0,0),(40,9,'postal_code',1,0,1,6,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Postal Code','Contact',0,0),(41,9,'country',1,0,1,7,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Country','Contact',0,0),(42,9,'state_province',1,0,1,8,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'State/Province','Contact',0,0),(43,10,'financial_type',1,0,0,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Financial Type','Contribution',1,0),(44,10,'total_amount',1,0,0,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Amount','Contribution',1,0),(45,10,'contribution_status_id',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Status','Contribution',1,0),(46,10,'receive_date',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Received','Contribution',1,0),(47,10,'contribution_source',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Source','Contribution',0,0),(48,10,'payment_instrument',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Method','Contribution',0,0),(49,10,'contribution_check_number',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Check Number','Contribution',0,0),(50,10,'send_receipt',1,0,0,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Send Receipt','Contribution',0,0),(51,10,'invoice_id',1,0,0,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Invoice ID','Contribution',0,0),(52,10,'soft_credit',1,0,0,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit','Contribution',0,0),(53,10,'soft_credit_type',1,0,0,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit Type','Contribution',0,0),(54,11,'membership_type',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Membership Type','Membership',1,0),(55,11,'join_date',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Member Since','Membership',1,0),(56,11,'membership_start_date',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Start Date','Membership',1,0),(57,11,'membership_end_date',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'End Date','Membership',1,0),(58,11,'membership_source',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Source','Membership',0,0),(59,11,'send_receipt',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Send Receipt','Membership',0,0),(60,11,'financial_type',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Financial Type','Membership',1,0),(61,11,'total_amount',1,0,0,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Amount','Membership',1,0),(62,11,'receive_date',1,0,1,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Received','Membership',1,0),(63,11,'payment_instrument',1,0,0,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Method','Membership',0,0),(64,11,'contribution_check_number',1,0,0,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Check Number','Membership',0,0),(65,11,'contribution_status_id',1,0,1,12,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Status','Membership',1,0),(66,11,'soft_credit',1,0,0,13,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit','Membership',0,0),(67,11,'soft_credit_type',1,0,0,14,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit Type','Membership',0,0),(68,12,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(69,12,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(70,12,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(71,13,'prefix_id',1,0,0,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Individual Prefix','Individual',1,0),(72,13,'first_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',1,0),(73,13,'last_name',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',1,0),(74,13,'email',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Email Address','Contact',1,0); +INSERT INTO `civicrm_uf_field` (`id`, `uf_group_id`, `field_name`, `is_active`, `is_view`, `is_required`, `weight`, `help_post`, `help_pre`, `visibility`, `in_selector`, `is_searchable`, `location_type_id`, `phone_type_id`, `website_type_id`, `label`, `field_type`, `is_reserved`, `is_multi_summary`) VALUES (1,1,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(2,1,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(3,1,'street_address',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Street Address (Home)','Contact',0,0),(4,1,'city',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'City (Home)','Contact',0,0),(5,1,'postal_code',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Postal Code (Home)','Contact',0,0),(6,1,'country',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Country (Home)','Contact',0,0),(7,1,'state_province',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'State (Home)','Contact',0,0),(8,2,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(9,2,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(10,2,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(11,3,'participant_status',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Participant Status','Participant',1,0),(12,4,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(13,4,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(14,4,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(15,5,'organization_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Organization Name','Organization',0,0),(16,5,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(17,6,'household_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Household Name','Household',0,0),(18,6,'email',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(19,7,'phone',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,1,1,NULL,'Home Phone','Contact',0,0),(20,7,'phone',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,1,2,NULL,'Home Mobile','Contact',0,0),(21,7,'street_address',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Primary Address','Contact',0,0),(22,7,'city',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'City','Contact',0,0),(23,7,'state_province',1,0,1,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'State','Contact',0,0),(24,7,'postal_code',1,0,1,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Postal Code','Contact',0,0),(25,7,'email',1,0,1,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Primary Email','Contact',0,0),(26,7,'group',1,0,1,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Groups','Contact',0,0),(27,7,'tag',1,0,1,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Tags','Contact',0,0),(28,7,'gender_id',1,0,1,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Gender','Individual',0,0),(29,7,'birth_date',1,0,1,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Date of Birth','Individual',0,0),(30,8,'street_address',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Street Address (Home)','Contact',1,0),(31,8,'city',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'City (Home)','Contact',1,0),(32,8,'postal_code',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Postal Code (Home)','Contact',0,0),(33,8,'country',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Country (Home)','Contact',0,0),(34,8,'state_province',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'State (Home)','Contact',0,0),(35,9,'organization_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Organization Name','Organization',0,0),(36,9,'phone',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,3,1,NULL,'Phone (Main) ','Contact',0,0),(37,9,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Email (Main) ','Contact',0,0),(38,9,'street_address',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Street Address','Contact',0,0),(39,9,'city',1,0,1,5,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'City','Contact',0,0),(40,9,'postal_code',1,0,1,6,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Postal Code','Contact',0,0),(41,9,'country',1,0,1,7,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'Country','Contact',0,0),(42,9,'state_province',1,0,1,8,NULL,NULL,'User and User Admin Only',0,0,3,NULL,NULL,'State/Province','Contact',0,0),(43,10,'financial_type',1,0,0,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Financial Type','Contribution',1,0),(44,10,'total_amount',1,0,0,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Amount','Contribution',1,0),(45,10,'contribution_status_id',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Status','Contribution',1,0),(46,10,'receive_date',1,0,1,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Received','Contribution',1,0),(47,10,'contribution_source',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Source','Contribution',0,0),(48,10,'payment_instrument',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Method','Contribution',0,0),(49,10,'contribution_check_number',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Check Number','Contribution',0,0),(50,10,'send_receipt',1,0,0,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Send Receipt','Contribution',0,0),(51,10,'invoice_id',1,0,0,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Invoice ID','Contribution',0,0),(52,10,'soft_credit',1,0,0,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit','Contribution',0,0),(53,10,'soft_credit_type',1,0,0,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit Type','Contribution',0,0),(54,11,'membership_type',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Membership Type','Membership',1,0),(55,11,'membership_join_date',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Member Since','Membership',1,0),(56,11,'membership_start_date',1,0,0,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Start Date','Membership',1,0),(57,11,'membership_end_date',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'End Date','Membership',1,0),(58,11,'membership_source',1,0,0,5,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Source','Membership',0,0),(59,11,'send_receipt',1,0,0,6,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Send Receipt','Membership',0,0),(60,11,'financial_type',1,0,0,7,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Financial Type','Membership',1,0),(61,11,'total_amount',1,0,0,8,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Amount','Membership',1,0),(62,11,'receive_date',1,0,1,9,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Received','Membership',1,0),(63,11,'payment_instrument',1,0,0,10,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Method','Membership',0,0),(64,11,'contribution_check_number',1,0,0,11,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Check Number','Membership',0,0),(65,11,'contribution_status_id',1,0,1,12,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Payment Status','Membership',1,0),(66,11,'soft_credit',1,0,0,13,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit','Membership',0,0),(67,11,'soft_credit_type',1,0,0,14,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Soft Credit Type','Membership',0,0),(68,12,'first_name',1,0,1,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',0,0),(69,12,'last_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',0,0),(70,12,'email',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Email Address','Contact',0,0),(71,13,'prefix_id',1,0,0,1,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Individual Prefix','Individual',1,0),(72,13,'first_name',1,0,1,2,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'First Name','Individual',1,0),(73,13,'last_name',1,0,1,3,NULL,NULL,'User and User Admin Only',0,0,NULL,NULL,NULL,'Last Name','Individual',1,0),(74,13,'email',1,0,0,4,NULL,NULL,'User and User Admin Only',0,0,1,NULL,NULL,'Email Address','Contact',1,0); /*!40000 ALTER TABLE `civicrm_uf_field` ENABLE KEYS */; UNLOCK TABLES; diff --git a/civicrm/sql/civicrm_navigation.mysql b/civicrm/sql/civicrm_navigation.mysql index ca63c255873c02c18f1d3aa42bbb039c8b5978b9..f200f5af8ab5abe2c8ef7f766a6648dc1db02a03 100644 --- a/civicrm/sql/civicrm_navigation.mysql +++ b/civicrm/sql/civicrm_navigation.mysql @@ -737,17 +737,17 @@ VALUES INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Membership Summary', 'member/summary', 'Provides a summary of memberships by type and join date.', 'access CiviMember', 'a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Membership Summary', 'member/summary', 'Provides a summary of memberships by type and join date.', 'access CiviMember', 'a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Membership Details', 'member/detail', 'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.', 'access CiviMember', 'a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Membership Details', 'member/detail', 'Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.', 'access CiviMember', 'a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, 'Contribution and Membership Details', 'member/contributionDetail', 'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.', 'access CiviMember', 'a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); + ( @domainID, 'Contribution and Membership Details', 'member/contributionDetail', 'Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.', 'access CiviMember', 'a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) diff --git a/civicrm/templates/CRM/Activity/Form/Activity.tpl b/civicrm/templates/CRM/Activity/Form/Activity.tpl index f1ca57e4854f6ee6259e82f644c945878c8f74a7..ac19690e42e3eb4a5d08570f06d7a4ef5cad9299 100644 --- a/civicrm/templates/CRM/Activity/Form/Activity.tpl +++ b/civicrm/templates/CRM/Activity/Form/Activity.tpl @@ -79,7 +79,7 @@ </td> </tr> - {if $form.separation } + {if $form.separation} <tr class="crm-activity-form-block-separation crm-is-multi-activity-wrapper"> <td class="label">{$form.separation.label}</td> <td>{$form.separation.html} {help id="separation"}</td> @@ -252,7 +252,7 @@ {/if} {* End Delete vs. Add / Edit action *} </table> <div class="crm-submit-buttons"> - {if $action eq 4 && ($activityTName neq 'Inbound Email' || $allow_edit_inbound_emails == 1)} + {if $action eq 4 && ($activityTypeNameAndLabel.machineName neq 'Inbound Email' || $allow_edit_inbound_emails == 1)} {if !$context } {assign var="context" value='activity'} {/if} diff --git a/civicrm/templates/CRM/Grant/Form/Grant.tpl b/civicrm/templates/CRM/Grant/Form/Grant.tpl index a3385f6929edd5a93d52c82bc5d2709e77df5089..6deac7d975d4eb2ed97f3d9ff27d7e057ad4eefa 100644 --- a/civicrm/templates/CRM/Grant/Form/Grant.tpl +++ b/civicrm/templates/CRM/Grant/Form/Grant.tpl @@ -35,12 +35,10 @@ {else} <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="top"}</div> <table class="form-layout-compressed"> - {if $context eq 'standalone'} <tr class="crm-grant-form-block-contact_id"> <td class="label">{$form.contact_id.label}</td> <td>{$form.contact_id.html}</td> </tr> - {/if} <tr class="crm-grant-form-block-status_id"> <td class="label">{$form.status_id.label}</td> <td>{$form.status_id.html}</td> diff --git a/civicrm/templates/CRM/Group/Form/Search.tpl b/civicrm/templates/CRM/Group/Form/Search.tpl index f73fd4b10e9f8bdd6f77851910215e10fb4b321c..d31dd2103bc0385b64221e4355c5901d3f065b5b 100644 --- a/civicrm/templates/CRM/Group/Form/Search.tpl +++ b/civicrm/templates/CRM/Group/Form/Search.tpl @@ -109,7 +109,7 @@ // on initial load of manage group page and // also to handle search filtering for initial load of same page. var parentsOnly = 1 - var ZeroRecordText = {/literal}'{ts escape="js"}<div class="status messages">No Groups have been created for this site.{/ts}</div>'{literal}; + var ZeroRecordText = {/literal}'{ts escape="js"}<div class="status messages">None found.{/ts}</div>'{literal}; $('table.crm-group-selector').data({ "ajax": { "url": {/literal}'{crmURL p="civicrm/ajax/grouplist" h=0 q="snippet=4"}'{literal}, diff --git a/civicrm/templates/CRM/Mailing/Form/Search.tpl b/civicrm/templates/CRM/Mailing/Form/Search.tpl index c726adf719088e672f4d9c58dfcf25eb6adae783..467e174b938750217cf9d815e4de9d6c35e1f5bb 100644 --- a/civicrm/templates/CRM/Mailing/Form/Search.tpl +++ b/civicrm/templates/CRM/Mailing/Form/Search.tpl @@ -24,62 +24,57 @@ +--------------------------------------------------------------------+ *} <div class="crm-block crm-form-block crm-search-form-block"> -<table class="form-layout"> + <table class="form-layout"> <tr> - <td>{$form.mailing_name.label} {help id="id-mailing_name"}<br /> - {$form.mailing_name.html|crmAddClass:big} - </td> - </tr> - <tr> - <td> - <label>{if $sms eq 1}{ts}SMS Date{/ts}{else}{ts}Mailing Date{/ts}{/if}</label> - </td> + <td>{$form.mailing_name.label} {help id="id-mailing_name"}<br /> + {$form.mailing_name.html|crmAddClass:big} + </td> </tr> <tr> - {include file="CRM/Core/DateRange.tpl" fieldName="mailing" from='_from' to='_to'} + {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="mailing" colspan='2'} </tr> <tr> - <td colspan="1">{$form.sort_name.label} {help id="id-create_sort_name"}<br /> - {$form.sort_name.html|crmAddClass:big} - <br/><br/> - <div class="crm-search-form-block-is_archive"> - {$form.is_archived.label} {help id="is_archived"}<br/> - {$form.is_archived.html} - </div> - </td> - {if $form.mailing_status} - <td width="100%"><label>{if $sms eq 1}{ts}SMS Status{/ts}{else}{ts}Mailing Status{/ts}{/if}</label><br /> + <td colspan="1">{$form.sort_name.label} {help id="id-create_sort_name"}<br /> + {$form.sort_name.html|crmAddClass:big} + <br/><br/> + <div class="crm-search-form-block-is_archive"> + {$form.is_archived.label} {help id="is_archived"}<br/> + {$form.is_archived.html} + </div> + </td> + {if $form.mailing_status} + <td width="100%"><label>{if $sms eq 1}{ts}SMS Status{/ts}{else}{ts}Mailing Status{/ts}{/if}</label><br /> <div class="listing-box" style="height: auto"> {foreach from=$form.mailing_status item="mailing_status_val"} - <div class="{cycle values="odd-row,even-row"}"> - {$mailing_status_val.html} - </div> + <div class="{cycle values="odd-row,even-row"}"> + {$mailing_status_val.html} + </div> {/foreach} <div class="{cycle values="odd-row,even-row"}"> {$form.status_unscheduled.html} </div> - </div><br /> - </td> - {/if} + </div><br /> + </td> + {/if} </tr> {* language *} {if $form.language} <tr> <td>{$form.language.label} {help id="id-language"}<br /> - {$form.language.html|crmAddClass:big} + {$form.language.html|crmAddClass:big} </td> </tr> {/if} {* campaign in mailing search *} {include file="CRM/Campaign/Form/addCampaignToComponent.tpl" - campaignContext="componentSearch" campaignTrClass='' campaignTdClass=''} + campaignContext="componentSearch" campaignTrClass='' campaignTdClass=''} <tr> - <td>{$form.buttons.html}</td><td colspan="2"></td> + <td>{$form.buttons.html}</td><td colspan="2"></td> </tr> -</table> + </table> </div> {literal} diff --git a/civicrm/templates/CRM/Member/Form/Search/Common.tpl b/civicrm/templates/CRM/Member/Form/Search/Common.tpl index 38d8b78b37773faf1f0b1b183e4df12862420b0b..79592f98597fa5344d305cd5975b364c38082f96 100644 --- a/civicrm/templates/CRM/Member/Form/Search/Common.tpl +++ b/civicrm/templates/CRM/Member/Form/Search/Common.tpl @@ -33,58 +33,43 @@ </tr> <tr> - <td> - {$form.member_source.label} - <br />{$form.member_source.html} - <p> - {$form.member_test.label} {help id="is-test" file="CRM/Contact/Form/Search/Advanced"} {$form.member_test.html} - </p> + <td>{$form.member_source.label}<br /> + {$form.member_source.html} </td> <td> - <p> - {$form.membership_is_current_member.label} + {$form.membership_is_current_member.label}<br /> {$form.membership_is_current_member.html} - </p> - <p> - {$form.member_is_primary.label} - {help id="id-member_is_primary" file="CRM/Member/Form/Search.hlp"} - {$form.member_is_primary.html} - </p> - <p> - {$form.member_pay_later.label} {$form.member_pay_later.html} - </p> - <p> - {if $form.member_auto_renew} - <label>{$form.member_auto_renew.label}</label> - {help id="id-member_auto_renew" file="CRM/Member/Form/Search.hlp"} - <br/> - {$form.member_auto_renew.html} - {/if} - </p> - <p> - {$form.member_is_override.label} - {help id="id-member_is_override" file="CRM/Member/Form/Search.hlp"} - {$form.member_is_override.html} - </p> </td> </tr> - +<tr> + <td>{$form.member_test.label} {help id="is-test" file="CRM/Contact/Form/Search/Advanced"} {$form.member_test.html} + </td> + <td> + {$form.member_is_primary.label} {help id="id-member_is_primary" file="CRM/Member/Form/Search.hlp"} {$form.member_is_primary.html} + </td> +</tr> <tr><td><label>{$form.membership_id.label}</label> {$form.membership_id.html}</td> + <td>{$form.member_pay_later.label} {$form.member_pay_later.html}</td> </tr> - -<tr><td><label>{ts}Member Since{/ts}</label></td></tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="member_join_date" from='_low' to='_high'} + <td> + {if $form.member_auto_renew} + <label>{$form.member_auto_renew.label}</label> + {help id="id-member_auto_renew" file="CRM/Member/Form/Search.hlp"} + <br/> + {$form.member_auto_renew.html} + {/if} + </td> + <td>{$form.member_is_override.label}{help id="id-member_is_override" file="CRM/Member/Form/Search.hlp"}{$form.member_is_override.html}</td> </tr> - -<tr><td><label>{ts}Start Date{/ts}</label></td></tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="member_start_date" from='_low' to='_high'} + {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="membership_join_date" colspan='2'} +</tr> +<tr> + {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="membership_start_date" colspan='2'} </tr> - -<tr><td><label>{ts}End Date{/ts}</label></td></tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="member_end_date" from='_low' to='_high'} + {include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="membership_end_date" colspan='2'} </tr> {* campaign in membership search *} diff --git a/civicrm/templates/CRM/Member/Form/Selector.tpl b/civicrm/templates/CRM/Member/Form/Selector.tpl index cfd4dc1ff9d4afd9d27c5a2790589d308a69abb5..f33db8e4a6eda8471eccc350fc9fc0fd3b26578c 100644 --- a/civicrm/templates/CRM/Member/Form/Selector.tpl +++ b/civicrm/templates/CRM/Member/Form/Selector.tpl @@ -62,7 +62,7 @@ {$row.membership_type}{if $row.is_test} ({ts}test{/ts}){/if} {if $row.owner_membership_id}<br />({ts}by relationship{/ts}){/if} </td> - <td class="crm-membership-join_date">{$row.join_date|truncate:10:''|crmDate}</td> + <td class="crm-membership-join_date">{$row.membership_join_date|truncate:10:''|crmDate}</td> <td class="crm-membership-start_date">{$row.membership_start_date|truncate:10:''|crmDate}</td> <td class="crm-membership-end_date">{$row.membership_end_date|truncate:10:''|crmDate}</td> <td class="crm-membership-source">{$row.membership_source}</td> diff --git a/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl b/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl index dbd5cc6d6cedabb1b118bb169e739d98b53196cd..9168c503b3476d4c045c29c2c919ad4a3fd57c35 100644 --- a/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl +++ b/civicrm/templates/CRM/Pledge/Form/Search/Common.tpl @@ -25,7 +25,7 @@ *} <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="pledge_payment_date" from='_low' to='_high' label="<label>Payment Scheduled</label>"} +{include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="pledge_payment_scheduled_date" colspan="2"} </tr> <tr> <td colspan="2"> @@ -45,13 +45,13 @@ </td> </tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="pledge_create_date" from='_low' to='_high' label="<label>Pledge Made</label>"} +{include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="pledge_create_date" colspan="2"} </tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="pledge_start_date" from='_low' to='_high' label="<label>Payments Start Date</label>"} +{include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="pledge_start_date" colspan="2"} </tr> <tr> -{include file="CRM/Core/DateRange.tpl" fieldName="pledge_end_date" from='_low' to='_high' label="<label>Payments Ended Date</label>"} +{include file="CRM/Core/DatePickerRangeWrapper.tpl" fieldName="pledge_end_date" colspan="2"} </tr> <tr> <td> diff --git a/civicrm/templates/CRM/Price/Form/Calculate.tpl b/civicrm/templates/CRM/Price/Form/Calculate.tpl index 268ce89acf0e0b930e71580a3606f5bf1aa0d27f..ec93545237f8df3010c105b7514587f00f363779 100644 --- a/civicrm/templates/CRM/Price/Form/Calculate.tpl +++ b/civicrm/templates/CRM/Price/Form/Calculate.tpl @@ -25,15 +25,16 @@ *} {assign var='hideTotal' value=$quickConfig+$noCalcValueDisplay} + <div id="pricesetTotal" class="crm-section section-pricesetTotal"> - <div class="label -{if $hideTotal}, hiddenElement{/if}" id="pricelabel"> - {if ( $extends eq 'Contribution' ) || ( $extends eq 'Membership' )} - <span id='amount_sum_label'>{ts}Total Amount{/ts}{else}{ts}Total Fee(s){/ts}</span> - {if $isAdditionalParticipants} {ts}for this participant{/ts}{/if} + <div id="pricelabel" class="label {if $hideTotal}hiddenElement{/if}"> + {if ($extends eq 'Contribution') || ($extends eq 'Membership')} + <span id='amount_sum_label'>{ts}Total Amount{/ts}</span> + {else} + <span id='amount_sum_label'>{ts}Total Fee(s){/ts}{if $isAdditionalParticipants} {ts}for this participant{/ts}{/if}</span> {/if} </div> - <div class="content calc-value" {if $hideTotal}style="display:none;"{/if} id="pricevalue" ></div> + <div class="content calc-value" {if $hideTotal}style="display:none;"{/if} id="pricevalue"></div> </div> <script type="text/javascript"> @@ -44,25 +45,23 @@ var separator = '{/literal}{$config->monetaryDecimalPoint}{literal}'; var symbol = '{/literal}{$currencySymbol}{literal}'; var optionSep = '|'; +// Recalculate the total fees based on user selection cj("#priceset [price]").each(function () { + var elementType = cj(this).attr('type'); + if (this.tagName == 'SELECT') { + elementType = 'select-one'; + } - var elementType = cj(this).attr('type'); - if ( this.tagName == 'SELECT' ) { - elementType = 'select-one'; - } - - switch(elementType) { - case 'checkbox': - //event driven calculation of element. - cj(this).click(function(){ - calculateCheckboxLineItemValue(this); - display(calculateTotalFee()); - }); + switch(elementType) { + case 'checkbox': + cj(this).click(function(){ calculateCheckboxLineItemValue(this); + display(calculateTotalFee()); + }); + calculateCheckboxLineItemValue(this); break; case 'radio': - //event driven calculation of element. cj(this).click( function(){ calculateRadioLineItemValue(this); display(calculateTotalFee()); @@ -70,32 +69,26 @@ cj("#priceset [price]").each(function () { calculateRadioLineItemValue(this); break; - case 'text': - - //event driven calculation of element. - cj(this).bind( 'keyup', function() { - calculateText(this); - }).bind( 'blur' , function() { + case 'text': + cj(this).bind( 'keyup', function() { + calculateText(this); + }).bind( 'blur' , function() { + calculateText(this); + }); + //default calculation of element. calculateText(this); - }); - //default calculation of element. - calculateText(this); - - break; - - case 'select-one': - calculateSelectLineItemValue(this); + break; - //event driven calculation of element. - cj(this).change( function() { + case 'select-one': calculateSelectLineItemValue(this); - display(calculateTotalFee()); - }); - - - break; + cj(this).change(function() { + calculateSelectLineItemValue(this); + display(calculateTotalFee()); + }); + break; } + display(calculateTotalFee()); }); diff --git a/civicrm/templates/CRM/Report/Form/Contact/Detail.tpl b/civicrm/templates/CRM/Report/Form/Contact/Detail.tpl index a3e05682d586c39937d48c171218054e4cefce3b..83560773dd675662e5dd3bc3c621adfec2a44a24 100644 --- a/civicrm/templates/CRM/Report/Form/Contact/Detail.tpl +++ b/civicrm/templates/CRM/Report/Form/Contact/Detail.tpl @@ -201,3 +201,10 @@ {/if} {include file="CRM/Report/Form/ErrorMessage.tpl"} </div> + + +{if $outputMode == 'print'} + <script type="text/javascript"> + window.print(); + </script> +{/if} \ No newline at end of file diff --git a/civicrm/templates/CRM/Report/Form/Tabs/OrderBy.tpl b/civicrm/templates/CRM/Report/Form/Tabs/OrderBy.tpl index a785e6f8fd1129b92f90e16e7c40bfdb0e0aee81..1d00a21bac5e97a7f00623697fd21f31102aa427 100644 --- a/civicrm/templates/CRM/Report/Form/Tabs/OrderBy.tpl +++ b/civicrm/templates/CRM/Report/Form/Tabs/OrderBy.tpl @@ -82,8 +82,8 @@ function hideRow(i) { showHideRow(i); // clear values on hidden field, so they're not saved - cj('select#order_by_column_'+ i).val(''); - cj('select#order_by_order_'+ i).val('ASC'); + cj('select#order_bys_'+ i +'_column').val('-'); + cj('select#order_bys_'+ i +'_order').val('ASC'); cj('input#order_by_section_'+ i).prop('checked', false); cj('input#order_by_pagebreak_'+ i).prop('checked', false); } diff --git a/civicrm/templates/CRM/common/customData.tpl b/civicrm/templates/CRM/common/customData.tpl index 68208c9995597766b3681e95b13d4145a86282c3..867013c0d4154170adcd76089f9fad2083dbca6d 100644 --- a/civicrm/templates/CRM/common/customData.tpl +++ b/civicrm/templates/CRM/common/customData.tpl @@ -26,7 +26,7 @@ {literal} <script type="text/javascript"> (function($) { - CRM.buildCustomData = function (type, subType, subName, cgCount, groupID, isMultiple, onlySubtype) { + CRM.buildCustomData = function (type, subType, subName, cgCount, groupID, isMultiple, onlySubtype, cid) { var dataUrl = CRM.url('civicrm/custom', {type: type}), prevCount = 1, fname = '#customData', @@ -62,9 +62,12 @@ dataUrl += '&qf=' + '{$qfKey}'; {/if} {if $action} - dataUrl += '&action=' + '{$action}'; + dataUrl += '&action=' + '{$action}'; {/if} {literal} + if (cid) { + dataUrl += '&cid=' + cid; + } if (!cgCount) { cgCount = 1; diff --git a/civicrm/templates/CRM/common/customDataBlock.tpl b/civicrm/templates/CRM/common/customDataBlock.tpl index d98b4a996af720665eeeb5c4a21fbcf2dbd006b2..ca3848df706259a29bd4951d286bb27b8469c6bd 100644 --- a/civicrm/templates/CRM/common/customDataBlock.tpl +++ b/civicrm/templates/CRM/common/customDataBlock.tpl @@ -2,14 +2,15 @@ <div id="customData"></div> {*include custom data js file*} {include file="CRM/common/customData.tpl"} + {assign var='cid' value=$cid|default:'false'} {literal} <script type="text/javascript"> CRM.$(function($) { {/literal} {if $customDataSubType} - CRM.buildCustomData('{$customDataType}', {$customDataSubType}); + CRM.buildCustomData('{$customDataType}', {$customDataSubType}, false, false, false, false, false, {$cid}); {else} - CRM.buildCustomData('{$customDataType}'); + CRM.buildCustomData('{$customDataType}', false, false, false, false, false, false, {$cid}); {/if} {literal} }); diff --git a/civicrm/templates/CRM/common/fatal.tpl b/civicrm/templates/CRM/common/fatal.tpl index 321402ac84bfd21ac3a2f6c98bc224e59b7fc03a..61ba067007e8e4a433f5e2282f560640e7a2ff76 100644 --- a/civicrm/templates/CRM/common/fatal.tpl +++ b/civicrm/templates/CRM/common/fatal.tpl @@ -24,7 +24,7 @@ +--------------------------------------------------------------------+ *} {* error.tpl: Display page for fatal errors. Provides complete HTML doc.*} -{if $config->userFramework != 'Joomla' and $config->userFramework != 'WordPress'} +{if $config->userFramework != 'WordPress'} <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> @@ -89,7 +89,7 @@ function toggle( element ) { } </script> {/literal} -{if $config->userFramework != 'Joomla' and $config->userFramework != 'WordPress'} +{if $config->userFramework != 'WordPress'} </body> </html> {/if} diff --git a/civicrm/vendor/autoload.php b/civicrm/vendor/autoload.php index f0caaff70e74276e2dd090e82ccc44738e9f981f..6e60cb6a89f446da008f1ef77009b203cdedf715 100644 --- a/civicrm/vendor/autoload.php +++ b/civicrm/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6::getLoader(); +return ComposerAutoloaderInitbb3b672ecd66f991faa2e0268d5d8880::getLoader(); diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/.gitignore b/civicrm/vendor/civicrm/composer-downloads-plugin/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..4a45ef5f7ae40e071bc802752555118cb7e07eec --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/.gitignore @@ -0,0 +1,3 @@ +vendor +composer.lock +.php_cs.cache diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/.php_cs.dist b/civicrm/vendor/civicrm/composer-downloads-plugin/.php_cs.dist new file mode 100644 index 0000000000000000000000000000000000000000..b2de1a8cb500c58d47d12f9ffdad446ff7c34d7a --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/.php_cs.dist @@ -0,0 +1,22 @@ +<?php + +$header = <<<'EOF' +This file is part of Composer Extra Files Plugin. + +(c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> + +This source file is subject to the MIT license that is bundled +with this source code in the file LICENSE. +EOF; + +return PhpCsFixer\Config::create() + ->setRiskyAllowed(true) + ->setRules([ + '@Symfony' => true, + '@Symfony:risky' => true, + 'header_comment' => ['header' => $header], + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->in([__DIR__.'/src', __DIR__.'/tests']) + ); diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/LICENSE b/civicrm/vendor/civicrm/composer-downloads-plugin/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..eda17bec4b8978fac6cde9d0a7d2a894df79f08a --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/LICENSE @@ -0,0 +1,20 @@ +(c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> +(c) 2019 CiviCRM LLC, Tim Otten <info@civicrm.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/README.md b/civicrm/vendor/civicrm/composer-downloads-plugin/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9a4530db0c2a3446de07d1d029e66dec75ba6012 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/README.md @@ -0,0 +1,94 @@ +Composer Downloads Plugin +=========================== + +> This is a fork of [lastcall/composer-extra-files](https://github.com/LastCallMedia/ComposerExtraFiles/). Some of the +> configuration options have changed, so it has been renamed to prevent it from conflicting in real-world usage. + +This `composer` plugin allows you to download extra files (`*.zip` or `*.tar.gz`) and extract them within your package. + +For example, suppose you publish a PHP package `foo/bar` which relies on an external artifact (such as JS, CSS, or image library). Place this configuration in the `composer.json` for `foo/bar`: + +```json +{ + "name": "foo/bar", + "require": { + "civicrm/composer-downloads-plugin": "~1.0" + }, + "extra": { + "downloads": { + "examplelib": { + "url": "`https://example.com/examplelib-0.1.zip`", + "path": "extern/examplelib", + "ignore": ["test", "doc", ".*"] + } + } + } +} +``` + +When a downstream user of `foo/bar` runs `composer install`, it will fetch and extract the zip file, creating `vendor/foo/bar/extern/examplelib`. + +This does not require consumers of `foo/bar` to make any special changes in their root-level project, and it uses `composer`'s built-in cache system. + +## When should I use this? + +The most common use-case is if you have compiled front-end code, where the compiled version is never committed to a git repository, and therefore isn't registered on packagist.org. For example, if you want your distributed package to depend on an NPM/Bower package. + +If you have the ability to maintain the root `composer.json` of consumers, then consider these alternatives -- when using multiple NPM/Bower packages, they provide more robust functionality (such as automatic updates and version-constraints). + +* [Asset Packagist](https://asset-packagist.org/) +* [Composer Asset Plugin](https://github.com/fxpio/composer-asset-plugin) + +The `downloads` approach is most appropriate if (a) you publish an intermediate (non-root) project to diverse consumers and (b) the external assets are relatively stable. + +## Configuration: Properties + +The `downloads` contains a list of files to download. Each extra-file as a symbolic ID (e.g. `examplelib` above) and some mix of properties: + +* `url`: The URL to fetch the content from. If it points to a tarball or zip file, it will be unpacked automatically. + +* `path`: The releative path where content will be extracted. + +* `type`: Determines how the download is handled + * `archive`: The `url` references a zip or tarball which should be extracted at the given `path`. (Default for URLs involving `*.zip`, `*.tar.gz`, or `*.tgz`.) + * `file`: The `url` should be downloaded to the given `path`. + * `phar`: The `url` references a PHP executable which should be installed at the given `path`. + +* `ignore`: A list of a files that should be omited from the extracted folder. (This supports a subset of `.gitignore` notation.) + +## Configuration: Defaults + +You may set default values for downloaded files using the `*` entry. + +```json +{ + "extra": { + "downloads": { + "*": { + "path": "bower_components/{$id}", + "ignore": ["test", "tests", "doc", "docs"] + }, + "jquery": { + "url": "https://github.com/jquery/jquery-dist/archive/1.12.4.zip" + }, + "jquery-ui": { + "url": "https://github.com/components/jqueryui/archive/1.12.1.zip" + } + } + } +} +``` + +## Tips + +In each downloaded folder, this plugin will create a small metadata file (`.composer-downloads.json`) to track the origin of the current code. If you modify the `composer.json` to use a different URL, then it will re-download the file. + +Download each extra file to a distinct `path`. Don't try to download into overlapping paths. (*This has not been tested, but it may lead to extraneous deletions/re-downloads.*) + +What should you do if you *normally* download the extra-file as `*.tgz` but sometimes (for local dev) need to grab bleeding edge content from somewhere else? Simply delete the autodownloaded folder and replace it with your own. `composer-downloads` will detect that conflict (by virtue of the absent `.composer-downloads.json`) and leave your code in place (until you choose to get rid of it). To switch back, you can simply delete the code and run `composer install` again. + +## Known Limitations + +If you use `downloads` in a root-project (or in symlinked dev repo), it will create+update downloads, but it will not remove orphaned items automatically. This could be addressed by doing a file-scan for `.composer-downloads.json` (and deleting any orphan folders). Since the edge-case is not particularly common right now, and since a file-scan could be time-consuming, it might make sense as a separate subcommand. + +I believe the limitation does *not* affect downstream consumers of a dependency. In that case, the regular `composer` install/update/removal mechanics should take care of any nested downloads. However, this is a little tricky to test right now. diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/circle.yml b/civicrm/vendor/civicrm/composer-downloads-plugin/circle.yml new file mode 100644 index 0000000000000000000000000000000000000000..54042d6793c0ebbbe2c5392ba2d32ea687dc5b08 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/circle.yml @@ -0,0 +1,24 @@ +version: 2 +jobs: + build: + working_directory: /srv + docker: + - image: lastcallmedia/php:7.0-dev + steps: + - checkout + - restore_cache: + key: composer-v1-{{ checksum "composer.json" }} + - run: composer install + - save_cache: + key: composer-v1-{{ checksum "composer.json" }} + paths: [vendor, composer.lock] + - run: | + COMMIT_RANGE=`echo $CIRCLE_COMPARE_URL | cut -d/ -f7` + IFS=$'\n'; COMMIT_SCA_FILES=($(git diff --name-only --diff-filter=ACMRTUXB "${COMMIT_RANGE}")); unset IFS + vendor/bin/php-cs-fixer fix --config=.php_cs.dist -v --dry-run --stop-on-violation --using-cache=no --path-mode=intersection -- "${COMMIT_SCA_FILES[@]}" + - run: | + composer validate + - run: mkdir -p /phpunit + - run: vendor/bin/phpunit --log-junit=/phpunit/junit.xml + - store_test_results: + path: /phpunit \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/composer.json b/civicrm/vendor/civicrm/composer-downloads-plugin/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..1e83d1e55dd560bdff04d6417d6e0a5c7b6b7dbd --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/composer.json @@ -0,0 +1,40 @@ +{ + "name": "civicrm/composer-downloads-plugin", + "description": "Composer plugin for downloading additional files within any composer package.", + "type": "composer-plugin", + "license": "MIT", + "authors": [ + { + "name": "Rob Bayliss", + "email": "rob@lastcallmedia.com" + }, + { + "name": "Tim Otten", + "email": "totten@civicrm.org" + } + ], + "require": { + "composer-plugin-api": "^1.1", + "php": ">=5.6", + "togos/gitignore": "~1.1.1" + }, + "require-dev": { + "composer/composer": "~1.0", + "phpunit/phpunit": "^5.7", + "friendsofphp/php-cs-fixer": "^2.3", + "totten/process-helper": "^1.0.1" + }, + "autoload": { + "psr-4": { + "LastCall\\DownloadsPlugin\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "LastCall\\DownloadsPlugin\\Tests\\": "tests/" + } + }, + "extra": { + "class": "LastCall\\DownloadsPlugin\\Plugin" + } +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/phpunit.xml b/civicrm/vendor/civicrm/composer-downloads-plugin/phpunit.xml new file mode 100644 index 0000000000000000000000000000000000000000..c9f9021fb2d258736da3db7ea605e88c8da984ff --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/phpunit.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<phpunit colors="true" bootstrap="vendor/autoload.php" defaultTestSuite="Plugin"> + <testsuites> + <testsuite name="Plugin"> + <directory>tests</directory> + </testsuite> + </testsuites> + + <filter> + <whitelist> + <directory>./src/*/</directory> + </whitelist> + </filter> + +</phpunit> \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/DownloadsParser.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/DownloadsParser.php new file mode 100644 index 0000000000000000000000000000000000000000..212a6d9e07c20e2abdd1893f106f39a22932cb62 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/DownloadsParser.php @@ -0,0 +1,76 @@ +<?php + +/* + * This file is part of Composer Extra Files Plugin. + * + * (c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace LastCall\DownloadsPlugin; + +use Composer\Package\PackageInterface; +use LastCall\DownloadsPlugin\Handler\ArchiveHandler; +use LastCall\DownloadsPlugin\Handler\BaseHandler; +use LastCall\DownloadsPlugin\Handler\FileHandler; +use LastCall\DownloadsPlugin\Handler\PharHandler; + +class DownloadsParser +{ + + /** + * @param \Composer\Package\PackageInterface $package + * + * @return BaseHandler[] + * Each item is a specification of an extra file, with defaults and variables evaluated. + */ + public function parse(PackageInterface $package, $basePath) + { + $extraFiles = []; + $extra = $package->getExtra(); + + $defaults = isset($extra['downloads']['*']) ? $extra['downloads']['*'] : []; + + if (!empty($extra['downloads'])) { + foreach ((array) $extra['downloads'] as $id => $extraFile) { + if ($id === '*') continue; + + $vars = ['{$id}' => $id]; + $extraFile = array_merge($defaults, $extraFile); + $extraFile['id'] = $id; + foreach (['url', 'path'] as $prop) { + if (isset($extraFile[$prop])) { + $extraFile[$prop] = strtr($extraFile[$prop], $vars); + } + } + + $class = $this->pickClass($extraFile); + $extraFiles[] = new $class($package, $basePath, $extraFile); + } + } + + return $extraFiles; + } + + public function pickClass($extraFile) + { + $types = [ + 'archive' => ArchiveHandler::CLASS, + 'file' => FileHandler::CLASS, + 'phar' => PharHandler::CLASS, + ]; + if (isset($extraFile['type'], $types[$extraFile['type']])) { + return $types[$extraFile['type']]; + } + + $parts = parse_url($extraFile['url']); + $filename = pathinfo($parts['path'], PATHINFO_BASENAME); + if (preg_match('/\.(zip|tar\.gz|tgz)$/', $filename)) { + return $types['archive']; + } + + return $types['file']; + } +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/GlobCleaner.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/GlobCleaner.php new file mode 100644 index 0000000000000000000000000000000000000000..0e7aaad6647f38789b60aee4c4ed5fcae6ce45d7 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/GlobCleaner.php @@ -0,0 +1,57 @@ +<?php +namespace LastCall\DownloadsPlugin; + +use Composer\IO\IOInterface; + +class GlobCleaner +{ + + /** + * @param IOInterface $io + * @param string $baseDir + * @param string[] $ignores + * @return \Generator|void + */ + public static function clean(IOInterface $io, $baseDir, $ignores) + { + if (empty($ignores)) { + return; + } + + $dirs = []; + + $finder = new \TOGoS_GitIgnore_FileFinder(array( + 'ruleset' => \TOGoS_GitIgnore_Ruleset::loadFromStrings($ignores), + 'invertRulesetResult' => false, + 'defaultResult' => false, + 'includeDirectories' => false, + 'callback' => function($file, $match) use ($baseDir, &$dirs) { + if ($match) { + unlink("$baseDir/$file"); + $dir = dirname($file); + if ($dir !== '.') { + $dirs[dirname($file)] = 1; + } + } + } + )); + $finder->findFiles($baseDir); + + // Cleanup any empy directories + $dirNames = array_keys($dirs); + $byLength = function ($a, $b) { + return strlen($b) - strlen($a); + }; + usort($dirNames, $byLength); + + while ($dirName = array_shift($dirNames)) { + if (!glob("$baseDir/$dirName/*")) { + @rmdir("$baseDir/$dirName"); + $dirNames[] = dirname($dirName); + usort($dirNames, $byLength); + } + } + } + + +} \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..19f95c26fe5e064e77cd39d90ad09d4d160231b1 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/ArchiveHandler.php @@ -0,0 +1,65 @@ +<?php + +namespace LastCall\DownloadsPlugin\Handler; + +use Composer\Composer; +use Composer\IO\IOInterface; +use LastCall\DownloadsPlugin\GlobCleaner; + +class ArchiveHandler extends BaseHandler +{ + + public function createSubpackage() + { + $pkg = parent::createSubpackage(); + $pkg->setDistType($this->parseDistType($this->extraFile['url'])); + return $pkg; + } + + protected function parseDistType($url) + { + $parts = parse_url($url); + $filename = pathinfo($parts['path'], PATHINFO_BASENAME); + if (preg_match('/\.zip$/', $filename)) { + return 'zip'; + } elseif (preg_match('/\.(tar\.gz|tgz)$/', $filename)) { + return 'tar'; + } else { + throw new \RuntimeException("Failed to determine archive type for $filename"); + } + } + + public function getTrackingFile() + { + $file = basename($this->extraFile['id']) . '-' . md5($this->extraFile['id']) . '.json'; + return + $this->getTargetPath() . + DIRECTORY_SEPARATOR . self::DOT_DIR . + DIRECTORY_SEPARATOR . $file; + } + + /** + * @return string[]|NULL + * List of files to exclude. Use '**' to match subdirectories. + * Ex: ['.gitignore', '*.md'] + */ + public function findIgnores() + { + return isset($this->extraFile['ignore']) + ? $this->extraFile['ignore'] + : NULL; + } + + /** + * @param Composer $composer + * @param IOInterface $io + */ + public function download(Composer $composer, IOInterface $io) + { + $targetPath = $this->getTargetPath(); + $downloadManager = $composer->getDownloadManager(); + $downloadManager->download($this->getSubpackage(), $targetPath); + GlobCleaner::clean($io, $targetPath, $this->findIgnores()); + } + +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..020fff8303e91bb7cd140bdb951ca91e67943189 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/BaseHandler.php @@ -0,0 +1,114 @@ +<?php +/** + * Created by PhpStorm. + * User: totten + * Date: 8/21/19 + * Time: 6:31 PM + */ + +namespace LastCall\DownloadsPlugin\Handler; + +use Composer\Composer; +use Composer\IO\IOInterface; +use Composer\Package\PackageInterface; +use Composer\Package\RootPackageInterface; +use Composer\Package\Version\VersionParser; +use LastCall\DownloadsPlugin\Subpackage; + + +abstract class BaseHandler +{ + const FAKE_VERSION = 'dev-master'; + const DOT_DIR = '.composer-downloads'; + + /** + * @var array + * File specification from composer.json, with defaults/substitutions applied. + */ + protected $extraFile; + + /** + * @var PackageInterface + */ + protected $parent; + + /** + * @var string + * Path to the parent package. + */ + protected $parentPath; + + /** + * @var Subpackage + */ + protected $subpackage; + + /** + * BaseHandler constructor. + * @param PackageInterface $parent + * @param string $parentPath + * @param array $extraFile + */ + public function __construct(PackageInterface $parent, $parentPath, $extraFile) + { + $this->parent = $parent; + $this->parentPath = $parentPath; + $this->extraFile = $extraFile; + } + + public function getSubpackage() { + if ($this->subpackage === NULL) { + $this->subpackage = $this->createSubpackage(); + } + return $this->subpackage; + } + + /** + * @return Subpackage + */ + public function createSubpackage() + { + $versionParser = new VersionParser(); + $extraFile = $this->extraFile; + $parent = $this->parent; + + $package = new Subpackage( + $parent, + $extraFile['id'], + $extraFile['url'], + NULL, + $extraFile['path'], + $parent instanceof RootPackageInterface ? $versionParser->normalize(self::FAKE_VERSION) : $parent->getVersion(), + $parent instanceof RootPackageInterface ? self::FAKE_VERSION : $parent->getPrettyVersion() + ); + + return $package; + } + + public function createTrackingData() { + return [ + 'name' => $this->getSubpackage()->getName(), + 'url' => $this->getSubpackage()->getDistUrl(), + ]; + } + + /** + * @return string + */ + public function getTargetPath() + { + return $this->parentPath . '/' . $this->extraFile['path']; + } + + /** + * @param Composer $composer + * @param IOInterface $io + */ + abstract public function download(Composer $composer, IOInterface $io); + + /** + * @return string + */ + abstract public function getTrackingFile(); + +} \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/FileHandler.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/FileHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..fbf887837322224da7d08cc40d6a484d51ab7735 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/FileHandler.php @@ -0,0 +1,63 @@ +<?php + +namespace LastCall\DownloadsPlugin\Handler; + +use Composer\Composer; +use Composer\IO\IOInterface; +use Composer\Util\Filesystem; + +class FileHandler extends BaseHandler +{ + const TMP_PREFIX = '.composer-extra-tmp-'; + + public function createSubpackage() + { + $pkg = parent::createSubpackage(); + $pkg->setDistType('file'); + return $pkg; + } + + public function getTrackingFile() + { + $file = basename($this->extraFile['id']) . '-' . md5($this->extraFile['id']) . '.json'; + return + dirname($this->getTargetPath()) . + DIRECTORY_SEPARATOR . self::DOT_DIR . + DIRECTORY_SEPARATOR . $file; + } + + /** + * @param Composer $composer + * @param IOInterface $io + */ + public function download(Composer $composer, IOInterface $io) { + // We want to take advantage of the cache in composer's downloader, but it + // doesn't put the file the spot we want, so we shuffle a bit. + + $cfs = new Filesystem(); + $target = $this->getTargetPath(); + $tmpDir = dirname($target) . DIRECTORY_SEPARATOR . self::TMP_PREFIX . basename($target); + + if (file_exists($tmpDir)) { + $cfs->remove($tmpDir); + } + + $pkg = clone $this->getSubpackage(); + $pkg->setTargetDir($tmpDir); + $downloadManager = $composer->getDownloadManager(); + $downloadManager->download($pkg, $tmpDir); + + if (file_exists($target)) { + $cfs->remove($target); + } + + foreach ((array)glob("$tmpDir/*") as $file) { + if (is_file($file)) { + $cfs->rename($file, $target); + $cfs->remove($tmpDir); + break; + } + } + } + +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/PharHandler.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/PharHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..1e531de7d4be6926d04f7199aad453eb8b32f7b8 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Handler/PharHandler.php @@ -0,0 +1,28 @@ +<?php + +namespace LastCall\DownloadsPlugin\Handler; + +use Composer\Composer; +use Composer\IO\IOInterface; +use Composer\Util\Platform; + + +class PharHandler extends FileHandler +{ + + /** + * @param Composer $composer + * @param IOInterface $io + */ + public function download(Composer $composer, IOInterface $io) { + parent::download($composer, $io); + + if (Platform::isWindows()) { + // TODO make .bat or .cmd + } else { + chmod($this->getTargetPath(), 0777 ^ umask()); + } + } + + +} \ No newline at end of file diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Plugin.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Plugin.php new file mode 100644 index 0000000000000000000000000000000000000000..90f10503a408a8fbeb55631a3fc8c670a2b11556 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Plugin.php @@ -0,0 +1,131 @@ +<?php + +/* + * This file is part of Composer Extra Files Plugin. + * + * (c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace LastCall\DownloadsPlugin; + +use Composer\Composer; +use Composer\EventDispatcher\EventSubscriberInterface; +use Composer\Installer\PackageEvent; +use Composer\Installer\PackageEvents; +use Composer\IO\IOInterface; +use Composer\Package\Package; +use Composer\Package\PackageInterface; +use Composer\Plugin\PluginInterface; +use Composer\Script\Event; +use Composer\Script\ScriptEvents; +use LastCall\DownloadsPlugin\Handler\BaseHandler; + +class Plugin implements PluginInterface, EventSubscriberInterface +{ + + /** @var Composer */ + private $composer; + /** @var IOInterface */ + private $io; + + private $parser; + + public function __construct() + { + $this->parser = new DownloadsParser(); + } + + public static function getSubscribedEvents() + { + return [ + PackageEvents::POST_PACKAGE_INSTALL => ['installDownloads', 10], + PackageEvents::POST_PACKAGE_UPDATE => ['updateDownloads', 10], + ScriptEvents::POST_INSTALL_CMD => ['installDownloadsRoot', 10], + ScriptEvents::POST_UPDATE_CMD => ['installDownloadsRoot', 10], + ]; + } + + public function installDownloadsRoot(Event $event) { + $rootPackage = $this->composer->getPackage(); + $this->installUpdateDownloads(getcwd(), $rootPackage); + + // Ensure that any other packages are properly reconciled. + $localRepo = $this->composer->getRepositoryManager()->getLocalRepository(); + $installationManager = $this->composer->getInstallationManager(); + foreach ($localRepo->getCanonicalPackages() as $package) { + /** @var \Composer\Package\PackageInterface $package */ + if (!empty($package->getExtra()['downloads'])) { + $this->installUpdateDownloads($installationManager->getInstallPath($package), $package); + } + } + } + public function installDownloads(PackageEvent $event) + { + /** @var \Composer\Package\PackageInterface $package */ + $package = $event->getOperation()->getPackage(); + $installationManager = $event->getComposer()->getInstallationManager(); + $this->installUpdateDownloads($installationManager->getInstallPath($package), $package); + } + + public function updateDownloads(PackageEvent $event) + { + /** @var \Composer\Package\PackageInterface $package */ + $package = $event->getOperation()->getTargetPackage(); + $installationManager = $event->getComposer()->getInstallationManager(); + $this->installUpdateDownloads($installationManager->getInstallPath($package), $package); + } + + public function activate(Composer $composer, IOInterface $io) + { + $this->composer = $composer; + $this->io = $io; + } + + /** + * @param string $basePath + * @param PackageInterface $package + */ + protected function installUpdateDownloads($basePath, $package) + { + $first = TRUE; + foreach ($this->parser->parse($package, $basePath) as $extraFileHandler) { + /** @var BaseHandler $extraFileHandler */ + $extraFilePkg = $extraFileHandler->getSubpackage(); + $targetPath = $extraFileHandler->getTargetPath(); + $trackingFile = $extraFileHandler->getTrackingFile(); + + if (file_exists($targetPath) && !file_exists($trackingFile)) { + $this->io->write(sprintf("<info>Extra file <comment>%s</comment> has been locally overriden in <comment>%s</comment>. To reset it, delete and reinstall.</info>", $extraFilePkg->getName(), $extraFilePkg->getTargetDir()), TRUE); + continue; + } + + if (file_exists($targetPath) && file_exists($trackingFile)) { + $meta = @json_decode(file_get_contents($trackingFile), 1); + if ($meta['url'] === $extraFilePkg->getDistUrl()) { + $this->io->write(sprintf("<info>Skip extra file <comment>%s</comment></info>", $extraFilePkg->getName()), TRUE, IOInterface::VERY_VERBOSE); + continue; + } + } + + if ($first) { + $this->io->write(sprintf("<info>Download extra files for <comment>%s</comment></info>", $package->getName())); + $first = FALSE; + } + + $this->io->write(sprintf("<info>Download extra file <comment>%s</comment></info>", $extraFilePkg->getName()), TRUE, IOInterface::VERBOSE); + $extraFileHandler->download($this->composer, $this->io, $basePath); + + if (!file_exists(dirname($trackingFile))) { + mkdir(dirname($trackingFile), 0777, TRUE); + } + file_put_contents($trackingFile, json_encode( + $extraFileHandler->createTrackingData(), + JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES + )); + } + } + +} diff --git a/civicrm/vendor/civicrm/composer-downloads-plugin/src/Subpackage.php b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Subpackage.php new file mode 100644 index 0000000000000000000000000000000000000000..62d4b754fccc72bde54622de4acc4b3617991138 --- /dev/null +++ b/civicrm/vendor/civicrm/composer-downloads-plugin/src/Subpackage.php @@ -0,0 +1,48 @@ +<?php + +/* + * This file is part of Composer Extra Files Plugin. + * + * (c) 2017 Last Call Media, Rob Bayliss <rob@lastcallmedia.com> + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + +namespace LastCall\DownloadsPlugin; + +use Composer\IO\IOInterface; +use Composer\Package\Package; +use Composer\Package\PackageInterface; +use Composer\Package\RootPackageInterface; + +/** + * Class Subpackage + * @package LastCall\DownloadsPlugin + * + * A subpackage is simulated package which lives beneath some parent package. + */ +class Subpackage extends Package +{ + + /** + * @var PackageInterface + */ + private $parent; + + public function __construct(PackageInterface $parent, $id, $url, $type, $path, $version = NULL, $prettyVersion = NULL) + { + parent::__construct( + sprintf('%s:%s', $parent->getName(), $id), + $version ? $version : $parent->getVersion(), + $prettyVersion ? $prettyVersion : $parent->getPrettyVersion() + ); + $this->parent = $parent; + $this->id = $id; + $this->setDistUrl($url); + $this->setDistType($type); + $this->setTargetDir($path); + $this->setInstallationSource('dist'); + } + +} diff --git a/civicrm/vendor/composer/autoload_namespaces.php b/civicrm/vendor/composer/autoload_namespaces.php index 573acec296b5adb2e4be9580e68d0403958079ac..a423bbfc89a337098a09796a52d2d904c546789f 100644 --- a/civicrm/vendor/composer/autoload_namespaces.php +++ b/civicrm/vendor/composer/autoload_namespaces.php @@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir); return array( 'Validate' => array($vendorDir . '/pear/validate_finance_creditcard'), + 'TOGoS_GitIgnore_' => array($vendorDir . '/togos/gitignore/src/main/php'), 'System' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), 'Svg\\' => array($vendorDir . '/phenx/php-svg-lib/src'), 'Sabberworm\\CSS' => array($vendorDir . '/sabberworm/php-css-parser/lib'), diff --git a/civicrm/vendor/composer/autoload_psr4.php b/civicrm/vendor/composer/autoload_psr4.php index 5da2a783b667a5533f18560827a0dcc68c913aff..9c4781cc873399b86ffe96b6a6a807ba2097872e 100644 --- a/civicrm/vendor/composer/autoload_psr4.php +++ b/civicrm/vendor/composer/autoload_psr4.php @@ -28,6 +28,7 @@ return array( 'MJS\\TopSort\\Tests\\' => array($vendorDir . '/marcj/topsort/tests/Tests'), 'MJS\\TopSort\\' => array($vendorDir . '/marcj/topsort/src'), 'League\\Csv\\' => array($vendorDir . '/league/csv/src'), + 'LastCall\\DownloadsPlugin\\' => array($vendorDir . '/civicrm/composer-downloads-plugin/src'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), diff --git a/civicrm/vendor/composer/autoload_real.php b/civicrm/vendor/composer/autoload_real.php index b848022d0121cb8cf685b4ef00a78b2cebd40794..f402b107c8339a31dfe1b1ad214e72583c0db2ab 100644 --- a/civicrm/vendor/composer/autoload_real.php +++ b/civicrm/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6 +class ComposerAutoloaderInitbb3b672ecd66f991faa2e0268d5d8880 { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6 return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInitbb3b672ecd66f991faa2e0268d5d8880', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInitbb3b672ecd66f991faa2e0268d5d8880', 'loadClassLoader')); $includePaths = require __DIR__ . '/include_paths.php'; $includePaths[] = get_include_path(); @@ -31,7 +31,7 @@ class ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6 if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -52,19 +52,19 @@ class ComposerAutoloaderInit6179788ed8c0396133d329bcbd0c0ed6 $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$files; + $includeFiles = Composer\Autoload\ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire6179788ed8c0396133d329bcbd0c0ed6($fileIdentifier, $file); + composerRequirebb3b672ecd66f991faa2e0268d5d8880($fileIdentifier, $file); } return $loader; } } -function composerRequire6179788ed8c0396133d329bcbd0c0ed6($fileIdentifier, $file) +function composerRequirebb3b672ecd66f991faa2e0268d5d8880($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/civicrm/vendor/composer/autoload_static.php b/civicrm/vendor/composer/autoload_static.php index da7509f769d2cceac28ca3f860ff56d33fd002e1..31ecadcc80e4310ce67bea931b2998541d0d572d 100644 --- a/civicrm/vendor/composer/autoload_static.php +++ b/civicrm/vendor/composer/autoload_static.php @@ -4,7 +4,7 @@ namespace Composer\Autoload; -class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 +class ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880 { public static $files = array ( '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', @@ -58,6 +58,7 @@ class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 'L' => array ( 'League\\Csv\\' => 11, + 'LastCall\\DownloadsPlugin\\' => 25, ), 'G' => array ( @@ -170,6 +171,10 @@ class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 array ( 0 => __DIR__ . '/..' . '/league/csv/src', ), + 'LastCall\\DownloadsPlugin\\' => + array ( + 0 => __DIR__ . '/..' . '/civicrm/composer-downloads-plugin/src', + ), 'GuzzleHttp\\Psr7\\' => array ( 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', @@ -212,6 +217,13 @@ class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 0 => __DIR__ . '/..' . '/pear/validate_finance_creditcard', ), ), + 'T' => + array ( + 'TOGoS_GitIgnore_' => + array ( + 0 => __DIR__ . '/..' . '/togos/gitignore/src/main/php', + ), + ), 'S' => array ( 'System' => @@ -456,11 +468,11 @@ class ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$prefixesPsr0; - $loader->fallbackDirsPsr0 = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$fallbackDirsPsr0; - $loader->classMap = ComposerStaticInit6179788ed8c0396133d329bcbd0c0ed6::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$prefixesPsr0; + $loader->fallbackDirsPsr0 = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$fallbackDirsPsr0; + $loader->classMap = ComposerStaticInitbb3b672ecd66f991faa2e0268d5d8880::$classMap; }, null, ClassLoader::class); } diff --git a/civicrm/vendor/composer/installed.json b/civicrm/vendor/composer/installed.json index 2114774cd482884e846409ee82e455c9513c5363..b65a780813dab92dc6a50fae10b5fdb1918185e1 100644 --- a/civicrm/vendor/composer/installed.json +++ b/civicrm/vendor/composer/installed.json @@ -198,6 +198,59 @@ ], "description": "CiviCRM installation library" }, + { + "name": "civicrm/composer-downloads-plugin", + "version": "v2.0.0", + "version_normalized": "2.0.0.0", + "source": { + "type": "git", + "url": "https://github.com/civicrm/composer-downloads-plugin.git", + "reference": "869b7a12f57b2d912f0ea77d5c33c1518b8de27d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/civicrm/composer-downloads-plugin/zipball/869b7a12f57b2d912f0ea77d5c33c1518b8de27d", + "reference": "869b7a12f57b2d912f0ea77d5c33c1518b8de27d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1", + "php": ">=5.6", + "togos/gitignore": "~1.1.1" + }, + "require-dev": { + "composer/composer": "~1.0", + "friendsofphp/php-cs-fixer": "^2.3", + "phpunit/phpunit": "^5.7", + "totten/process-helper": "^1.0.1" + }, + "time": "2019-08-22T10:56:51+00:00", + "type": "composer-plugin", + "extra": { + "class": "LastCall\\DownloadsPlugin\\Plugin" + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "LastCall\\DownloadsPlugin\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Rob Bayliss", + "email": "rob@lastcallmedia.com" + }, + { + "name": "Tim Otten", + "email": "totten@civicrm.org" + } + ], + "description": "Composer plugin for downloading additional files within any composer package." + }, { "name": "cweagans/composer-patches", "version": "1.6.5", @@ -2347,6 +2400,41 @@ "qrcode" ] }, + { + "name": "togos/gitignore", + "version": "1.1.1", + "version_normalized": "1.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/TOGoS/PHPGitIgnore.git", + "reference": "32bc0830e4123f670adcbf5ddda5bef362f4f4d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/TOGoS/PHPGitIgnore/zipball/32bc0830e4123f670adcbf5ddda5bef362f4f4d4", + "reference": "32bc0830e4123f670adcbf5ddda5bef362f4f4d4", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "require-dev": { + "togos/simpler-test": "1.1.1" + }, + "time": "2019-04-19T19:16:58+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "TOGoS_GitIgnore_": "src/main/php/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Parser for .gitignore (and sparse-checkout, and anything else using the same format) files" + }, { "name": "totten/ca-config", "version": "v17.05.0", diff --git a/civicrm/vendor/togos/gitignore/.gitignore b/civicrm/vendor/togos/gitignore/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ff72e2d08c7e284b7a0c34eef012f55628fea54d --- /dev/null +++ b/civicrm/vendor/togos/gitignore/.gitignore @@ -0,0 +1,2 @@ +/composer.lock +/vendor diff --git a/civicrm/vendor/togos/gitignore/Makefile b/civicrm/vendor/togos/gitignore/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..3f547218efb20b5d15cf9da4510f066842e74142 --- /dev/null +++ b/civicrm/vendor/togos/gitignore/Makefile @@ -0,0 +1,13 @@ +default: run-unit-tests + +.PHONY: run-unit-tests + +composer.lock: | composer.json + composer install + +vendor: composer.lock + composer install + touch "$@" + +run-unit-tests: vendor + vendor/bin/phpsimplertest --bootstrap vendor/autoload.php src/test/ --colorful-output diff --git a/civicrm/vendor/togos/gitignore/composer.json b/civicrm/vendor/togos/gitignore/composer.json new file mode 100644 index 0000000000000000000000000000000000000000..b5df8a8cc0e777fb5888397123fea0c98c879463 --- /dev/null +++ b/civicrm/vendor/togos/gitignore/composer.json @@ -0,0 +1,27 @@ +{ + "name": "togos/gitignore", + "description": "Parser for .gitignore (and sparse-checkout, and anything else using the same format) files", + "license": "MIT", + + "require": { + "php": ">=5.2" + }, + "autoload": { + "psr-0": { + "TOGoS_GitIgnore_": "src/main/php/" + } + }, + + + "require-dev": { + "togos/simpler-test": "1.1.1" + }, + "autoload-dev": { + "psr-0": { + "TOGoS_GitIgnore_": "src/test/php/" + } + }, + "scripts": { + "test": "vendor/bin/phpsimplertest --colorful-output --bootstrap vendor/autoload.php src/test/" + } +} diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php new file mode 100644 index 0000000000000000000000000000000000000000..a476937684d64deae122e12e47ebe12449bd2eff --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/FileFinder.php @@ -0,0 +1,42 @@ +<?php + +class TOGoS_GitIgnore_FileFinder +{ + public function __construct(array $options) { + // TODO: Validate options + $this->ruleset = $options['ruleset']; + $this->invertRulesetResult = $options['invertRulesetResult']; + $this->defaultResult = $options['defaultResult']; + $this->includeDirectories = $options['includeDirectories']; + $this->callback = $options['callback']; + } + + protected function match($rootDir, $f) { + $result = $this->ruleset->match($f); + if( $this->invertRulesetResult and $result !== null ) $result = !$result; + return $result === null ? $this->defaultResult : $result; + } + + protected function _findFiles($rootDir, $f) { + if( preg_match('#/$#', $rootDir) ) throw new Exception("Root directory argument to _findFiles should not end with a slash; given «{$rootDir}»"); + if( preg_match('#^/|/$#', $f) ) throw new Exception("Relative path argument to _findFiles should not start or end with a slash; given «{$f}»"); + //echo "_findFiles($rootDir, $f)\n"; + $fullPath = $f == '' ? $rootDir : $rootDir.'/'.$f; + if( $this->includeDirectories or !is_dir($fullPath) ) { + $result = $this->match($rootDir, $f); + call_user_func($this->callback, $f, $result); + } + if( is_dir($fullPath) ) { + $dh = opendir($fullPath); + while( ($fn = readdir($dh)) !== false ) { + if( $fn == '.' or $fn == '..' ) continue; + $this->_findFiles($rootDir, $f == '' ? $fn : $f.'/'.$fn); + } + closedir($dh); + } + } + + public function findFiles($dir) { + self::_findFiles($dir, ''); + } +} \ No newline at end of file diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.php new file mode 100644 index 0000000000000000000000000000000000000000..10b9ab0c0d68441ae3ddb674315a8878f173150b --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Pattern.php @@ -0,0 +1,56 @@ +<?php + +class TOGoS_GitIgnore_Pattern +{ + protected $patternString; + protected $regex; + protected function __construct($pattern, $regex) { + $this->patternString = $pattern; + $this->regex = $regex; + } + + public function getPatternString() { + return $this->patternString; + } + + protected static function patternToRegex($pp) { + preg_match_all('/\*|\*\*|\?|[^\*\?]|\[![^\]+]|\[[^\]+]/', $pp, $bifs); + $regex = ''; + foreach( $bifs[0] as $part ) { + if( $part == '**' ) $regex .= ".*"; + else if( $part == '*' ) $regex .= "[^/]*"; + else if( $part == '?' ) $regex .= '?'; + else if( $part[0] == '[' ) { + // Not exactly, but maybe close enough. + // Maybe fnmatch is the thing to use + if( $part[1] == '!' ) $part[1] = '^'; + $regex .= $part; + } + else $regex .= preg_quote($part, '#'); + } + return $regex; + } + + public static function parse($pattern) { + $r = self::patternToRegex($pattern); + if( strlen($pattern) == 0 ) { + throw new Exception("Zero-length pattern string passed to ".__METHOD__); + } + if( $pattern[0] == '/' ) { + $r = '#^'.substr($r,1).'(?:$|/)#'; + } else { + $r = '#(?:^|/)'.$r.'(?:$|/)#'; + } + return new self($pattern, $r); + } + + public function match($path) { + if( strlen($path) > 0 and $path[0] == '/' ) { + throw new Exception("Paths passed to #match should not start with a slash; given: «".$path."»"); + } + if( !is_string($path) ) { + throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path)); + } + return preg_match($this->regex, $path); + } +} diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php new file mode 100644 index 0000000000000000000000000000000000000000..3b09bcd54561fa4f16a47530c8a634273b6bdace --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Rule.php @@ -0,0 +1,33 @@ +<?php + +class TOGoS_GitIgnore_Rule +{ + protected $isExclusion; + protected $pattern; + + public function __construct(TOGoS_GitIgnore_Pattern $pattern, $isExclusion) { + $this->pattern = $pattern; + $this->isExclusion = $isExclusion; + } + + /** @return true: include this file, false: exclude this file, null: rule does not apply to this file */ + public function match($path) { + if( !is_string($path) ) { + throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path)); + } + if( $this->pattern->match($path) ) { + return $this->isExclusion ? false : true; + } + return null; + } + + public static function parse($str) { + $isExclusion = false; + if( $str[0] == '!' ) { + $isExclusion = true; + $str = substr($str, 1); + } + $pattern = TOGoS_GitIgnore_Pattern::parse($str); + return new self($pattern, $isExclusion); + } +} diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php new file mode 100644 index 0000000000000000000000000000000000000000..19b99cae526f7c35e9368aacc390dcdb965f6b23 --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Ruleset.php @@ -0,0 +1,51 @@ +<?php + +class TOGoS_GitIgnore_Ruleset +{ + protected $rules; + + public function addRule($rule) { + if( is_string($rule) ) { + $str = trim($rule); + if( $str == '' ) return; + if( $str[0] == '#' ) return; + if( substr($str,0,2) == '\\#' ) $str = substr($str,1); + $rule = TOGoS_GitIgnore_Rule::parse($str); + } + if( !($rule instanceof TOGoS_GitIgnore_Rule) ) { + throw new Exception("Argument to TOGoS_GitIgnore_Ruleset#addRule should be a string or TOGoS_GitIgnore_Rule; received ".TOGoS_GitIgnore_Util::describe($rule)); + } + $this->rules[] = $rule; + } + + public function match($path) { + if( !is_string($path) ) { + throw new Exception(__METHOD__." expects a string; given ".TOGoS_GitIgnore_Util::describe($path)); + } + $lastResult = null; + foreach( $this->rules as $rule ) { + $result = $rule->match($path); + if( $result !== null ) $lastResult = $result; + } + return $lastResult; + } + + public static function loadFromStrings($lines) { + $rs = new self; + foreach( $lines as $line ) $rs->addRule($line); + return $rs; + } + + public static function loadFromString($str) { + $lines = explode("\n", $str); + return self::loadFromStrings($lines); + } + + public static function loadFromFile($filename) { + $rs = new self; + $fh = fopen($filename); + while( ($line = fgets($fh)) ) $rs->addRule($line); + fclose($fh); + return $rs; + } +} diff --git a/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php new file mode 100644 index 0000000000000000000000000000000000000000..f4282ac70727f6d2b1c7654750b9c2618f323562 --- /dev/null +++ b/civicrm/vendor/togos/gitignore/src/main/php/TOGoS/GitIgnore/Util.php @@ -0,0 +1,17 @@ +<?php + +class TOGoS_GitIgnore_Util +{ + public static function aize($word) { + if( preg_match('/^[aeiou]/', $word) ) return "an $word"; + return "a $word"; + } + + public static function describe($val) { + if( $val === null ) return "null"; + if( is_float($val) or is_int($val) ) return "the number $val"; + if( is_bool($val) ) return $val ? "true" : "false"; + if( is_object($val) ) return self::aize(get_class($val)); + return aize(gettype($val)); + } +} diff --git a/civicrm/xml/schema/ACL/Cache.xml b/civicrm/xml/schema/ACL/Cache.xml index d73ea8a08a583363516aae81d92e4d05af3c7595..38c9df70bb819a94e7efe151c0ee1da9912ed3f8 100644 --- a/civicrm/xml/schema/ACL/Cache.xml +++ b/civicrm/xml/schema/ACL/Cache.xml @@ -2,7 +2,7 @@ <table> <base>CRM/ACL</base> - <class>Cache</class> + <class>ACLCache</class> <name>civicrm_acl_cache</name> <comment>Cache for acls and contacts</comment> <add>1.6</add> diff --git a/civicrm/xml/schema/Contact/Contact.xml b/civicrm/xml/schema/Contact/Contact.xml index 1539d0c6e8b3289e7d950b61c57a87bf3d9f312d..14965f9ffcb4f6960bac163b6b6b2f2d8d5a0315 100644 --- a/civicrm/xml/schema/Contact/Contact.xml +++ b/civicrm/xml/schema/Contact/Contact.xml @@ -496,6 +496,8 @@ <optionGroupName>communication_style</optionGroupName> </pseudoconstant> <export>true</export> + <import>true</import> + <headerPattern>/style/i</headerPattern> <comment>Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value.</comment> <add>4.4</add> <html> @@ -874,6 +876,11 @@ <default>NULL</default> <add>4.3</add> </field> + <index> + <name>index_created_date</name> + <fieldName>created_date</fieldName> + <add>5.18</add> + </index> <field> <name>modified_date</name> <type>timestamp</type> @@ -883,4 +890,9 @@ <default>CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP</default> <add>4.3</add> </field> + <index> + <name>index_modified_date</name> + <fieldName>modified_date</fieldName> + <add>5.18</add> + </index> </table> diff --git a/civicrm/xml/schema/Core/ActionLog.xml b/civicrm/xml/schema/Core/ActionLog.xml index a707d70d6ef18954cc55dc61bd748cedc5704780..7c3e7a439b6253437f38c5cc7cd3230b59048b67 100644 --- a/civicrm/xml/schema/Core/ActionLog.xml +++ b/civicrm/xml/schema/Core/ActionLog.xml @@ -103,6 +103,6 @@ <default>NULL</default> <comment>Stores the date from the entity which triggered this reminder action (e.g. membership.end_date for most membership renewal reminders)</comment> <add>4.6</add> - <change>5.14</change> + <change>5.17</change> </field> </table> diff --git a/civicrm/xml/schema/Core/Address.xml b/civicrm/xml/schema/Core/Address.xml index 5b792fd4a69766e973a3d2ac7978ee4fed57ee59..3e9ff7f5507bd867eda334ec0f34d7501f7fc954 100644 --- a/civicrm/xml/schema/Core/Address.xml +++ b/civicrm/xml/schema/Core/Address.xml @@ -394,7 +394,7 @@ </field> <field> <name>manual_geo_code</name> - <title>Is manually geocoded</title> + <title>Is Manually Geocoded</title> <type>boolean</type> <default>0</default> <comment>Is this a manually entered geo code</comment> @@ -402,6 +402,7 @@ <html> <type>CheckBox</type> </html> + <export>true</export> </field> <field> <name>timezone</name> diff --git a/civicrm/xml/schema/Core/Cache.xml b/civicrm/xml/schema/Core/Cache.xml index 29445f1aa986b8f6acec3992cb96539f75838e02..564a2773292b117051960462feca88bf7ecf1e89 100644 --- a/civicrm/xml/schema/Core/Cache.xml +++ b/civicrm/xml/schema/Core/Cache.xml @@ -8,8 +8,10 @@ <add>2.1</add> <field> <name>id</name> + <title>Cache ID</title> <type>int unsigned</type> <required>true</required> + <comment>Unique table ID</comment> <add>2.1</add> </field> <primaryKey> @@ -18,6 +20,7 @@ </primaryKey> <field> <name>group_name</name> + <title>Group Name</title> <type>varchar</type> <length>32</length> <required>true</required> @@ -26,6 +29,7 @@ </field> <field> <name>path</name> + <title>Path</title> <type>varchar</type> <length>255</length> <comment>Unique path name for cache element</comment> @@ -49,12 +53,14 @@ </index> <field> <name>data</name> + <title>Data</title> <type>longtext</type> <comment>data associated with this path</comment> <add>2.1</add> </field> <field> <name>component_id</name> + <title>Component ID</title> <type>int unsigned</type> <comment>Component that this menu item belongs to</comment> <add>2.1</add> @@ -75,6 +81,7 @@ </foreignKey> <field> <name>created_date</name> + <title>Created Date</title> <type>timestamp</type> <default>CURRENT_TIMESTAMP</default> <comment>When was the cache item created</comment> @@ -82,6 +89,7 @@ </field> <field> <name>expired_date</name> + <title>Expired Date</title> <type>timestamp</type> <default>NULL</default> <required>false</required> diff --git a/civicrm/xml/schema/Core/Dashboard.xml b/civicrm/xml/schema/Core/Dashboard.xml index 41ed111374447b1832f6041175f96f27f025dc00..96da590e28381ff6c25bf6b7f7f4972270dcc950 100644 --- a/civicrm/xml/schema/Core/Dashboard.xml +++ b/civicrm/xml/schema/Core/Dashboard.xml @@ -35,6 +35,7 @@ <table>civicrm_domain</table> <key>id</key> <add>3.1</add> + <onDelete>CASCADE</onDelete> </foreignKey> <field> <name>name</name> diff --git a/civicrm/xml/schema/Member/Membership.xml b/civicrm/xml/schema/Member/Membership.xml index 3be81314907cca0e95133af84d6de3e67ebe6b33..9522592d80db54634e6e87b6bf9167a979abd7dd 100644 --- a/civicrm/xml/schema/Member/Membership.xml +++ b/civicrm/xml/schema/Member/Membership.xml @@ -84,6 +84,7 @@ <type>Select Date</type> <formatType>activityDate</formatType> </html> + <uniqueName>membership_join_date</uniqueName> </field> <field> <name>start_date</name> @@ -156,8 +157,10 @@ </foreignKey> <field> <name>is_override</name> + <uniqueName>member_is_override</uniqueName> <title>Status Override</title> <import>true</import> + <export>true</export> <headerPattern>/override$/i</headerPattern> <type>boolean</type> <comment>Admin users may set a manual status which overrides the calculated status. When this flag is true, automated status update scripts should NOT modify status for the record.</comment> @@ -203,6 +206,7 @@ <type>int</type> <comment>Maximum number of related memberships (membership_type override).</comment> <add>4.3</add> + <export>true</export> <html> <type>Text</type> </html> @@ -234,8 +238,10 @@ </field> <field> <name>contribution_recur_id</name> + <uniqueName>membership_recur_id</uniqueName> <title>Membership Recurring Contribution</title> <type>int unsigned</type> + <export>true</export> <comment>Conditional foreign key to civicrm_contribution_recur id. Each membership in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events.</comment> <add>3.3</add> </field> diff --git a/civicrm/xml/schema/Pledge/Pledge.xml b/civicrm/xml/schema/Pledge/Pledge.xml index 50ecd9c2261b391c4ae8f46a650cb85368b180d2..7fd1cf35cc2c5c8e74100cafb2d7f1d0c11de829 100644 --- a/civicrm/xml/schema/Pledge/Pledge.xml +++ b/civicrm/xml/schema/Pledge/Pledge.xml @@ -196,11 +196,14 @@ <type>datetime</type> <title>Pledge Start Date</title> <required>true</required> + <export>true</export> <comment>The date the first scheduled pledge occurs.</comment> <add>2.1</add> <html> - <type>Select Date</type> - </html> + <type>Select Date</type> + </html> + <uniqueName>pledge_start_date</uniqueName> + <uniqueTitle>Payments Start Date</uniqueTitle> </field> <field> <name>create_date</name> @@ -209,6 +212,7 @@ <title>Pledge Made</title> <required>true</required> <import>true</import> + <export>true</export> <comment>When this pledge record was created.</comment> <add>2.1</add> <html> @@ -222,7 +226,7 @@ <comment>When a pledge acknowledgement message was sent to the contributor.</comment> <add>2.1</add> <html> - <type>Select Date</type> + <type>Select Date</type> </html> </field> <field> @@ -239,18 +243,21 @@ <comment>Date this pledge was cancelled by contributor.</comment> <add>2.1</add> <html> - <type>Select Date</type> + <type>Select Date</type> </html> </field> <field> <name>end_date</name> <type>datetime</type> <title>Pledge End Date</title> + <export>true</export> <comment>Date this pledge finished successfully (total pledge payments equal to or greater than pledged amount).</comment> <add>2.1</add> <html> - <type>Select Date</type> + <type>Select Date</type> </html> + <uniqueName>pledge_end_date</uniqueName> + <uniqueTitle>Payments Ended Date</uniqueTitle> </field> <field> <name>max_reminders</name> @@ -259,8 +266,8 @@ <default>1</default> <comment>The maximum number of payment reminders to send for any given payment.</comment> <html> - <type>Text</type> - </html> + <type>Text</type> + </html> <add>2.1</add> </field> <field> @@ -271,8 +278,8 @@ <comment>Send initial reminder this many days prior to the payment due date.</comment> <add>2.1</add> <html> - <type>Select</type> - </html> + <type>Select</type> + </html> </field> <field> <name>additional_reminder_day</name> @@ -282,8 +289,8 @@ <comment>Send additional reminder this many days after last one sent, up to maximum number of reminders.</comment> <add>2.1</add> <html> - <type>Text</type> - </html> + <type>Text</type> + </html> </field> <field> <name>status_id</name> diff --git a/civicrm/xml/schema/Pledge/PledgePayment.xml b/civicrm/xml/schema/Pledge/PledgePayment.xml index e13eb9e16b7d5466ce3a1c61ad1c2124494d2d31..bc711aef4394fd04152892edc891341556206c58 100644 --- a/civicrm/xml/schema/Pledge/PledgePayment.xml +++ b/civicrm/xml/schema/Pledge/PledgePayment.xml @@ -60,6 +60,7 @@ <uniqueName>pledge_payment_scheduled_amount</uniqueName> <title>Scheduled Amount</title> <import>true</import> + <export>true</export> <type>decimal</type> <required>true</required> <comment>Pledged amount for this payment (the actual contribution amount might be different).</comment> @@ -98,6 +99,7 @@ <uniqueName>pledge_payment_scheduled_date</uniqueName> <title>Scheduled Date</title> <import>true</import> + <export>true</export> <type>datetime</type> <required>true</required> <comment>The date the pledge payment is supposed to happen.</comment> @@ -106,6 +108,7 @@ <type>Select Date</type> <formatType>activityDate</formatType> </html> + <uniqueTitle>Payment Scheduled</uniqueTitle> </field> <field> <name>reminder_date</name> diff --git a/civicrm/xml/templates/civicrm_data.tpl b/civicrm/xml/templates/civicrm_data.tpl index f921cc8c44599092a86aa33a0fe2d58a7c53d204..42eff2a277c96b61f9e01dc2df12dcf1c9711310 100644 --- a/civicrm/xml/templates/civicrm_data.tpl +++ b/civicrm/xml/templates/civicrm_data.tpl @@ -1603,7 +1603,7 @@ INSERT INTO civicrm_uf_field ( 10, 'soft_credit', 0, 0, 10, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Soft Credit{/ts}', 'Contribution', NULL, NULL ), ( 10, 'soft_credit_type', 0, 0, 11, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Soft Credit Type{/ts}', 'Contribution', NULL, NULL ), ( 11, 'membership_type', 1, 1, 1, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Membership Type{/ts}', 'Membership', NULL, NULL ), - ( 11, 'join_date', 1, 1, 2, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Member Since{/ts}', 'Membership', NULL, NULL ), + ( 11, 'membership_join_date', 1, 1, 2, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Member Since{/ts}', 'Membership', NULL, NULL ), ( 11, 'membership_start_date', 0, 1, 3, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Start Date{/ts}', 'Membership', NULL, NULL ), ( 11, 'membership_end_date', 0, 1, 4, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}End Date{/ts}', 'Membership', NULL, NULL ), ( 11, 'membership_source', 0, 0, 5, 'User and User Admin Only', 0, 0, NULL, '{ts escape="sql"}Source{/ts}', 'Membership', NULL, NULL ), diff --git a/civicrm/xml/templates/civicrm_navigation.tpl b/civicrm/xml/templates/civicrm_navigation.tpl index 7db2e3a1f5078639aebf6306707e1c123e86a47b..4a39b8feb7236f1ba77a2f6aeb81118a96d1bb1a 100644 --- a/civicrm/xml/templates/civicrm_navigation.tpl +++ b/civicrm/xml/templates/civicrm_navigation.tpl @@ -737,17 +737,17 @@ VALUES INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, '{ts escape="sql" skip="true"}Membership Summary{/ts}', 'member/summary', '{ts escape="sql" skip="true"}Provides a summary of memberships by type and join date.{/ts}', 'access CiviMember', '{literal}a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); + ( @domainID, '{ts escape="sql" skip="true"}Membership Summary{/ts}', 'member/summary', '{ts escape="sql" skip="true"}Provides a summary of memberships by type and join date.{/ts}', 'access CiviMember', '{literal}a:18:{s:6:"fields";a:2:{s:18:"membership_type_id";s:1:"1";s:12:"total_amount";s:1:"1";}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:21:"membership_type_id_op";s:2:"in";s:24:"membership_type_id_value";a:0:{}s:12:"status_id_op";s:2:"in";s:15:"status_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:9:"group_bys";a:2:{s:9:"join_date";s:1:"1";s:18:"membership_type_id";s:1:"1";}s:14:"group_bys_freq";a:1:{s:9:"join_date";s:5:"MONTH";}s:11:"description";s:56:"Provides a summary of memberships by type and join date.";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, '{ts escape="sql" skip="true"}Membership Details{/ts}', 'member/detail', '{ts escape="sql" skip="true"}Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.{/ts}', 'access CiviMember', '{literal}a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); + ( @domainID, '{ts escape="sql" skip="true"}Membership Details{/ts}', 'member/detail', '{ts escape="sql" skip="true"}Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date). Can also display contributions (payments) associated with each membership.{/ts}', 'access CiviMember', '{literal}a:28:{s:6:"fields";a:5:{s:9:"sort_name";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:4:"name";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:119:"Provides a list of members along with their membership status and membership details (Join Date, Start Date, End Date).";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) VALUES - ( @domainID, '{ts escape="sql" skip="true"}Contribution and Membership Details{/ts}', 'member/contributionDetail', '{ts escape="sql" skip="true"}Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.{/ts}', 'access CiviMember', '{literal}a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:18:"join_date_relative";s:1:"0";s:14:"join_date_from";s:0:"";s:12:"join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); + ( @domainID, '{ts escape="sql" skip="true"}Contribution and Membership Details{/ts}', 'member/contributionDetail', '{ts escape="sql" skip="true"}Contribution details for any type of contribution, plus associated membership information for contributions which are in payment for memberships.{/ts}', 'access CiviMember', '{literal}a:67:{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:1:"0";s:9:"domain_id";i:1;}{s:6:"fields";a:12:{s:9:"sort_name";s:1:"1";s:5:"email";s:1:"1";s:5:"phone";s:1:"1";s:17:"financial_type_id";s:1:"1";s:12:"receive_date";s:1:"1";s:12:"total_amount";s:1:"1";s:18:"membership_type_id";s:1:"1";s:21:"membership_start_date";s:1:"1";s:19:"membership_end_date";s:1:"1";s:9:"join_date";s:1:"1";s:22:"membership_status_name";s:1:"1";s:10:"country_id";s:1:"1";}s:12:"sort_name_op";s:3:"has";s:15:"sort_name_value";s:0:"";s:6:"id_min";s:0:"";s:6:"id_max";s:0:"";s:5:"id_op";s:3:"lte";s:8:"id_value";s:0:"";s:21:"receive_date_relative";s:1:"0";s:17:"receive_date_from";s:0:"";s:15:"receive_date_to";s:0:"";s:20:"financial_type_id_op";s:2:"in";s:23:"financial_type_id_value";a:0:{}s:24:"payment_instrument_id_op";s:2:"in";s:27:"payment_instrument_id_value";a:0:{}s:25:"contribution_status_id_op";s:2:"in";s:28:"contribution_status_id_value";a:0:{}s:16:"total_amount_min";s:0:"";s:16:"total_amount_max";s:0:"";s:15:"total_amount_op";s:3:"lte";s:18:"total_amount_value";s:0:"";s:6:"gid_op";s:2:"in";s:9:"gid_value";a:0:{}s:13:"ordinality_op";s:2:"in";s:16:"ordinality_value";a:0:{}s:29:"membership_join_date_relative";s:1:"0";s:25:"membership_join_date_from";s:0:"";s:23:"membership_join_date_to";s:0:"";s:30:"membership_start_date_relative";s:1:"0";s:26:"membership_start_date_from";s:0:"";s:24:"membership_start_date_to";s:0:"";s:28:"membership_end_date_relative";s:1:"0";s:24:"membership_end_date_from";s:0:"";s:22:"membership_end_date_to";s:0:"";s:23:"owner_membership_id_min";s:0:"";s:23:"owner_membership_id_max";s:0:"";s:22:"owner_membership_id_op";s:3:"lte";s:25:"owner_membership_id_value";s:0:"";s:6:"tid_op";s:2:"in";s:9:"tid_value";a:0:{}s:6:"sid_op";s:2:"in";s:9:"sid_value";a:0:{}s:17:"street_number_min";s:0:"";s:17:"street_number_max";s:0:"";s:16:"street_number_op";s:3:"lte";s:19:"street_number_value";s:0:"";s:14:"street_name_op";s:3:"has";s:17:"street_name_value";s:0:"";s:15:"postal_code_min";s:0:"";s:15:"postal_code_max";s:0:"";s:14:"postal_code_op";s:3:"lte";s:17:"postal_code_value";s:0:"";s:7:"city_op";s:3:"has";s:10:"city_value";s:0:"";s:12:"county_id_op";s:2:"in";s:15:"county_id_value";a:0:{}s:20:"state_province_id_op";s:2:"in";s:23:"state_province_id_value";a:0:{}s:13:"country_id_op";s:2:"in";s:16:"country_id_value";a:0:{}s:8:"tagid_op";s:2:"in";s:11:"tagid_value";a:0:{}s:11:"description";s:35:"Contribution and Membership Details";s:13:"email_subject";s:0:"";s:8:"email_to";s:0:"";s:8:"email_cc";s:0:"";s:10:"permission";s:17:"access CiviMember";s:9:"domain_id";i:1;}{/literal}'); INSERT INTO `civicrm_report_instance` ( `domain_id`, `title`, `report_id`, `description`, `permission`, `form_values`) diff --git a/civicrm/xml/version.xml b/civicrm/xml/version.xml index 44540ad98a995fdda300f3f22d3448a5bf582482..21081c4bc7d310ad57077ca04d92c42593c8eeb7 100644 --- a/civicrm/xml/version.xml +++ b/civicrm/xml/version.xml @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="iso-8859-1" ?> <version> - <version_no>5.17.5</version_no> + <version_no>5.18.0</version_no> </version> diff --git a/wp-rest/.editorconfig b/wp-rest/.editorconfig deleted file mode 100644 index 09dc3747d33a42560841336306fc106d96b39a47..0000000000000000000000000000000000000000 --- a/wp-rest/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -# EditorConfig is awesome: https://editorconfig.org - -# Not top-most EditorConfig file -root = false - -# Tab indentation -[*.php] -indent_style = tab -indent_size = 4 diff --git a/wp-rest/Autoloader.php b/wp-rest/Autoloader.php deleted file mode 100644 index dfa95f8a0219f6d8126f0b77110135049c693690..0000000000000000000000000000000000000000 --- a/wp-rest/Autoloader.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -/** - * Autoloader class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST; - -class Autoloader { - - /** - * Instance. - * - * @since 0.1 - * @var string - */ - private static $instance = null; - - /** - * Namespace. - * - * @since 0.1 - * @var string - */ - private $namespace = 'CiviCRM_WP_REST'; - - /** - * Autoloader directory sources. - * - * @since 0.1 - * @var array - */ - private static $source_directories = []; - - /** - * Constructor. - * - * @since 0.1 - */ - private function __construct() { - - $this->register_autoloader(); - - } - - /** - * Creates an instance of this class. - * - * @since 0.1 - */ - private static function instance() { - - if ( ! self::$instance ) self::$instance = new self; - - } - - /** - * Adds a directory source. - * - * @since 0.1 - * @param string $source The source path - */ - public static function add_source( string $source_path ) { - - // make sure we have an instance - self::instance(); - - if ( ! is_readable( trailingslashit( $source_path ) ) ) - return \WP_Error( 'civicrm_wp_rest_error', sprintf( __( 'The source %s is not readable.', 'civicrm' ), $source ) ); - - self::$source_directories[] = $source_path; - - } - - /** - * Registers the autoloader. - * - * @since 0.1 - * @return bool Wehather the autoloader has been registered or not - */ - private function register_autoloader() { - - return spl_autoload_register( [ $this, 'autoload' ] ); - - } - - /** - * Loads the classes. - * - * @since 0.1 - * @param string $class_name The class name to load - */ - private function autoload( $class_name ) { - - if ( false === strpos( $class_name, $this->namespace ) ) return; - - $parts = explode( '\\', $class_name ); - - // remove namespace and join class path - $class_path = str_replace( '_', '-', implode( DIRECTORY_SEPARATOR, array_slice( $parts, 1 ) ) ); - - array_map( function( $source_path ) use ( $class_path ) { - - $path = $source_path . $class_path . '.php'; - - if ( ! file_exists( $path ) ) return; - - require $path; - - }, static::$source_directories ); - - } - -} diff --git a/wp-rest/Civi/Mailing-Hooks.php b/wp-rest/Civi/Mailing-Hooks.php deleted file mode 100644 index 7113088b3ba4f868b6ad0ed286af3c205979b3f5..0000000000000000000000000000000000000000 --- a/wp-rest/Civi/Mailing-Hooks.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/** - * CiviCRM Mailing_Hooks class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Civi; - -class Mailing_Hooks { - - /** - * Mailing Url endpoint. - * - * @since 0.1 - * @var string - */ - public $url_endpoint; - - /** - * Mailing Open endpoint. - * - * @since 0.1 - * @var string - */ - public $open_endpoint; - - /** - * Constructor. - * - * @since 0.1 - */ - public function __construct() { - - $this->url_endpoint = rest_url( 'civicrm/v3/url' ); - - $this->open_endpoint = rest_url( 'civicrm/v3/open' ); - - } - - /** - * Register hooks. - * - * @since 0.1 - */ - public function register_hooks() { - - add_filter( 'civicrm_alterMailParams', [ $this, 'do_mailing_urls' ], 10, 2 ); - - } - - /** - * Filters the mailing html and replaces calls to 'extern/url.php' and - * 'extern/open.php' with their REST counterparts 'civicrm/v3/url' and 'civicrm/v3/open'. - * - * @uses 'civicrm_alterMailParams' - * - * @since 0.1 - * @param array &$params Mail params - * @param string $context The Context - * @return array $params The filtered Mail params - */ - public function do_mailing_urls( &$params, $context ) { - - if ( $context == 'civimail' ) { - - $params['html'] = $this->replace_html_mailing_tracking_urls( $params['html'] ); - - $params['text'] = $this->replace_text_mailing_tracking_urls( $params['text'] ); - - } - - return $params; - - } - - /** - * Replace html mailing tracking urls. - * - * @since 0.1 - * @param string $contnet The mailing content - * @return string $content The mailing content - */ - public function replace_html_mailing_tracking_urls( string $content ) { - - $doc = \phpQuery::newDocument( $content ); - - foreach ( $doc[ '[href*="civicrm/extern/url.php"], [src*="civicrm/extern/open.php"]' ] as $element ) { - - $href = pq( $element )->attr( 'href' ); - $src = pq( $element )->attr( 'src' ); - - // replace extern/url - if ( strpos( $href, 'civicrm/extern/url.php' ) ) { - - $query_string = strstr( $href, '?' ); - pq( $element )->attr( 'href', $this->url_endpoint . $query_string ); - - } - - // replace extern/open - if ( strpos( $src, 'civicrm/extern/open.php' ) ) { - - $query_string = strstr( $src, '?' ); - pq( $element )->attr( 'src', $this->open_endpoint . $query_string ); - - } - - unset( $href, $src, $query_string ); - - } - - return $doc->html(); - - } - - /** - * Replace text mailing tracking urls. - * - * @since 0.1 - * @param string $contnet The mailing content - * @return string $content The mailing content - */ - public function replace_text_mailing_tracking_urls( string $content ) { - - // replace extern url - $content = preg_replace( '/http.*civicrm\/extern\/url\.php/i', $this->url_endpoint, $content ); - - // replace open url - $content = preg_replace( '/http.*civicrm\/extern\/open\.php/i', $this->open_endpoint, $content ); - - return $content; - - } - -} diff --git a/wp-rest/Controller/AuthorizeIPN.php b/wp-rest/Controller/AuthorizeIPN.php deleted file mode 100644 index 4cd9da9a97786f3176f55ec59c2528a77b774554..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/AuthorizeIPN.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * AuthorizeIPN controller class. - * - * Replacement for CiviCRM's 'extern/authorizeIPN.php'. - * - * @see https://docs.civicrm.org/sysadmin/en/latest/setup/payment-processors/authorize-net/#shell-script-testing-method - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class AuthorizeIPN extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'authorizeIPN'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter request params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/authorizeIPN/params', $request->get_params(), $request ); - - $authorize_IPN = new \CRM_Core_Payment_AuthorizeNetIPN( $params ); - - // log notification - \Civi::log()->alert( 'payment_notification processor_name=AuthNet', $params ); - - /** - * Filter AuthorizeIPN object. - * - * @param CRM_Core_Payment_AuthorizeNetIPN $authorize_IPN - * @param array $params - * @param WP_REST_Request $request - */ - $authorize_IPN = apply_filters( 'civi_wp_rest/controller/authorizeIPN/instance', $authorize_IPN, $params, $request ); - - try { - - if ( ! method_exists( $authorize_IPN, 'main' ) || ! $this->instance_of_crm_base_ipn( $authorize_IPN ) ) - return $this->civi_rest_error( sprintf( __( '%s must implement a "main" method.', 'civicrm' ), get_class( $authorize_IPN ) ) ); - - $result = $authorize_IPN->main(); - - } catch ( \CRM_Core_Exception $e ) { - - \Civi::log()->error( $e->getMessage() ); - \Civi::log()->error( 'error data ', [ 'data' => $e->getErrorData() ] ); - \Civi::log()->error( 'REQUEST ', [ 'params' => $params ] ); - - return $this->civi_rest_error( $e->getMessage() ); - - } - - return rest_ensure_response( $result ); - - } - - /** - * Checks whether object is an instance of CRM_Core_Payment_AuthorizeNetIPN or CRM_Core_Payment_BaseIPN. - * - * Needed because the instance is being filtered through 'civi_wp_rest/controller/authorizeIPN/instance'. - * - * @since 0.1 - * @param CRM_Core_Payment_AuthorizeNetIPN|CRM_Core_Payment_BaseIPN $object - * @return bool - */ - public function instance_of_crm_base_ipn( $object ) { - - return $object instanceof \CRM_Core_Payment_BaseIPN || $object instanceof \CRM_Core_Payment_AuthorizeNetIPN; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/Base.php b/wp-rest/Controller/Base.php deleted file mode 100644 index 7546377e9e0973103beeaf4fff5e9789df04070c..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/Base.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php -/** - * Base controller class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -use CiviCRM_WP_REST\Endpoint\Endpoint_Interface; - -abstract class Base extends \WP_REST_Controller implements Endpoint_Interface { - - /** - * Route namespace. - * - * @since 0.1 - * @var string - */ - protected $namespace = 'civicrm/v3'; - - /** - * Gets the endpoint namespace. - * - * @since 0.1 - * @return string $namespace - */ - public function get_namespace() { - - return $this->namespace; - - } - - /** - * Gets the rest base route. - * - * @since 0.1 - * @return string $rest_base - */ - public function get_rest_base() { - - return '/' . $this->rest_base; - - } - - /** - * Retrieves the endpoint ie. '/civicrm/v3/rest'. - * - * @since 0.1 - * @return string $rest_base - */ - public function get_endpoint() { - - return '/' . $this->get_namespace() . $this->get_rest_base(); - - } - - /** - * Checks whether the requested route is equal to this endpoint. - * - * @since 0.1 - * @param WP_REST_Request $request - * @return bool $is_current_endpoint True if it's equal, false otherwise - */ - public function is_current_endpoint( $request ) { - - return $this->get_endpoint() == $request->get_route(); - - } - - /** - * Authorization status code. - * - * @since 0.1 - * @return int $status - */ - protected function authorization_status_code() { - - $status = 401; - - if ( is_user_logged_in() ) $status = 403; - - return $status; - - } - - /** - * Wrapper for WP_Error. - * - * @since 0.1 - * @param string|\CiviCRM_API3_Exception $error - * @param mixed $data Error data - * @return WP_Error $error - */ - protected function civi_rest_error( $error, $data = [] ) { - - if ( $error instanceof \CiviCRM_API3_Exception ) { - - return $error->getExtraParams(); - - } - - return new \WP_Error( 'civicrm_rest_api_error', $error, empty( $data ) ? [ 'status' => $this->authorization_status_code() ] : $data ); - - } - -} diff --git a/wp-rest/Controller/Cxn.php b/wp-rest/Controller/Cxn.php deleted file mode 100644 index 7f7cca5c5621c3eb3441ca7060d5e1048eb85ade..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/Cxn.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php -/** - * Cxn controller class. - * - * CiviConnect endpoint, replacement for CiviCRM's 'extern/cxn.php'. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Cxn extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'cxn'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter request params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/cxn/params', $request->get_params(), $request ); - - // init connection server - $cxn = \CRM_Cxn_BAO_Cxn::createApiServer(); - - /** - * Filter connection server object. - * - * @param Civi\Cxn\Rpc\ApiServer $cxn - * @param array $params - * @param WP_REST_Request $request - */ - $cxn = apply_filters( 'civi_wp_rest/controller/cxn/instance', $cxn, $params, $request ); - - try { - - $result = $cxn->handle( $request->get_body() ); - - } catch ( Civi\Cxn\Rpc\Exception\CxnException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } catch ( Civi\Cxn\Rpc\Exception\ExpiredCertException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } catch ( Civi\Cxn\Rpc\Exception\InvalidCertException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } catch ( Civi\Cxn\Rpc\Exception\InvalidMessageException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } catch ( Civi\Cxn\Rpc\Exception\GarbledMessageException $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } - - /** - * Bypass WP and send request from Cxn. - */ - add_filter( 'rest_pre_serve_request', function( $served, $response, $request, $server ) use ( $result ) { - - // Civi\Cxn\Rpc\Message->send() - $result->send(); - - return true; - - }, 10, 4 ); - - return rest_ensure_response( $result ); - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/Open.php b/wp-rest/Controller/Open.php deleted file mode 100644 index 450ef991a34897a169761dc9c1fdfcc57b4a0bf5..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/Open.php +++ /dev/null @@ -1,129 +0,0 @@ -<?php -/** - * Open controller class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Open extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'open'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_item' ], - 'args' => $this->get_item_args() - ], - 'schema' => [ $this, 'get_item_schema' ] - ] ); - - } - - /** - * Get item. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - $queue_id = $request->get_param( 'q' ); - - // track open - \CRM_Mailing_Event_BAO_Opened::open( $queue_id ); - - // serve tracker file - add_filter( 'rest_pre_serve_request', [ $this, 'serve_tracker_file' ], 10, 4 ); - - } - - /** - * Serves the tracker gif file. - * - * @since 0.1 - * @param bool $served Whether the request has been served - * @param WP_REST_Response $result - * @param WP_REST_Request $request - * @param WP_REST_Server $server - * @return bool $served Whether the request has been served - */ - public function serve_tracker_file( $served, $result, $request, $server ) { - - // tracker file path - $file = CIVICRM_PLUGIN_DIR . 'civicrm/i/tracker.gif'; - - // set headers - $server->send_header( 'Content-type', 'image/gif' ); - $server->send_header( 'Cache-Control', 'must-revalidate, post-check=0, pre-check=0' ); - $server->send_header( 'Content-Description', 'File Transfer' ); - $server->send_header( 'Content-Disposition', 'inline; filename=tracker.gif' ); - $server->send_header( 'Content-Length', filesize( $file ) ); - - $buffer = readfile( $file ); - - return true; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() { - - return [ - '$schema' => 'http://json-schema.org/draft-04/schema#', - 'title' => 'civicrm/v3/open', - 'description' => __( 'CiviCRM Open endpoint', 'civicrm' ), - 'type' => 'object', - 'required' => [ 'q' ], - 'properties' => [ - 'q' => [ - 'type' => 'integer' - ] - ] - ]; - - } - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() { - - return [ - 'q' => [ - 'type' => 'integer', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ] - ]; - - } - -} diff --git a/wp-rest/Controller/PayPalIPN.php b/wp-rest/Controller/PayPalIPN.php deleted file mode 100644 index 5b5c38004525287b69024d51ea378cb5615f60bc..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/PayPalIPN.php +++ /dev/null @@ -1,134 +0,0 @@ -<?php -/** - * PayPalIPN controller class. - * - * PayPal IPN endpoint, replacement for CiviCRM's 'extern/ipn.php'. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class PayPalIPN extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'ipn'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter request params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/ipn/params', $request->get_params(), $request ); - - if ( $request->get_method() == 'GET' ) { - - // paypal standard - $paypal_IPN = new \CRM_Core_Payment_PayPalIPN( $params ); - - // log notification - \Civi::log()->alert( 'payment_notification processor_name=PayPal_Standard', $params ); - - } else { - - // paypal pro - $paypal_IPN = new \CRM_Core_Payment_PayPalProIPN( $params ); - - // log notification - \Civi::log()->alert( 'payment_notification processor_name=PayPal', $params ); - - } - - /** - * Filter PayPalIPN object. - * - * @param CRM_Core_Payment_PayPalIPN|CRM_Core_Payment_PayPalProIPN $paypal_IPN - * @param array $params - * @param WP_REST_Request $request - */ - $paypal_IPN = apply_filters( 'civi_wp_rest/controller/ipn/instance', $paypal_IPN, $params, $request ); - - try { - - if ( ! method_exists( $paypal_IPN, 'main' ) || ! $this->instance_of_crm_base_ipn( $paypal_IPN ) ) - return $this->civi_rest_error( sprintf( __( '%s must implement a "main" method.', 'civicrm' ), get_class( $paypal_IPN ) ) ); - - $result = $paypal_IPN->main(); - - } catch ( \CRM_Core_Exception $e ) { - - \Civi::log()->error( $e->getMessage() ); - \Civi::log()->error( 'error data ', [ 'data' => $e->getErrorData() ] ); - \Civi::log()->error( 'REQUEST ', [ 'params' => $params ] ); - - return $this->civi_rest_error( $e->getMessage() ); - - } - - return rest_ensure_response( $result ); - - } - - /** - * Checks whether object is an instance of CRM_Core_Payment_BaseIPN|CRM_Core_Payment_PayPalProIPN|CRM_Core_Payment_PayPalIPN. - * - * Needed because the instance is being filtered through 'civi_wp_rest/controller/ipn/instance'. - * - * @since 0.1 - * @param CRM_Core_Payment_BaseIPN|CRM_Core_Payment_PayPalProIPN|CRM_Core_Payment_PayPalIPN $object - * @return bool - */ - public function instance_of_crm_base_ipn( $object ) { - - return $object instanceof \CRM_Core_Payment_BaseIPN || $object instanceof \CRM_Core_Payment_PayPalProIPN || $object instanceof \CRM_Core_Payment_PayPalIPN; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/PxIPN.php b/wp-rest/Controller/PxIPN.php deleted file mode 100644 index d68fc8d787ae3e87eb449f36b459e0b8d24d845a..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/PxIPN.php +++ /dev/null @@ -1,139 +0,0 @@ -<?php -/** - * PxIPN controller class. - * - * PxPay IPN endpoint, replacement for CiviCRM's 'extern/pxIPN.php'. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class PxIPN extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'pxIPN'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter payment processor params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( - 'civi_wp_rest/controller/pxIPN/params', - $this->get_payment_processor_args( $request ), - $request - ); - - // log notification - \Civi::log()->alert( 'payment_notification processor_name=Payment_Express', $params ); - - try { - - $result = \CRM_Core_Payment_PaymentExpressIPN::main( ...$params ); - - } catch ( \CRM_Core_Exception $e ) { - - \Civi::log()->error( $e->getMessage() ); - \Civi::log()->error( 'error data ', [ 'data' => $e->getErrorData() ] ); - \Civi::log()->error( 'REQUEST ', [ 'params' => $params ] ); - - return $this->civi_rest_error( $e->getMessage() ); - - } - - return rest_ensure_response( $result ); - - } - - /** - * Get payment processor necessary params. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return array $args - */ - public function get_payment_processor_args( $request ) { - - // get payment processor types - $payment_processor_types = civicrm_api3( 'PaymentProcessor', 'getoptions', [ - 'field' => 'payment_processor_type_id' - ] ); - - // payment processor params - $params = apply_filters( 'civi_wp_rest/controller/pxIPN/payment_processor_params', [ - 'user_name' => $request->get_param( 'userid' ), - 'payment_processor_type_id' => array_search( - 'DPS Payment Express', - $payment_processor_types['values'] - ), - 'is_active' => 1, - 'is_test' => 0 - ] ); - - // get payment processor - $payment_processor = civicrm_api3( 'PaymentProcessor', 'get', $params ); - - $args = $payment_processor['values'][$payment_processor['id']]; - - $method = empty( $args['signature'] ) ? 'pxpay' : 'pxaccess'; - - return [ - $method, - $request->get_param( 'result' ), - $args['url_site'], - $args['user_name'], - $args['password'], - $args['signature'] - ]; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/Rest.php b/wp-rest/Controller/Rest.php deleted file mode 100644 index 61706f85fdc56b540829ca685dc607b173e45795..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/Rest.php +++ /dev/null @@ -1,522 +0,0 @@ -<?php -/** - * Rest controller class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Rest extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'rest'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_items' ], - 'permission_callback' => [ $this, 'permissions_check' ], - 'args' => $this->get_item_args() - ], - 'schema' => [ $this, 'get_item_schema' ] - ] ); - - } - - /** - * Check get permission. - * - * @since 0.1 - * @param WP_REST_Request $request - * @return bool - */ - public function permissions_check( $request ) { - - if ( ! $this->is_valid_api_key( $request ) ) - return $this->civi_rest_error( __( 'Param api_key is not valid.', 'civicrm' ) ); - - if ( ! $this->is_valid_site_key() ) - return $this->civi_rest_error( __( 'Param key is not valid.', 'civicrm' ) ); - - return true; - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_items( $request ) { - - /** - * Filter formatted api params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/rest/api_params', $this->get_formatted_api_params( $request ), $request ); - - try { - - $items = civicrm_api3( ...$params ); - - } catch ( \CiviCRM_API3_Exception $e ) { - - $items = $this->civi_rest_error( $e ); - - } - - if ( ! isset( $items ) || empty( $items ) ) - return rest_ensure_response( [] ); - - /** - * Filter civi api result. - * - * @since 0.1 - * @param array $items - * @param WP_REST_Request $request - */ - $data = apply_filters( 'civi_wp_rest/controller/rest/api_result', $items, $params, $request ); - - // only collections of items, ie any action but 'getsingle' - if ( isset( $data['values'] ) ) { - - $data['values'] = array_reduce( $items['values'] ?? $items, function( $items, $item ) use ( $request ) { - - $response = $this->prepare_item_for_response( $item, $request ); - - $items[] = $this->prepare_response_for_collection( $response ); - - return $items; - - }, [] ); - - } - - $response = rest_ensure_response( $data ); - - // check wheather we need to serve xml or json - if ( ! in_array( 'json', array_keys( $request->get_params() ) ) ) { - - /** - * Adds our response holding Civi data before dispatching. - * - * @since 0.1 - * @param WP_HTTP_Response $result Result to send to client - * @param WP_REST_Server $server The REST server - * @param WP_REST_Request $request The request - * @return WP_HTTP_Response $result Result to send to client - */ - add_filter( 'rest_post_dispatch', function( $result, $server, $request ) use ( $response ) { - - return $response; - - }, 10, 3 ); - - // serve xml - add_filter( 'rest_pre_serve_request', [ $this, 'serve_xml_response' ], 10, 4 ); - - } else { - - // return json - return $response; - - } - - } - - /** - * Get formatted api params. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return array $params - */ - public function get_formatted_api_params( $request ) { - - $args = $request->get_params(); - - $entity = $args['entity']; - $action = $args['action']; - - // unset unnecessary args - unset( $args['entity'], $args['action'], $args['key'], $args['api_key'] ); - - if ( ! isset( $args['json'] ) || is_numeric( $args['json'] ) ) { - - $params = $args; - - } else { - - $params = is_string( $args['json'] ) ? json_decode( $args['json'], true ) : []; - - } - - // ensure check permissions is enabled - $params['check_permissions'] = true; - - return [ $entity, $action, $params ]; - - } - - /** - * Matches the item data to the schema. - * - * @since 0.1 - * @param object $item - * @param WP_REST_Request $request - */ - public function prepare_item_for_response( $item, $request ) { - - return rest_ensure_response( $item ); - - } - - /** - * Serves XML response. - * - * @since 0.1 - * @param bool $served Whether the request has already been served - * @param WP_REST_Response $result - * @param WP_REST_Request $request - * @param WP_REST_Server $server - */ - public function serve_xml_response( $served, $result, $request, $server ) { - - // get xml from response - $xml = $this->get_xml_formatted_data( $result->get_data() ); - - // set content type header - $server->send_header( 'Content-Type', 'text/xml' ); - - echo $xml; - - return true; - - } - - /** - * Formats CiviCRM API result to XML. - * - * @since 0.1 - * @param array $data The CiviCRM api result - * @return string $xml The formatted xml - */ - protected function get_xml_formatted_data( array $data ) { - - // xml document - $xml = new \DOMDocument(); - - // result set element <ResultSet> - $result_set = $xml->createElement( 'ResultSet' ); - - // xmlns:xsi attribute - $result_set->setAttribute( 'xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance' ); - - // count attribute - if ( isset( $data['count'] ) ) $result_set->setAttribute( 'count', $data['count'] ); - - // build result from result => values - if ( isset( $data['values'] ) ) { - - array_map( function( $item ) use ( $result_set, $xml ) { - - // result element <Result> - $result = $xml->createElement( 'Result' ); - - // format item - $result = $this->get_xml_formatted_item( $item, $result, $xml ); - - // append result to result set - $result_set->appendChild( $result ); - - }, $data['values'] ); - - } else { - - // result element <Result> - $result = $xml->createElement( 'Result' ); - - // format item - $result = $this->get_xml_formatted_item( $data, $result, $xml ); - - // append result to result set - $result_set->appendChild( $result ); - - } - - // append result set - $xml->appendChild( $result_set ); - - return $xml->saveXML(); - - } - - /** - * Formats a single api result to xml. - * - * @since 0.1 - * @param array $item The single api result - * @param DOMElement $parent The parent element to append to - * @param DOMDocument $doc The document - * @return DOMElement $parent The parent element - */ - public function get_xml_formatted_item( array $item, \DOMElement $parent, \DOMDocument $doc ) { - - // build field => values - array_map( function( $field, $value ) use ( $parent, $doc ) { - - // entity field element - $element = $doc->createElement( $field ); - - // handle array values - if ( is_array( $value ) ) { - - array_map( function( $key, $val ) use ( $element, $doc ) { - - // child element, append underscore '_' otherwise createElement - // will throw an Invalid character exception as elements cannot start with a number - $child = $doc->createElement( '_' . $key, $val ); - - // append child - $element->appendChild( $child ); - - }, array_keys( $value ), $value ); - - } else { - - // assign value - $element->nodeValue = $value; - - } - - // append element - $parent->appendChild( $element ); - - }, array_keys( $item ), $item ); - - return $parent; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() { - - return [ - '$schema' => 'http://json-schema.org/draft-04/schema#', - 'title' => 'civicrm/v3/rest', - 'description' => __( 'CiviCRM API3 WP rest endpoint wrapper', 'civicrm' ), - 'type' => 'object', - 'required' => [ 'entity', 'action', 'params' ], - 'properties' => [ - 'is_error' => [ - 'type' => 'integer' - ], - 'version' => [ - 'type' => 'integer' - ], - 'count' => [ - 'type' => 'integer' - ], - 'values' => [ - 'type' => 'array' - ] - ] - ]; - - } - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() { - - return [ - 'key' => [ - 'type' => 'string', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return $this->is_valid_site_key(); - - } - ], - 'api_key' => [ - 'type' => 'string', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return $this->is_valid_api_key( $request ); - - } - ], - 'entity' => [ - 'type' => 'string', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_string( $value ); - - } - ], - 'action' => [ - 'type' => 'string', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_string( $value ); - - } - ], - 'json' => [ - 'type' => ['integer', 'string', 'array'], - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ) || is_array( $value ) || $this->is_valid_json( $value ); - - } - ] - ]; - - } - - /** - * Checks if string is a valid json. - * - * @since 0.1 - * @param string $param - * @return bool - */ - protected function is_valid_json( $param ) { - - $param = json_decode( $param, true ); - - if ( ! is_array( $param ) ) return false; - - return ( json_last_error() == JSON_ERROR_NONE ); - - } - - /** - * Validates the site key. - * - * @since 0.1 - * @return bool $is_valid_site_key - */ - private function is_valid_site_key() { - - return \CRM_Utils_System::authenticateKey( false ); - - } - - /** - * Validates the api key. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return bool $is_valid_api_key - */ - private function is_valid_api_key( $request ) { - - $api_key = $request->get_param( 'api_key' ); - - if ( ! $api_key ) return false; - - $contact_id = \CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact', $api_key, 'id', 'api_key' ); - - // validate contact and login - if ( $contact_id ) { - - $wp_user = $this->get_wp_user( $contact_id ); - - $this->do_user_login( $wp_user ); - - return true; - - } - - return false; - - } - - /** - * Get WordPress user data. - * - * @since 0.1 - * @param int $contact_id The contact id - * @return bool|WP_User $user The WordPress user data - */ - protected function get_wp_user( int $contact_id ) { - - try { - - // Get CiviCRM domain group ID from constant, if set. - $domain_id = defined( 'CIVICRM_DOMAIN_ID' ) ? CIVICRM_DOMAIN_ID : 0; - - // If this fails, get it from config. - if ( $domain_id === 0 ) { - $domain_id = CRM_Core_Config::domainID(); - } - - // Call API. - $uf_match = civicrm_api3( 'UFMatch', 'getsingle', [ - 'contact_id' => $contact_id, - 'domain_id' => $domain_id, - ] ); - - } catch ( \CiviCRM_API3_Exception $e ) { - - return $this->civi_rest_error( $e->getMessage() ); - - } - - $wp_user = get_userdata( $uf_match['uf_id'] ); - - return $wp_user; - - } - - /** - * Logs in the WordPress user, needed to respect CiviCRM ACL and permissions. - * - * @since 0.1 - * @param WP_User $user - */ - protected function do_user_login( \WP_User $user ) { - - if ( is_user_logged_in() ) return; - - wp_set_current_user( $user->ID, $user->user_login ); - - wp_set_auth_cookie( $user->ID ); - - do_action( 'wp_login', $user->user_login, $user ); - - } - -} diff --git a/wp-rest/Controller/Soap.php b/wp-rest/Controller/Soap.php deleted file mode 100644 index 17402cc579a834ca8854014e683a53aad5011399..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/Soap.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php -/** - * Soap controller class. - * - * Soap endpoint, replacement for CiviCRM's 'extern/soap.php'. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Soap extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'soap'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::ALLMETHODS, - 'callback' => [ $this, 'get_item' ] - ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter request params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/soap/params', $request->get_params(), $request ); - - // init soap server - $soap_server = new \SoapServer( - NULL, - [ - 'uri' => 'urn:civicrm', - 'soap_version' => SOAP_1_2, - ] - ); - - $crm_soap_server = new \CRM_Utils_SoapServer(); - - $soap_server->setClass( 'CRM_Utils_SoapServer', \CRM_Core_Config::singleton()->userFrameworkClass ); - $soap_server->setPersistence( SOAP_PERSISTENCE_SESSION ); - - /** - * Bypass WP and send request from Soap server. - */ - add_filter( 'rest_pre_serve_request', function( $served, $response, $request, $server ) use ( $soap_server ) { - - $soap_server->handle(); - - return true; - - }, 10, 4 ); - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() {} - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() {} - -} diff --git a/wp-rest/Controller/Url.php b/wp-rest/Controller/Url.php deleted file mode 100644 index 9286856e7c88e6d1cf9057cf78da943cb34f73d1..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/Url.php +++ /dev/null @@ -1,214 +0,0 @@ -<?php -/** - * Url controller class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Url extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'url'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_item' ], - 'args' => $this->get_item_args() - ], - 'schema' => [ $this, 'get_item_schema' ] - ] ); - - } - - /** - * Get items. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter formatted api params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( 'civi_wp_rest/controller/url/params', $this->get_formatted_params( $request ), $request ); - - // track url - $url = \CRM_Mailing_Event_BAO_TrackableURLOpen::track( $params['queue_id'], $params['url_id'] ); - - /** - * Filter url. - * - * @param string $url - * @param array $params - * @param WP_REST_Request $request - */ - $url = apply_filters( 'civi_wp_rest/controller/url/before_parse_url', $url, $params, $request ); - - // parse url - $url = $this->parse_url( $url, $params ); - - $this->do_redirect( $url ); - - } - - /** - * Get formatted api params. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return array $params - */ - protected function get_formatted_params( $request ) { - - $args = $request->get_params(); - - $params = [ - 'queue_id' => isset( $args['qid'] ) ? $args['qid'] ?? '' : $args['q'] ?? '', - 'url_id' => $args['u'] - ]; - - // unset unnecessary args - unset( $args['qid'], $args['u'], $args['q'] ); - - if ( ! empty( $args ) ) { - - $params['query'] = http_build_query( $args ); - - } - - return $params; - - } - - /** - * Parses the url. - * - * @since 0.1 - * @param string $url - * @param array $params - * @return string $url - */ - protected function parse_url( $url, $params ) { - - // CRM-18320 - Fix encoded ampersands - $url = str_replace( '&', '&', $url ); - - // CRM-7103 - Look for additional query variables and append them - if ( isset( $params['query'] ) && strpos( $url, '?' ) ) { - - $url .= '&' . $params['query']; - - } elseif ( isset( $params['query'] ) ) { - - $url .= '?' . $params['query']; - - } - - return apply_filters( 'civi_wp_rest/controller/url/parsed_url', $url, $params ); - - } - - /** - * Do redirect. - * - * @since 0.1 - * @param string $url - */ - protected function do_redirect( $url ) { - - wp_redirect( $url ); - - exit; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() { - - return [ - '$schema' => 'http://json-schema.org/draft-04/schema#', - 'title' => 'civicrm_api3/v3/url', - 'description' => __( 'CiviCRM API3 wrapper', 'civicrm' ), - 'type' => 'object', - 'required' => [ 'qid', 'u' ], - 'properties' => [ - 'qid' => [ - 'type' => 'integer' - ], - 'q' => [ - 'type' => 'integer' - ], - 'u' => [ - 'type' => 'integer' - ] - ] - ]; - - } - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() { - - return [ - 'qid' => [ - 'type' => 'integer', - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'q' => [ - 'type' => 'integer', - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'u' => [ - 'type' => 'integer', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ] - ]; - - } - -} diff --git a/wp-rest/Controller/Widget.php b/wp-rest/Controller/Widget.php deleted file mode 100644 index 13fa1e2adde648de8c24b1278039385569bd5c21..0000000000000000000000000000000000000000 --- a/wp-rest/Controller/Widget.php +++ /dev/null @@ -1,214 +0,0 @@ -<?php -/** - * Widget controller class. - * - * Widget endpoint, replacement for CiviCRM's 'extern/widget.php' - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Controller; - -class Widget extends Base { - - /** - * The base route. - * - * @since 0.1 - * @var string - */ - protected $rest_base = 'widget'; - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes() { - - register_rest_route( $this->get_namespace(), $this->get_rest_base(), [ - [ - 'methods' => \WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_item' ], - 'args' => $this->get_item_args() - ], - 'schema' => [ $this, 'get_item_schema' ] - ] ); - - } - - /** - * Get item. - * - * @since 0.1 - * @param WP_REST_Request $request - */ - public function get_item( $request ) { - - /** - * Filter mandatory params. - * - * @since 0.1 - * @param array $params - * @param WP_REST_Request $request - */ - $params = apply_filters( - 'civi_wp_rest/controller/widget/params', - $this->get_mandatory_params( $request ), - $request - ); - - $jsonvar = 'jsondata'; - - if ( ! empty( $request->get_param( 'format' ) ) ) $jsonvar .= $request->get_param( 'cpageId' ); - - $data = \CRM_Contribute_BAO_Widget::getContributionPageData( ...$params ); - - $response = 'var ' . $jsonvar . ' = ' . json_encode( $data ) . ';'; - - /** - * Adds our response data before dispatching. - * - * @since 0.1 - * @param WP_HTTP_Response $result Result to send to client - * @param WP_REST_Server $server The REST server - * @param WP_REST_Request $request The request - * @return WP_HTTP_Response $result Result to send to client - */ - add_filter( 'rest_post_dispatch', function( $result, $server, $request ) use ( $response ) { - - return rest_ensure_response( $response ); - - }, 10, 3 ); - - // serve javascript - add_filter( 'rest_pre_serve_request', [ $this, 'serve_javascript' ], 10, 4 ); - - } - - /** - * Get mandatory params from request. - * - * @since 0.1 - * @param WP_REST_Resquest $request - * @return array $params The widget params - */ - protected function get_mandatory_params( $request ) { - - $args = $request->get_params(); - - return [ - $args['cpageId'], - $args['widgetId'], - $args['includePending'] ?? false - ]; - - } - - /** - * Serve jsondata response. - * - * @since 0.1 - * @param bool $served Whether the request has already been served - * @param WP_REST_Response $result - * @param WP_REST_Request $request - * @param WP_REST_Server $server - * @return bool $served - */ - public function serve_javascript( $served, $result, $request, $server ) { - - // set content type header - $server->send_header( 'Expires', gmdate( 'D, d M Y H:i:s \G\M\T', time() + 60 ) ); - $server->send_header( 'Content-Type', 'application/javascript' ); - $server->send_header( 'Cache-Control', 'max-age=60, public' ); - - echo $result->get_data(); - - return true; - - } - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema() { - - return [ - '$schema' => 'http://json-schema.org/draft-04/schema#', - 'title' => 'civicrm_api3/v3/widget', - 'description' => __( 'CiviCRM API3 wrapper', 'civicrm' ), - 'type' => 'object', - 'required' => [ 'cpageId', 'widgetId' ], - 'properties' => [ - 'cpageId' => [ - 'type' => 'integer', - 'minimum' => 1 - ], - 'widgetId' => [ - 'type' => 'integer', - 'minimum' => 1 - ], - 'format' => [ - 'type' => 'integer' - ], - 'includePending' => [ - 'type' => 'boolean' - ] - ] - ]; - - } - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args() { - - return [ - 'cpageId' => [ - 'type' => 'integer', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'widgetId' => [ - 'type' => 'integer', - 'required' => true, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'format' => [ - 'type' => 'integer', - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_numeric( $value ); - - } - ], - 'includePending' => [ - 'type' => 'boolean', - 'required' => false, - 'validate_callback' => function( $value, $request, $key ) { - - return is_string( $value ); - - } - ] - ]; - - } - -} diff --git a/wp-rest/Endpoint/Endpoint-Interface.php b/wp-rest/Endpoint/Endpoint-Interface.php deleted file mode 100644 index 9497cde5099ecbd7936571b0b73e318652abea7f..0000000000000000000000000000000000000000 --- a/wp-rest/Endpoint/Endpoint-Interface.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/** - * Endpoint Interface class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST\Endpoint; - -interface Endpoint_Interface { - - /** - * Registers routes. - * - * @since 0.1 - */ - public function register_routes(); - - /** - * Item schema. - * - * @since 0.1 - * @return array $schema - */ - public function get_item_schema(); - - /** - * Item arguments. - * - * @since 0.1 - * @return array $arguments - */ - public function get_item_args(); - -} diff --git a/wp-rest/Plugin.php b/wp-rest/Plugin.php deleted file mode 100644 index 4038a56b1b6cab395e1a2d143cfe8882a7edb456..0000000000000000000000000000000000000000 --- a/wp-rest/Plugin.php +++ /dev/null @@ -1,193 +0,0 @@ -<?php -/** - * Main plugin class. - * - * @since 0.1 - */ - -namespace CiviCRM_WP_REST; - -use CiviCRM_WP_REST\Civi\Mailing_Hooks; - -class Plugin { - - /** - * Constructor. - * - * @since 0.1 - */ - public function __construct() { - - $this->register_hooks(); - - $this->setup_objects(); - - } - - /** - * Register hooks. - * - * @since 1.0 - */ - protected function register_hooks() { - - add_action( 'rest_api_init', [ $this, 'register_rest_routes' ] ); - - add_filter( 'rest_pre_dispatch', [ $this, 'bootstrap_civi' ], 10, 3 ); - - add_filter( 'rest_post_dispatch', [ $this, 'maybe_reset_wp_timezone' ], 10, 3); - - } - - /** - * Bootstrap CiviCRM when hitting a the 'civicrm' namespace. - * - * @since 0.1 - * @param mixed $result - * @param WP_REST_Server $server REST server instance - * @param WP_REST_Request $request The request - * @return mixed $result - */ - public function bootstrap_civi( $result, $server, $request ) { - - if ( false !== strpos( $request->get_route(), 'civicrm' ) ) { - - $this->maybe_set_user_timezone( $request ); - - civi_wp()->initialize(); - - } - - return $result; - - } - - /** - * Setup objects. - * - * @since 0.1 - */ - private function setup_objects() { - - if ( CIVICRM_WP_REST_REPLACE_MAILING_TRACKING ) { - - // register mailing hooks - $mailing_hooks = ( new Mailing_Hooks )->register_hooks(); - - } - - } - - /** - * Registers Rest API routes. - * - * @since 0.1 - */ - public function register_rest_routes() { - - // rest endpoint - $rest_controller = new Controller\Rest; - $rest_controller->register_routes(); - - // url controller - $url_controller = new Controller\Url; - $url_controller->register_routes(); - - // open controller - $open_controller = new Controller\Open; - $open_controller->register_routes(); - - // authorizenet controller - $authorizeIPN_controller = new Controller\AuthorizeIPN; - $authorizeIPN_controller->register_routes(); - - // paypal controller - $paypalIPN_controller = new Controller\PayPalIPN; - $paypalIPN_controller->register_routes(); - - // pxpay controller - $paypalIPN_controller = new Controller\PxIPN; - $paypalIPN_controller->register_routes(); - - // civiconnect controller - $cxn_controller = new Controller\Cxn; - $cxn_controller->register_routes(); - - // widget controller - $widget_controller = new Controller\Widget; - $widget_controller->register_routes(); - - // soap controller - $soap_controller = new Controller\Soap; - $soap_controller->register_routes(); - - /** - * Opportunity to add more rest routes. - * - * @since 0.1 - */ - do_action( 'civi_wp_rest/plugin/rest_routes_registered' ); - - } - - /** - * Sets the timezone to the users timezone when - * calling the civicrm/v3/rest endpoint. - * - * @since 0.1 - * @param WP_REST_Request $request The request - */ - private function maybe_set_user_timezone( $request ) { - - if ( $request->get_route() != '/civicrm/v3/rest' ) return; - - $timezones = [ - 'wp_timezone' => date_default_timezone_get(), - 'user_timezone' => get_option( 'timezone_string', false ) - ]; - - // filter timezones - add_filter( 'civi_wp_rest/plugin/timezones', function() use ( $timezones ) { - - return $timezones; - - } ); - - if ( empty( $timezones['user_timezone'] ) ) return; - - /** - * CRM-12523 - * CRM-18062 - * CRM-19115 - */ - date_default_timezone_set( $timezones['user_timezone'] ); - \CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone(); - - } - - /** - * Resets the timezone to the original WP - * timezone after calling the civicrm/v3/rest endpoint. - * - * @since 0.1 - * @param mixed $result - * @param WP_REST_Server $server REST server instance - * @param WP_REST_Request $request The request - * @return mixed $result - */ - public function maybe_reset_wp_timezone( $result, $server, $request ) { - - if ( $request->get_route() != '/civicrm/v3/rest' ) return $result; - - $timezones = apply_filters( 'civi_wp_rest/plugin/timezones', null ); - - if ( empty( $timezones['wp_timezone'] ) ) return $result; - - // reset wp timezone - date_default_timezone_set( $timezones['wp_timezone'] ); - - return $result; - - } - -} diff --git a/wp-rest/README.md b/wp-rest/README.md deleted file mode 100644 index 77234de84a195dc6fbb22e1e7d460ff7d44587f2..0000000000000000000000000000000000000000 --- a/wp-rest/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# CiviCRM WP REST API Wrapper - -This is a WordPress plugin that aims to expose CiviCRM's [extern](https://github.com/civicrm/civicrm-core/tree/master/extern) scripts as WordPress REST endpoints. - -This plugin requires: - -- PHP 7.1+ -- WordPress 4.7+ -- CiviCRM to be installed and activated. - -### Endpoints - -1. `civicrm/v3/rest` - a wrapper around `civicrm_api3()` - - **Parameters**: - - - `key` - **required**, the site key - - `api_key` - **required**, the contact api key - - `entity` - **required**, the API entity - - `action` - **required**, the API action - - `json` - **optional**, json formatted string with the API parameters/argumets, or `1` as in `json=1` - - By default all calls to `civicrm/v3/rest` return XML formatted results, to get `json` formatted result pass `json=1` or a json formatted string with the API parameters, like in the example 2 below. - - **Examples**: - - 1. `https://example.com/wp-json/civicrm/v3/rest?entity=Contact&action=get&key=<site_key>&api_key=<api_key>&group=Administrators` - - 2. `https://example.com/wp-json/civicrm/v3/rest?entity=Contact&action=get&key=<site_key>&api_key=<api_key>&json={"group": "Administrators"}` - -2. `civicrm/v3/url` - a substition for `civicrm/extern/url.php` mailing tracking - -3. `civicrm/v3/open` - a substition for `civicrm/extern/open.php` mailing tracking - -4. `civicrm/v3/authorizeIPN` - a substition for `civicrm/extern/authorizeIPN.php` (for testing Authorize.net as per [docs](https://docs.civicrm.org/sysadmin/en/latest/setup/payment-processors/authorize-net/#shell-script-testing-method)) - - **_Note_**: this endpoint has **not been tested** - -5. `civicrm/v3/ipn` - a substition for `civicrm/extern/ipn.php` (for PayPal Standard and Pro live transactions) - - **_Note_**: this endpoint has **not been tested** - -6. `civicrm/v3/cxn` - a substition for `civicrm/extern/cxn.php` - -7. `civicrm/v3/pxIPN` - a substition for `civicrm/extern/pxIPN.php` - - **_Note_**: this endpoint has **not been tested** - -8. `civicrm/v3/widget` - a substition for `civicrm/extern/widget.php` - -9. `civicrm/v3/soap` - a substition for `civicrm/extern/soap.php` - - **_Note_**: this endpoint has **not been tested** - -### Settings - -Set the `CIVICRM_WP_REST_REPLACE_MAILING_TRACKING` constant to `true` to replace mailing url and open tracking calls with their counterpart REST endpoints, `civicrm/v3/url` and `civicrm/v3/open`. - -_Note: use this setting with caution, it may affect performance on large mailings, see `CiviCRM_WP_REST\Civi\Mailing_Hooks` class._