diff --git a/CRM/ACL/DAO/ACL.php b/CRM/ACL/DAO/ACL.php index 2cba8eaaf3cd..924a9eaf2aad 100644 --- a/CRM/ACL/DAO/ACL.php +++ b/CRM/ACL/DAO/ACL.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/ACL/ACL.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:71681f363debd53627c4c98a9032b0f6) + * (GenCodeChecksum:810da5f19a7ead8c949065156674c087) */ /** @@ -31,7 +31,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO { /** * Unique table ID * - * @var int unsigned + * @var int */ public $id; @@ -45,7 +45,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO { /** * Is this ACL entry Allow (0) or Deny (1) ? * - * @var boolean + * @var bool */ public $deny; @@ -59,7 +59,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO { /** * ID of the object possessing this ACL * - * @var int unsigned + * @var int */ public $entity_id; @@ -80,7 +80,7 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO { /** * The ID of the object controlled by this ACL entry * - * @var int unsigned + * @var int */ public $object_id; @@ -94,14 +94,14 @@ class CRM_ACL_DAO_ACL extends CRM_Core_DAO { /** * ID of the ACL or ACL group being granted/revoked * - * @var int unsigned + * @var int */ public $acl_id; /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; @@ -223,7 +223,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_ACL_BAO_ACL::operation', - ] + ], ], 'object_table' => [ 'name' => 'object_table', diff --git a/CRM/ACL/DAO/Cache.php b/CRM/ACL/DAO/Cache.php index c59ff67e5709..229f6f4c6e40 100644 --- a/CRM/ACL/DAO/Cache.php +++ b/CRM/ACL/DAO/Cache.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/ACL/Cache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:7551610e08f73f20ef3e5b9ef6782f80) + * (GenCodeChecksum:f993d89f3a44999eed1b4c46b714b736) */ /** @@ -31,21 +31,21 @@ class CRM_ACL_DAO_Cache extends CRM_Core_DAO { /** * Unique table ID * - * @var int unsigned + * @var int */ public $id; /** * Foreign Key to Contact * - * @var int unsigned + * @var int */ public $contact_id; /** * Foreign Key to ACL * - * @var int unsigned + * @var int */ public $acl_id; diff --git a/CRM/ACL/DAO/EntityRole.php b/CRM/ACL/DAO/EntityRole.php index 93956fc8b9d8..ea0019457556 100644 --- a/CRM/ACL/DAO/EntityRole.php +++ b/CRM/ACL/DAO/EntityRole.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/ACL/EntityRole.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:c53e5bc404fee6d3f005fbaf15abdb4e) + * (GenCodeChecksum:65952cc85e04acddbaef65cfcf7fc541) */ /** @@ -31,14 +31,14 @@ class CRM_ACL_DAO_EntityRole extends CRM_Core_DAO { /** * Unique table ID * - * @var int unsigned + * @var int */ public $id; /** * Foreign Key to ACL Role (which is an option value pair and hence an implicit FK) * - * @var int unsigned + * @var int */ public $acl_role_id; @@ -52,14 +52,14 @@ class CRM_ACL_DAO_EntityRole extends CRM_Core_DAO { /** * ID of the group/contact object being joined * - * @var int unsigned + * @var int */ public $entity_id; /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; diff --git a/CRM/Activity/DAO/Activity.php b/CRM/Activity/DAO/Activity.php index d81c1a82a875..8f4053dfed6b 100644 --- a/CRM/Activity/DAO/Activity.php +++ b/CRM/Activity/DAO/Activity.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Activity/Activity.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ffa557668a214e3683b1692238ad74ae) + * (GenCodeChecksum:808e801e250ba56b83f69fe90d8b52c2) */ /** @@ -31,21 +31,21 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO { /** * Unique Other Activity ID * - * @var int unsigned + * @var int */ public $id; /** * Artificial FK to original transaction (e.g. contribution) IF it is not an Activity. Table can be figured out through activity_type_id, and further through component registry. * - * @var int unsigned + * @var int */ public $source_record_id; /** * FK to civicrm_option_value.id, that has to be valid, registered activity type. * - * @var int unsigned + * @var int */ public $activity_type_id; @@ -66,7 +66,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO { /** * Planned or actual duration of activity expressed in minutes. Conglomerate of former duration_hours and duration_minutes. * - * @var int unsigned + * @var int */ public $duration; @@ -80,7 +80,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO { /** * Phone ID of the number called (optional - used if an existing phone number is selected). * - * @var int unsigned + * @var int */ public $phone_id; @@ -101,57 +101,57 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO { /** * ID of the status this activity is currently in. Foreign key to civicrm_option_value. * - * @var int unsigned + * @var int */ public $status_id; /** * ID of the priority given to this activity. Foreign key to civicrm_option_value. * - * @var int unsigned + * @var int */ public $priority_id; /** * Parent meeting ID (if this is a follow-up item). This is not currently implemented * - * @var int unsigned + * @var int */ public $parent_id; /** - * @var boolean + * @var bool */ public $is_test; /** * Activity Medium, Implicit FK to civicrm_option_value where option_group = encounter_medium. * - * @var int unsigned + * @var int */ public $medium_id; /** - * @var boolean + * @var bool */ public $is_auto; /** * FK to Relationship ID * - * @var int unsigned + * @var int */ public $relationship_id; /** - * @var boolean + * @var bool */ public $is_current_revision; /** * Activity ID of the first activity record in versioning chain. * - * @var int unsigned + * @var int */ public $original_id; @@ -163,21 +163,21 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO { public $result; /** - * @var boolean + * @var bool */ public $is_deleted; /** * The campaign for which this activity has been triggered. * - * @var int unsigned + * @var int */ public $campaign_id; /** * Assign a specific level of engagement to this activity. Used for tracking constituents in ladder of engagement. * - * @var int unsigned + * @var int */ public $engagement_level; @@ -189,7 +189,7 @@ class CRM_Activity_DAO_Activity extends CRM_Core_DAO { /** * Activity marked as favorite. * - * @var boolean + * @var bool */ public $is_star; @@ -288,7 +288,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'activity_type', 'optionEditPath' => 'civicrm/admin/options/activity_type', - ] + ], ], 'activity_subject' => [ 'name' => 'subject', @@ -430,7 +430,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'activity_status', 'optionEditPath' => 'civicrm/admin/options/activity_status', - ] + ], ], 'priority_id' => [ 'name' => 'priority_id', @@ -448,7 +448,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'priority', 'optionEditPath' => 'civicrm/admin/options/priority', - ] + ], ], 'parent_id' => [ 'name' => 'parent_id', @@ -496,7 +496,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'encounter_medium', 'optionEditPath' => 'civicrm/admin/options/encounter_medium', - ] + ], ], 'is_auto' => [ 'name' => 'is_auto', @@ -604,7 +604,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'activity_engagement_level' => [ 'name' => 'engagement_level', @@ -624,7 +624,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'engagement_index', 'optionEditPath' => 'civicrm/admin/options/engagement_index', - ] + ], ], 'weight' => [ 'name' => 'weight', diff --git a/CRM/Activity/DAO/ActivityContact.php b/CRM/Activity/DAO/ActivityContact.php index 1eaa7ca8256d..aac6059d38b0 100644 --- a/CRM/Activity/DAO/ActivityContact.php +++ b/CRM/Activity/DAO/ActivityContact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Activity/ActivityContact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ff5291c3d7067182669807aa125fef72) + * (GenCodeChecksum:bb5726fd8dc1e07e19a08982d502a9f1) */ /** @@ -31,28 +31,28 @@ class CRM_Activity_DAO_ActivityContact extends CRM_Core_DAO { /** * Activity contact id * - * @var int unsigned + * @var int */ public $id; /** * Foreign key to the activity for this record. * - * @var int unsigned + * @var int */ public $activity_id; /** * Foreign key to the contact for this record. * - * @var int unsigned + * @var int */ public $contact_id; /** * Nature of this contact's role in the activity: 1 assignee, 2 creator, 3 focus or target. * - * @var int unsigned + * @var int */ public $record_type_id; @@ -144,7 +144,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'activity_contacts', 'optionEditPath' => 'civicrm/admin/options/activity_contacts', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Activity/Form/Activity.php b/CRM/Activity/Form/Activity.php index a3fef8d7d8f0..c59ef226c176 100644 --- a/CRM/Activity/Form/Activity.php +++ b/CRM/Activity/Form/Activity.php @@ -111,7 +111,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { /** * Survey activity. * - * @var boolean + * @var bool */ protected $_isSurveyActivity; @@ -133,7 +133,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task { * Note: This is a class property so that child classes can turn off this * behavior (e.g. in CRM_Case_Form_Activity) * - * @var boolean + * @var bool * */ @@ -627,6 +627,12 @@ public function setDefaultValues() { return $defaults; } + /** + * Build Quick form. + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception + */ public function buildQuickForm() { if ($this->_action & (CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) { //enable form element (ActivityLinks sets this true) @@ -894,7 +900,7 @@ public static function formRule($fields, $files, $self) { * * * @param array $params - + * * @return array|null * @throws \CiviCRM_API3_Exception */ diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index 4aa16252d5d6..063fa8001f31 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -46,14 +46,14 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Activity/Form/Task/Delete.php b/CRM/Activity/Form/Task/Delete.php index 7fa2bef6ca80..3bdcfc0916c4 100644 --- a/CRM/Activity/Form/Task/Delete.php +++ b/CRM/Activity/Form/Task/Delete.php @@ -42,7 +42,7 @@ class CRM_Activity_Form_Task_Delete extends CRM_Activity_Form_Task { * Are we operating in "single mode", i.e. deleting one * specific Activity? * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Activity/Form/Task/Email.php b/CRM/Activity/Form/Task/Email.php index 4f6db5136b1a..e5338f33e51f 100644 --- a/CRM/Activity/Form/Task/Email.php +++ b/CRM/Activity/Form/Task/Email.php @@ -40,7 +40,7 @@ class CRM_Activity_Form_Task_Email extends CRM_Activity_Form_Task { * Are we operating in "single mode", i.e. sending email to one * specific contact? * - * @var boolean + * @var bool */ public $_single = FALSE; diff --git a/CRM/Activity/Form/Task/SMS.php b/CRM/Activity/Form/Task/SMS.php index 42d9f6aa3f23..d19e1ea543fb 100644 --- a/CRM/Activity/Form/Task/SMS.php +++ b/CRM/Activity/Form/Task/SMS.php @@ -39,7 +39,7 @@ class CRM_Activity_Form_Task_SMS extends CRM_Activity_Form_Task { * Are we operating in "single mode", i.e. sending sms to one * specific contact? * - * @var boolean + * @var bool */ public $_single = FALSE; diff --git a/CRM/Activity/Import/Field.php b/CRM/Activity/Import/Field.php index b19a6002de94..4f8471472ca1 100644 --- a/CRM/Activity/Import/Field.php +++ b/CRM/Activity/Import/Field.php @@ -52,7 +52,7 @@ class CRM_Activity_Import_Field { /** * Is this field required - * @var boolean + * @var bool */ public $_required; diff --git a/CRM/Activity/Import/Parser.php b/CRM/Activity/Import/Parser.php index fc4aca0c20dc..67198fee6874 100644 --- a/CRM/Activity/Import/Parser.php +++ b/CRM/Activity/Import/Parser.php @@ -55,7 +55,7 @@ abstract class CRM_Activity_Import_Parser extends CRM_Import_Parser { /** * Whether the file has a column header or not. * - * @var boolean + * @var bool */ protected $_haveColumnHeader; diff --git a/CRM/Activity/Selector/Search.php b/CRM/Activity/Selector/Search.php index 8a21dde81faa..abd0bdfb249f 100644 --- a/CRM/Activity/Selector/Search.php +++ b/CRM/Activity/Selector/Search.php @@ -79,14 +79,14 @@ class CRM_Activity_Selector_Search extends CRM_Core_Selector_Base implements CRM /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Admin/Form/SettingTrait.php b/CRM/Admin/Form/SettingTrait.php index f22470803fe6..308d409e7ea5 100644 --- a/CRM/Admin/Form/SettingTrait.php +++ b/CRM/Admin/Form/SettingTrait.php @@ -66,8 +66,7 @@ public function getDefaultEntity() { */ protected function getSettingsMetaData() { if (empty($this->settingsMetadata)) { - $allSettingMetaData = civicrm_api3('setting', 'getfields', []); - $this->settingsMetadata = array_intersect_key($allSettingMetaData['values'], $this->_settings); + $this->settingsMetadata = \Civi\Core\SettingsMetadata::getMetadata(['name' => array_keys($this->_settings)], NULL, TRUE); // This array_merge re-orders to the key order of $this->_settings. $this->settingsMetadata = array_merge($this->_settings, $this->settingsMetadata); } @@ -174,10 +173,7 @@ protected function addFieldsDefinedInSettingsMetadata() { $quickFormType = $this->getQuickFormType($props); if (isset($quickFormType)) { $options = CRM_Utils_Array::value('options', $props); - if (isset($props['pseudoconstant'])) { - $options = civicrm_api3('Setting', 'getoptions', [ - 'field' => $setting, - ])['values']; + if ($options) { if ($props['html_type'] === 'Select' && isset($props['is_required']) && $props['is_required'] === FALSE && !isset($options[''])) { // If the spec specifies the field is not required add a null option. // Why not if empty($props['is_required']) - basically this has been added to the spec & might not be set to TRUE diff --git a/CRM/Admin/Page/Options.php b/CRM/Admin/Page/Options.php index 7ba567c047e8..8a54c7426cb0 100644 --- a/CRM/Admin/Page/Options.php +++ b/CRM/Admin/Page/Options.php @@ -69,7 +69,7 @@ class CRM_Admin_Page_Options extends CRM_Core_Page_Basic { /** * A boolean determining if you can add options to this group in the GUI. * - * @var boolean + * @var bool */ public static $_isLocked = FALSE; diff --git a/CRM/Batch/DAO/Batch.php b/CRM/Batch/DAO/Batch.php index cac1d10f15b4..500d32941cdb 100644 --- a/CRM/Batch/DAO/Batch.php +++ b/CRM/Batch/DAO/Batch.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Batch/Batch.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:5e14654e2df1b813931043edb9d0f828) + * (GenCodeChecksum:88c016b0141ed596ac6fdbbef3e27a1e) */ /** @@ -31,7 +31,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO { /** * Unique Address ID * - * @var int unsigned + * @var int */ public $id; @@ -59,7 +59,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO { /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $created_id; @@ -73,7 +73,7 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO { /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $modified_id; @@ -87,28 +87,28 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO { /** * FK to Saved Search ID * - * @var int unsigned + * @var int */ public $saved_search_id; /** * fk to Batch Status options in civicrm_option_values * - * @var int unsigned + * @var int */ public $status_id; /** * fk to Batch Type options in civicrm_option_values * - * @var int unsigned + * @var int */ public $type_id; /** * fk to Batch mode options in civicrm_option_values * - * @var int unsigned + * @var int */ public $mode_id; @@ -122,14 +122,14 @@ class CRM_Batch_DAO_Batch extends CRM_Core_DAO { /** * Number of items in a batch. * - * @var int unsigned + * @var int */ public $item_count; /** * fk to Payment Instrument options in civicrm_option_values * - * @var int unsigned + * @var int */ public $payment_instrument_id; @@ -319,7 +319,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'batch_status', 'optionEditPath' => 'civicrm/admin/options/batch_status', - ] + ], ], 'type_id' => [ 'name' => 'type_id', @@ -337,7 +337,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'batch_type', 'optionEditPath' => 'civicrm/admin/options/batch_type', - ] + ], ], 'mode_id' => [ 'name' => 'mode_id', @@ -355,7 +355,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'batch_mode', 'optionEditPath' => 'civicrm/admin/options/batch_mode', - ] + ], ], 'total' => [ 'name' => 'total', @@ -405,7 +405,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ] + ], ], 'exported_date' => [ 'name' => 'exported_date', diff --git a/CRM/Batch/DAO/EntityBatch.php b/CRM/Batch/DAO/EntityBatch.php index a9ec632af093..5e0cb9ecb089 100644 --- a/CRM/Batch/DAO/EntityBatch.php +++ b/CRM/Batch/DAO/EntityBatch.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Batch/EntityBatch.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ad54978e70be59ea54b414bbb3131f2f) + * (GenCodeChecksum:12e2c6e8e3c0890f0531819aebcfc543) */ /** @@ -31,7 +31,7 @@ class CRM_Batch_DAO_EntityBatch extends CRM_Core_DAO { /** * primary key * - * @var int unsigned + * @var int */ public $id; @@ -45,14 +45,14 @@ class CRM_Batch_DAO_EntityBatch extends CRM_Core_DAO { /** * FK to entity table specified in entity_table column. * - * @var int unsigned + * @var int */ public $entity_id; /** * FK to civicrm_batch * - * @var int unsigned + * @var int */ public $batch_id; @@ -141,7 +141,7 @@ public static function &fields() { 'table' => 'civicrm_batch', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Campaign/BAO/Campaign.php b/CRM/Campaign/BAO/Campaign.php index 0d5ebe8cb5ba..c7a9f25e9d75 100644 --- a/CRM/Campaign/BAO/Campaign.php +++ b/CRM/Campaign/BAO/Campaign.php @@ -49,18 +49,18 @@ public static function create(&$params) { return NULL; } - if (!(CRM_Utils_Array::value('id', $params))) { + if (empty($params['id'])) { - if (!(CRM_Utils_Array::value('created_id', $params))) { + if (empty($params['created_id'])) { $session = CRM_Core_Session::singleton(); $params['created_id'] = $session->get('userID'); } - if (!(CRM_Utils_Array::value('created_date', $params))) { + if (empty($params['created_date'])) { $params['created_date'] = date('YmdHis'); } - if (!(CRM_Utils_Array::value('name', $params))) { + if (empty($params['name'])) { $params['name'] = CRM_Utils_String::titleToVar($params['title'], 64); } diff --git a/CRM/Campaign/DAO/Campaign.php b/CRM/Campaign/DAO/Campaign.php index dad2b00defec..2b9d02709512 100644 --- a/CRM/Campaign/DAO/Campaign.php +++ b/CRM/Campaign/DAO/Campaign.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Campaign/Campaign.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:c6ffa4ea926f3a52afc754bf44ef8586) + * (GenCodeChecksum:6df4e0d5c3320d87183db79f551d8c86) */ /** @@ -31,7 +31,7 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { /** * Unique Campaign ID. * - * @var int unsigned + * @var int */ public $id; @@ -73,14 +73,14 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { /** * Campaign Type ID.Implicit FK to civicrm_option_value where option_group = campaign_type * - * @var int unsigned + * @var int */ public $campaign_type_id; /** * Campaign status ID.Implicit FK to civicrm_option_value where option_group = campaign_status * - * @var int unsigned + * @var int */ public $status_id; @@ -94,21 +94,21 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { /** * Optional parent id for this Campaign. * - * @var int unsigned + * @var int */ public $parent_id; /** * Is this Campaign enabled or disabled/cancelled? * - * @var boolean + * @var bool */ public $is_active; /** * FK to civicrm_contact, who created this Campaign. * - * @var int unsigned + * @var int */ public $created_id; @@ -122,7 +122,7 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { /** * FK to civicrm_contact, who recently edited this Campaign. * - * @var int unsigned + * @var int */ public $last_modified_id; @@ -300,7 +300,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'campaign_type', 'optionEditPath' => 'civicrm/admin/options/campaign_type', - ] + ], ], 'status_id' => [ 'name' => 'status_id', @@ -321,7 +321,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'campaign_status', 'optionEditPath' => 'civicrm/admin/options/campaign_status', - ] + ], ], 'external_identifier' => [ 'name' => 'external_identifier', diff --git a/CRM/Campaign/DAO/CampaignGroup.php b/CRM/Campaign/DAO/CampaignGroup.php index 5c8ec894d4be..07f34d5fde29 100644 --- a/CRM/Campaign/DAO/CampaignGroup.php +++ b/CRM/Campaign/DAO/CampaignGroup.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Campaign/CampaignGroup.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9c9ee0c8ea79ddd0f680e8050693e5db) + * (GenCodeChecksum:c399857d6182b7d1dcc2f037518ba8c3) */ /** @@ -31,14 +31,14 @@ class CRM_Campaign_DAO_CampaignGroup extends CRM_Core_DAO { /** * Campaign Group id. * - * @var int unsigned + * @var int */ public $id; /** * Foreign key to the activity Campaign. * - * @var int unsigned + * @var int */ public $campaign_id; @@ -59,7 +59,7 @@ class CRM_Campaign_DAO_CampaignGroup extends CRM_Core_DAO { /** * Entity id of referenced table. * - * @var int unsigned + * @var int */ public $entity_id; @@ -123,7 +123,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'group_type' => [ 'name' => 'group_type', @@ -143,7 +143,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getCampaignGroupTypes', - ] + ], ], 'entity_table' => [ 'name' => 'entity_table', diff --git a/CRM/Campaign/DAO/Survey.php b/CRM/Campaign/DAO/Survey.php index 763fd2f71033..d013622630e2 100644 --- a/CRM/Campaign/DAO/Survey.php +++ b/CRM/Campaign/DAO/Survey.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Campaign/Survey.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:bf281972fa5b1efaa8801eb9a47e42ae) + * (GenCodeChecksum:ad39991f1177492db1fd47cbaacf676a) */ /** @@ -31,7 +31,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * Survey id. * - * @var int unsigned + * @var int */ public $id; @@ -45,14 +45,14 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * Foreign key to the Campaign. * - * @var int unsigned + * @var int */ public $campaign_id; /** * Implicit FK to civicrm_option_value where option_group = activity_type * - * @var int unsigned + * @var int */ public $activity_type_id; @@ -73,42 +73,42 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * Number of days for recurrence of release. * - * @var int unsigned + * @var int */ public $release_frequency; /** * Maximum number of contacts to allow for survey. * - * @var int unsigned + * @var int */ public $max_number_of_contacts; /** * Default number of contacts to allow for survey. * - * @var int unsigned + * @var int */ public $default_number_of_contacts; /** * Is this survey enabled or disabled/cancelled? * - * @var boolean + * @var bool */ public $is_active; /** * Is this default survey? * - * @var boolean + * @var bool */ public $is_default; /** * FK to civicrm_contact, who created this Survey. * - * @var int unsigned + * @var int */ public $created_id; @@ -122,7 +122,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * FK to civicrm_contact, who recently edited this Survey. * - * @var int unsigned + * @var int */ public $last_modified_id; @@ -136,14 +136,14 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * Used to store option group id. * - * @var int unsigned + * @var int */ public $result_id; /** * Bypass the email verification. * - * @var boolean + * @var bool */ public $bypass_confirm; @@ -164,7 +164,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * Can people share the petition through social media? * - * @var boolean + * @var bool */ public $is_share; @@ -245,7 +245,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'activity_type_id' => [ 'name' => 'activity_type_id', @@ -266,7 +266,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'activity_type', 'optionEditPath' => 'civicrm/admin/options/activity_type', - ] + ], ], 'recontact_interval' => [ 'name' => 'recontact_interval', diff --git a/CRM/Campaign/Form/Search.php b/CRM/Campaign/Form/Search.php index ab7569d01ef9..7d380334549a 100644 --- a/CRM/Campaign/Form/Search.php +++ b/CRM/Campaign/Form/Search.php @@ -46,14 +46,14 @@ class CRM_Campaign_Form_Search extends CRM_Core_Form_Search { /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Campaign/Selector/Search.php b/CRM/Campaign/Selector/Search.php index 1dc5c177b37f..7c22820e9bd3 100644 --- a/CRM/Campaign/Selector/Search.php +++ b/CRM/Campaign/Selector/Search.php @@ -76,14 +76,14 @@ class CRM_Campaign_Selector_Search extends CRM_Core_Selector_Base implements CRM /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Case/DAO/Case.php b/CRM/Case/DAO/Case.php index 2323c780c439..717b2b1bf1b9 100644 --- a/CRM/Case/DAO/Case.php +++ b/CRM/Case/DAO/Case.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Case/Case.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a9960d56bc697d6cbc5347f9bc6a78bc) + * (GenCodeChecksum:f7d3f0df9ce94aec00f5eb0e20cedd1e) */ /** @@ -31,14 +31,14 @@ class CRM_Case_DAO_Case extends CRM_Core_DAO { /** * Unique Case ID * - * @var int unsigned + * @var int */ public $id; /** * FK to civicrm_case_type.id * - * @var int unsigned + * @var int */ public $case_type_id; @@ -73,12 +73,12 @@ class CRM_Case_DAO_Case extends CRM_Core_DAO { /** * Id of case status. * - * @var int unsigned + * @var int */ public $status_id; /** - * @var boolean + * @var bool */ public $is_deleted; @@ -162,7 +162,7 @@ public static function &fields() { 'table' => 'civicrm_case_type', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'case_subject' => [ 'name' => 'subject', @@ -251,7 +251,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'case_status', 'optionEditPath' => 'civicrm/admin/options/case_status', - ] + ], ], 'case_deleted' => [ 'name' => 'is_deleted', diff --git a/CRM/Case/DAO/CaseActivity.php b/CRM/Case/DAO/CaseActivity.php index e6a9999b40b1..40b275fbf882 100644 --- a/CRM/Case/DAO/CaseActivity.php +++ b/CRM/Case/DAO/CaseActivity.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Case/CaseActivity.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:fd04fd5686de74febc915b1a035a3fb5) + * (GenCodeChecksum:cb7a73ba739c93a482d18ef28ed0c589) */ /** @@ -31,21 +31,21 @@ class CRM_Case_DAO_CaseActivity extends CRM_Core_DAO { /** * Unique case-activity association id * - * @var int unsigned + * @var int */ public $id; /** * Case ID of case-activity association. * - * @var int unsigned + * @var int */ public $case_id; /** * Activity ID of case-activity association. * - * @var int unsigned + * @var int */ public $activity_id; diff --git a/CRM/Case/DAO/CaseContact.php b/CRM/Case/DAO/CaseContact.php index 40b3e158cfcd..42a830d70315 100644 --- a/CRM/Case/DAO/CaseContact.php +++ b/CRM/Case/DAO/CaseContact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Case/CaseContact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ff0a0c29f836177de2ac856be6c5cb15) + * (GenCodeChecksum:84dae97091e4a1612c67274f5cb10531) */ /** @@ -31,21 +31,21 @@ class CRM_Case_DAO_CaseContact extends CRM_Core_DAO { /** * Unique case-contact association id * - * @var int unsigned + * @var int */ public $id; /** * Case ID of case-contact association. * - * @var int unsigned + * @var int */ public $case_id; /** * Contact ID of contact record given case belongs to. * - * @var int unsigned + * @var int */ public $contact_id; diff --git a/CRM/Case/DAO/CaseType.php b/CRM/Case/DAO/CaseType.php index 3a0b59404e20..533f0e03a335 100644 --- a/CRM/Case/DAO/CaseType.php +++ b/CRM/Case/DAO/CaseType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Case/CaseType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9ebd07607858eaf185b2be32744267bb) + * (GenCodeChecksum:317907ffe519c3f3eab8af9d8e9e1f7f) */ /** @@ -31,7 +31,7 @@ class CRM_Case_DAO_CaseType extends CRM_Core_DAO { /** * Autoincremented type id * - * @var int unsigned + * @var int */ public $id; @@ -59,14 +59,14 @@ class CRM_Case_DAO_CaseType extends CRM_Core_DAO { /** * Is this entry active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this case type a predefined system type? * - * @var boolean + * @var bool */ public $is_reserved; diff --git a/CRM/Case/Form/Search.php b/CRM/Case/Form/Search.php index 7aabdfe48958..1391393294c2 100644 --- a/CRM/Case/Form/Search.php +++ b/CRM/Case/Form/Search.php @@ -46,20 +46,20 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search { /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_limit = NULL; /** * Prefix for the controller - * @var sting + * @var string */ protected $_prefix = 'case_'; diff --git a/CRM/Case/Form/Task/Delete.php b/CRM/Case/Form/Task/Delete.php index d32a9300ea13..b963126ccff1 100644 --- a/CRM/Case/Form/Task/Delete.php +++ b/CRM/Case/Form/Task/Delete.php @@ -40,14 +40,14 @@ class CRM_Case_Form_Task_Delete extends CRM_Case_Form_Task { * Are we operating in "single mode", i.e. deleting one * specific case? * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we moving case to Trash. * - * @var boolean + * @var bool */ public $_moveToTrash = TRUE; diff --git a/CRM/Case/Form/Task/Restore.php b/CRM/Case/Form/Task/Restore.php index db78e81b73cc..8257943097c9 100644 --- a/CRM/Case/Form/Task/Restore.php +++ b/CRM/Case/Form/Task/Restore.php @@ -40,7 +40,7 @@ class CRM_Case_Form_Task_Restore extends CRM_Case_Form_Task { * Are we operating in "single mode", i.e. deleting one * specific case? * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Case/Selector/Search.php b/CRM/Case/Selector/Search.php index 8d63a8ea2923..5a4ab88c8e03 100644 --- a/CRM/Case/Selector/Search.php +++ b/CRM/Case/Selector/Search.php @@ -72,14 +72,14 @@ class CRM_Case_Selector_Search extends CRM_Core_Selector_Base { /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Case/XMLProcessor/Report.php b/CRM/Case/XMLProcessor/Report.php index 8224e22c1d6b..98534dc95ec8 100644 --- a/CRM/Case/XMLProcessor/Report.php +++ b/CRM/Case/XMLProcessor/Report.php @@ -35,7 +35,7 @@ class CRM_Case_XMLProcessor_Report extends CRM_Case_XMLProcessor { /** * The default variable defined. * - * @var boolean + * @var bool */ protected $_isRedact; diff --git a/CRM/Case/XMLRepository.php b/CRM/Case/XMLRepository.php index 252babe18a96..54011e77e3b9 100644 --- a/CRM/Case/XMLRepository.php +++ b/CRM/Case/XMLRepository.php @@ -43,12 +43,14 @@ class CRM_Case_XMLRepository { protected $xml = []; /** - * @var array|NULL + * @var array|null */ protected $hookCache = NULL; /** - * @var array|NULL symbolic names of case-types + * Symbolic names of case-types. + * + * @var array|null */ protected $allCaseTypes = NULL; diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index 7280f6d5c75b..5a22a86d7850 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -1736,7 +1736,7 @@ public static function &exportableFields($contactType = 'Individual', $status = * @return array * Contact details */ - public static function getHierContactDetails($contactId, &$fields) { + public static function getHierContactDetails($contactId, $fields) { $params = array(array('contact_id', '=', $contactId, 0, 0)); $options = array(); @@ -2073,7 +2073,7 @@ public static function createProfileContact( */ public static function formatProfileContactParams( &$params, - &$fields, + $fields, $contactID = NULL, $ufGroupId = NULL, $ctype = NULL, diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 0e08cb5ed921..82dab92b6175 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -213,28 +213,28 @@ class CRM_Contact_BAO_Query { /** * Are we in search mode. * - * @var boolean + * @var bool */ public $_search = TRUE; /** * Should we skip permission checking. * - * @var boolean + * @var bool */ public $_skipPermission = FALSE; /** * Should we skip adding of delete clause. * - * @var boolean + * @var bool */ public $_skipDeleteClause = FALSE; /** * Are we in strict mode (use equality over LIKE) * - * @var boolean + * @var bool */ public $_strict = FALSE; @@ -250,21 +250,21 @@ class CRM_Contact_BAO_Query { /** * Should we only search on primary location. * - * @var boolean + * @var bool */ public $_primaryLocation = TRUE; /** * Are contact ids part of the query. * - * @var boolean + * @var bool */ public $_includeContactIds = FALSE; /** * Should we use the smart group cache. * - * @var boolean + * @var bool */ public $_smartGroupCache = TRUE; @@ -286,7 +286,7 @@ class CRM_Contact_BAO_Query { * Should we enable the distinct clause, used if we are including * more than one group * - * @var boolean + * @var bool */ public $_useDistinct = FALSE; @@ -402,8 +402,9 @@ class CRM_Contact_BAO_Query { */ protected $_rangeCache = []; /** - * Set to true when $this->relationship is run to avoid adding twice - * @var Boolean + * Set to true when $this->relationship is run to avoid adding twice. + * + * @var bool */ protected $_relationshipValuesAdded = FALSE; diff --git a/CRM/Contact/DAO/ACLContactCache.php b/CRM/Contact/DAO/ACLContactCache.php index 456ca8634865..1134bf2a1c99 100644 --- a/CRM/Contact/DAO/ACLContactCache.php +++ b/CRM/Contact/DAO/ACLContactCache.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/ACLContactCache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ab40fa26e037ef4897359d3c288d42b8) + * (GenCodeChecksum:8bc987e1284d464f9b475686d9dc32a2) */ /** @@ -31,21 +31,21 @@ class CRM_Contact_DAO_ACLContactCache extends CRM_Core_DAO { /** * primary key * - * @var int unsigned + * @var int */ public $id; /** * FK to civicrm_contact (could be null for anon user) * - * @var int unsigned + * @var int */ public $user_id; /** * FK to civicrm_contact * - * @var int unsigned + * @var int */ public $contact_id; @@ -141,7 +141,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_ACL_BAO_ACL::operation', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Contact/DAO/Contact.php b/CRM/Contact/DAO/Contact.php index 736dffa2f7e5..42d53e908a54 100644 --- a/CRM/Contact/DAO/Contact.php +++ b/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:653579cbfa509d67ae7a39c78dd27bf2) + * (GenCodeChecksum:8c2ea7bf40921f9f29eef33d717fd760) */ /** @@ -31,7 +31,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { /** * Unique Contact ID * - * @var int unsigned + * @var int */ public $id; @@ -50,34 +50,34 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { public $contact_sub_type; /** - * @var boolean + * @var bool */ public $do_not_email; /** - * @var boolean + * @var bool */ public $do_not_phone; /** - * @var boolean + * @var bool */ public $do_not_mail; /** - * @var boolean + * @var bool */ public $do_not_sms; /** - * @var boolean + * @var bool */ public $do_not_trade; /** * Has the contact opted out from receiving all bulk email from the organization or site domain? * - * @var boolean + * @var bool */ public $is_opt_out; @@ -196,14 +196,14 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { /** * Prefix or Title for name (Ms, Mr...). FK to prefix ID * - * @var int unsigned + * @var int */ public $prefix_id; /** * Suffix for name (Jr, Sr...). FK to suffix ID * - * @var int unsigned + * @var int */ public $suffix_id; @@ -217,14 +217,14 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { /** * Communication style (e.g. formal vs. familiar) to use with this contact. FK to communication styles in civicrm_option_value. * - * @var int unsigned + * @var int */ public $communication_style_id; /** * FK to civicrm_option_value.id, that has to be valid registered Email Greeting. * - * @var int unsigned + * @var int */ public $email_greeting_id; @@ -245,7 +245,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { /** * FK to civicrm_option_value.id, that has to be valid registered Postal Greeting. * - * @var int unsigned + * @var int */ public $postal_greeting_id; @@ -266,7 +266,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { /** * FK to civicrm_option_value.id, that has to be valid registered Addressee. * - * @var int unsigned + * @var int */ public $addressee_id; @@ -294,7 +294,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { /** * FK to gender ID * - * @var int unsigned + * @var int */ public $gender_id; @@ -306,7 +306,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { public $birth_date; /** - * @var boolean + * @var bool */ public $is_deceased; @@ -327,7 +327,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { /** * Optional FK to Primary Contact for this household. * - * @var int unsigned + * @var int */ public $primary_contact_id; @@ -355,12 +355,12 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { /** * OPTIONAL FK to civicrm_contact record. * - * @var int unsigned + * @var int */ public $employer_id; /** - * @var boolean + * @var bool */ public $is_deleted; @@ -446,7 +446,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ] + ], ], 'contact_sub_type' => [ 'name' => 'contact_sub_type', @@ -472,7 +472,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NOT NULL', - ] + ], ], 'do_not_email' => [ 'name' => 'do_not_email', @@ -735,7 +735,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'preferred_communication_method', 'optionEditPath' => 'civicrm/admin/options/preferred_communication_method', - ] + ], ], 'preferred_language' => [ 'name' => 'preferred_language', @@ -759,7 +759,7 @@ public static function &fields() { 'optionGroupName' => 'languages', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/languages', - ] + ], ], 'preferred_mail_format' => [ 'name' => 'preferred_mail_format', @@ -782,7 +782,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::pmf', - ] + ], ], 'hash' => [ 'name' => 'hash', @@ -806,6 +806,7 @@ public static function &fields() { 'maxlength' => 32, 'size' => CRM_Utils_Type::MEDIUM, 'where' => 'civicrm_contact.api_key', + 'protected' => 'true', 'table_name' => 'civicrm_contact', 'entity' => 'Contact', 'bao' => 'CRM_Contact_BAO_Contact', @@ -910,7 +911,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'individual_prefix', 'optionEditPath' => 'civicrm/admin/options/individual_prefix', - ] + ], ], 'suffix_id' => [ 'name' => 'suffix_id', @@ -932,7 +933,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'individual_suffix', 'optionEditPath' => 'civicrm/admin/options/individual_suffix', - ] + ], ], 'formal_title' => [ 'name' => 'formal_title', @@ -970,7 +971,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'communication_style', 'optionEditPath' => 'civicrm/admin/options/communication_style', - ] + ], ], 'email_greeting_id' => [ 'name' => 'email_greeting_id', @@ -986,7 +987,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'email_greeting', 'optionEditPath' => 'civicrm/admin/options/email_greeting', - ] + ], ], 'email_greeting_custom' => [ 'name' => 'email_greeting_custom', @@ -1039,7 +1040,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'postal_greeting', 'optionEditPath' => 'civicrm/admin/options/postal_greeting', - ] + ], ], 'postal_greeting_custom' => [ 'name' => 'postal_greeting_custom', @@ -1089,7 +1090,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'addressee', 'optionEditPath' => 'civicrm/admin/options/addressee', - ] + ], ], 'addressee_custom' => [ 'name' => 'addressee_custom', @@ -1164,7 +1165,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'gender', 'optionEditPath' => 'civicrm/admin/options/gender', - ] + ], ], 'birth_date' => [ 'name' => 'birth_date', diff --git a/CRM/Contact/DAO/ContactType.php b/CRM/Contact/DAO/ContactType.php index f76bbaab4cf3..a999b9d40292 100644 --- a/CRM/Contact/DAO/ContactType.php +++ b/CRM/Contact/DAO/ContactType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/ContactType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ab123a55d492c003df354c32e8b9863c) + * (GenCodeChecksum:adba53a6a4d64ba498d7e36b03c0f968) */ /** @@ -31,7 +31,7 @@ class CRM_Contact_DAO_ContactType extends CRM_Core_DAO { /** * Contact Type ID * - * @var int unsigned + * @var int */ public $id; @@ -66,21 +66,21 @@ class CRM_Contact_DAO_ContactType extends CRM_Core_DAO { /** * Optional FK to parent contact type. * - * @var int unsigned + * @var int */ public $parent_id; /** * Is this entry active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this contact type a predefined system type * - * @var boolean + * @var bool */ public $is_reserved; @@ -198,7 +198,7 @@ public static function &fields() { 'keyColumn' => 'id', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ] + ], ], 'is_active' => [ 'name' => 'is_active', diff --git a/CRM/Contact/DAO/DashboardContact.php b/CRM/Contact/DAO/DashboardContact.php index 4585ec169af0..edb5b3e3528b 100644 --- a/CRM/Contact/DAO/DashboardContact.php +++ b/CRM/Contact/DAO/DashboardContact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/DashboardContact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:f9be53bdf3d5151edf77e9b9f9004571) + * (GenCodeChecksum:2adb5645722410e9059da0a345a0a30b) */ /** @@ -29,35 +29,35 @@ class CRM_Contact_DAO_DashboardContact extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * Dashboard ID * - * @var int unsigned + * @var int */ public $dashboard_id; /** * Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * column no for this widget * - * @var boolean + * @var bool */ public $column_no; /** * Is this widget active? * - * @var boolean + * @var bool */ public $is_active; diff --git a/CRM/Contact/DAO/Group.php b/CRM/Contact/DAO/Group.php index 71b28d336732..3e2eddaf1f04 100644 --- a/CRM/Contact/DAO/Group.php +++ b/CRM/Contact/DAO/Group.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Group.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:21b3e21494b0831994f860083cd82e24) + * (GenCodeChecksum:28c32e7038a2b7aa7ca2c45117660974) */ /** @@ -31,7 +31,7 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO { /** * Group ID * - * @var int unsigned + * @var int */ public $id; @@ -66,14 +66,14 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO { /** * FK to saved search table. * - * @var int unsigned + * @var int */ public $saved_search_id; /** * Is this entry active? * - * @var boolean + * @var bool */ public $is_active; @@ -143,26 +143,26 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO { /** * Is this group hidden? * - * @var boolean + * @var bool */ public $is_hidden; /** - * @var boolean + * @var bool */ public $is_reserved; /** * FK to contact table. * - * @var int unsigned + * @var int */ public $created_id; /** * FK to contact table. * - * @var int unsigned + * @var int */ public $modified_id; @@ -310,7 +310,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupVisibility', - ] + ], ], 'where_clause' => [ 'name' => 'where_clause', @@ -363,7 +363,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'group_type', 'optionEditPath' => 'civicrm/admin/options/group_type', - ] + ], ], 'cache_date' => [ 'name' => 'cache_date', @@ -402,7 +402,7 @@ public static function &fields() { 'serialize' => self::SERIALIZE_COMMA, 'pseudoconstant' => [ 'callback' => 'CRM_Core_PseudoConstant::allGroup', - ] + ], ], 'children' => [ 'name' => 'children', diff --git a/CRM/Contact/DAO/GroupContact.php b/CRM/Contact/DAO/GroupContact.php index 8980f8c8bf9d..ba7352ccf192 100644 --- a/CRM/Contact/DAO/GroupContact.php +++ b/CRM/Contact/DAO/GroupContact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/GroupContact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:1d229cf09854f6b9a9991a0c0bd86c87) + * (GenCodeChecksum:abb2a96c7fd72f93619b605fbb11b4b5) */ /** @@ -31,21 +31,21 @@ class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO { /** * primary key * - * @var int unsigned + * @var int */ public $id; /** * FK to civicrm_group * - * @var int unsigned + * @var int */ public $group_id; /** * FK to civicrm_contact * - * @var int unsigned + * @var int */ public $contact_id; @@ -59,14 +59,14 @@ class CRM_Contact_DAO_GroupContact extends CRM_Core_DAO { /** * Optional location to associate with this membership * - * @var int unsigned + * @var int */ public $location_id; /** * Optional email to associate with this membership * - * @var int unsigned + * @var int */ public $email_id; @@ -135,7 +135,7 @@ public static function &fields() { 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'contact_id' => [ 'name' => 'contact_id', @@ -167,7 +167,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupContactStatus', - ] + ], ], 'location_id' => [ 'name' => 'location_id', diff --git a/CRM/Contact/DAO/GroupContactCache.php b/CRM/Contact/DAO/GroupContactCache.php index 0370dcc98c19..c6697590c45e 100644 --- a/CRM/Contact/DAO/GroupContactCache.php +++ b/CRM/Contact/DAO/GroupContactCache.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/GroupContactCache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:98cff858204d34551eec0b9bee6e24af) + * (GenCodeChecksum:217f20fad2d47f50e3a9c43b62df2c17) */ /** @@ -31,21 +31,21 @@ class CRM_Contact_DAO_GroupContactCache extends CRM_Core_DAO { /** * primary key * - * @var int unsigned + * @var int */ public $id; /** * FK to civicrm_group * - * @var int unsigned + * @var int */ public $group_id; /** * FK to civicrm_contact * - * @var int unsigned + * @var int */ public $contact_id; @@ -112,7 +112,7 @@ public static function &fields() { 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'contact_id' => [ 'name' => 'contact_id', diff --git a/CRM/Contact/DAO/GroupNesting.php b/CRM/Contact/DAO/GroupNesting.php index e2d83582c81d..bbc3cf993668 100644 --- a/CRM/Contact/DAO/GroupNesting.php +++ b/CRM/Contact/DAO/GroupNesting.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/GroupNesting.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:dcf20d8789668c4542bc0c5d5faa1e8e) + * (GenCodeChecksum:2559ff6c3da8f02b147577a6d4e26004) */ /** @@ -31,21 +31,21 @@ class CRM_Contact_DAO_GroupNesting extends CRM_Core_DAO { /** * Relationship ID * - * @var int unsigned + * @var int */ public $id; /** * ID of the child group * - * @var int unsigned + * @var int */ public $child_group_id; /** * ID of the parent group * - * @var int unsigned + * @var int */ public $parent_group_id; diff --git a/CRM/Contact/DAO/GroupOrganization.php b/CRM/Contact/DAO/GroupOrganization.php index b16db55d397c..d35db86708f7 100644 --- a/CRM/Contact/DAO/GroupOrganization.php +++ b/CRM/Contact/DAO/GroupOrganization.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/GroupOrganization.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:4234ea5a60e2a053e2de768a10cb1488) + * (GenCodeChecksum:00717d9edb0719d380b5fd7c3e91bc74) */ /** @@ -31,21 +31,21 @@ class CRM_Contact_DAO_GroupOrganization extends CRM_Core_DAO { /** * Relationship ID * - * @var int unsigned + * @var int */ public $id; /** * ID of the group * - * @var int unsigned + * @var int */ public $group_id; /** * ID of the Organization Contact * - * @var int unsigned + * @var int */ public $organization_id; @@ -112,7 +112,7 @@ public static function &fields() { 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'organization_id' => [ 'name' => 'organization_id', diff --git a/CRM/Contact/DAO/Relationship.php b/CRM/Contact/DAO/Relationship.php index f6dcce482c6e..0eb497e53b38 100644 --- a/CRM/Contact/DAO/Relationship.php +++ b/CRM/Contact/DAO/Relationship.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Relationship.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:0722d901c4eac4e462bc7de9887e605a) + * (GenCodeChecksum:ebfcea88ae4bd09a0821a942ecdfa4db) */ /** @@ -31,28 +31,28 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO { /** * Relationship ID * - * @var int unsigned + * @var int */ public $id; /** * id of the first contact * - * @var int unsigned + * @var int */ public $contact_id_a; /** * id of the second contact * - * @var int unsigned + * @var int */ public $contact_id_b; /** * id of the relationship * - * @var int unsigned + * @var int */ public $relationship_type_id; @@ -73,7 +73,7 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO { /** * is the relationship active ? * - * @var boolean + * @var bool */ public $is_active; @@ -87,21 +87,21 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO { /** * Permission that Contact A has to view/update Contact B * - * @var int unsigned + * @var int */ public $is_permission_a_b; /** * Permission that Contact B has to view/update Contact A * - * @var int unsigned + * @var int */ public $is_permission_b_a; /** * FK to civicrm_case * - * @var int unsigned + * @var int */ public $case_id; @@ -274,7 +274,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getPermissionedRelationshipOptions', - ] + ], ], 'is_permission_b_a' => [ 'name' => 'is_permission_b_a', @@ -293,7 +293,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getPermissionedRelationshipOptions', - ] + ], ], 'case_id' => [ 'name' => 'case_id', diff --git a/CRM/Contact/DAO/RelationshipType.php b/CRM/Contact/DAO/RelationshipType.php index 7a3a77e310bf..7b956aa92324 100644 --- a/CRM/Contact/DAO/RelationshipType.php +++ b/CRM/Contact/DAO/RelationshipType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/RelationshipType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9fa07d6d85caa27a637694324ea5b740) + * (GenCodeChecksum:4c5acf774814091e403962a994b6c78e) */ /** @@ -31,7 +31,7 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO { /** * Primary key * - * @var int unsigned + * @var int */ public $id; @@ -101,14 +101,14 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO { /** * Is this relationship type a predefined system type (can not be changed or de-activated)? * - * @var boolean + * @var bool */ public $is_reserved; /** * Is this relationship type currently active (i.e. can be used when creating or editing relationships)? * - * @var boolean + * @var bool */ public $is_active; @@ -234,7 +234,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ] + ], ], 'contact_type_b' => [ 'name' => 'contact_type_b', @@ -256,7 +256,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ] + ], ], 'contact_sub_type_a' => [ 'name' => 'contact_sub_type_a', @@ -279,7 +279,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NOT NULL', - ] + ], ], 'contact_sub_type_b' => [ 'name' => 'contact_sub_type_b', @@ -302,7 +302,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NOT NULL', - ] + ], ], 'is_reserved' => [ 'name' => 'is_reserved', diff --git a/CRM/Contact/DAO/SavedSearch.php b/CRM/Contact/DAO/SavedSearch.php index b7fd62c31a36..32eab9829360 100644 --- a/CRM/Contact/DAO/SavedSearch.php +++ b/CRM/Contact/DAO/SavedSearch.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/SavedSearch.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ff337d9810d6c4d6225f77b6b3007729) + * (GenCodeChecksum:556322817dc9b7b9dab015e1f0179fb7) */ /** @@ -31,7 +31,7 @@ class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO { /** * Saved Search ID * - * @var int unsigned + * @var int */ public $id; @@ -45,14 +45,14 @@ class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO { /** * Foreign key to civicrm_mapping used for saved search-builder searches. * - * @var int unsigned + * @var int */ public $mapping_id; /** * Foreign key to civicrm_option value table used for saved custom searches. * - * @var int unsigned + * @var int */ public $search_custom_id; diff --git a/CRM/Contact/DAO/SubscriptionHistory.php b/CRM/Contact/DAO/SubscriptionHistory.php index 1df68f7f3356..dd16bbcd6498 100644 --- a/CRM/Contact/DAO/SubscriptionHistory.php +++ b/CRM/Contact/DAO/SubscriptionHistory.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/SubscriptionHistory.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:8051a666011690a9dfb14d91a013a3e0) + * (GenCodeChecksum:af7ac35767e88f1dd090f54ab44c3b35) */ /** @@ -31,21 +31,21 @@ class CRM_Contact_DAO_SubscriptionHistory extends CRM_Core_DAO { /** * Internal Id * - * @var int unsigned + * @var int */ public $id; /** * Contact Id * - * @var int unsigned + * @var int */ public $contact_id; /** * Group Id * - * @var int unsigned + * @var int */ public $group_id; @@ -152,7 +152,7 @@ public static function &fields() { 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'date' => [ 'name' => 'date', @@ -184,7 +184,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getSubscriptionHistoryMethods', - ] + ], ], 'status' => [ 'name' => 'status', @@ -200,7 +200,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupContactStatus', - ] + ], ], 'tracking' => [ 'name' => 'tracking', diff --git a/CRM/Contact/Form/Task/Delete.php b/CRM/Contact/Form/Task/Delete.php index 3411f67d05f0..b1f0160902ae 100644 --- a/CRM/Contact/Form/Task/Delete.php +++ b/CRM/Contact/Form/Task/Delete.php @@ -42,7 +42,7 @@ class CRM_Contact_Form_Task_Delete extends CRM_Contact_Form_Task { * Are we operating in "single mode", i.e. sending email to one * specific contact? * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Contact/Form/Task/Email.php b/CRM/Contact/Form/Task/Email.php index d8dd851e3349..60c38d3e7160 100644 --- a/CRM/Contact/Form/Task/Email.php +++ b/CRM/Contact/Form/Task/Email.php @@ -41,7 +41,7 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task { * * Single mode means sending email to one specific contact. * - * @var boolean + * @var bool */ public $_single = FALSE; @@ -49,7 +49,7 @@ class CRM_Contact_Form_Task_Email extends CRM_Contact_Form_Task { * Are we operating in "single mode", i.e. sending email to one * specific contact? * - * @var boolean + * @var bool */ public $_noEmails = FALSE; diff --git a/CRM/Contact/Form/Task/Map.php b/CRM/Contact/Form/Task/Map.php index 82e1af323efa..89c52caf3b33 100644 --- a/CRM/Contact/Form/Task/Map.php +++ b/CRM/Contact/Form/Task/Map.php @@ -42,7 +42,7 @@ class CRM_Contact_Form_Task_Map extends CRM_Contact_Form_Task { * Are we operating in "single mode", i.e. mapping address to one * specific contact? * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Contact/Form/Task/SMS.php b/CRM/Contact/Form/Task/SMS.php index 113c763cd218..b6a13f6cbc89 100644 --- a/CRM/Contact/Form/Task/SMS.php +++ b/CRM/Contact/Form/Task/SMS.php @@ -40,7 +40,7 @@ class CRM_Contact_Form_Task_SMS extends CRM_Contact_Form_Task { * Are we operating in "single mode", i.e. sending sms to one * specific contact? * - * @var boolean + * @var bool */ public $_single = FALSE; diff --git a/CRM/Contact/Import/Field.php b/CRM/Contact/Import/Field.php index a1abc023439e..9d6b2d8fa398 100644 --- a/CRM/Contact/Import/Field.php +++ b/CRM/Contact/Import/Field.php @@ -55,7 +55,7 @@ class CRM_Contact_Import_Field { /** * Is this field required - * @var boolean + * @var bool */ public $_required; diff --git a/CRM/Contact/Page/DedupeFind.php b/CRM/Contact/Page/DedupeFind.php index 56eba2c9846b..8b22a7140d92 100644 --- a/CRM/Contact/Page/DedupeFind.php +++ b/CRM/Contact/Page/DedupeFind.php @@ -182,7 +182,7 @@ public function run() { CRM_Dedupe_Merger::resetMergeStats($cacheKeyString); } - $this->_mainContacts = CRM_Dedupe_Merger::getDuplicatePairs($rgid, $gid, !$isConflictMode, 0, $this->isSelected(), '', $isConflictMode, $criteria, TRUE, $limit); + $this->_mainContacts = CRM_Dedupe_Merger::getDuplicatePairs($rgid, $gid, !$isConflictMode, 0, $this->isSelected(), $isConflictMode, $criteria, TRUE, $limit); if (empty($this->_mainContacts)) { if ($isConflictMode) { diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index d5f7a0b76e0c..6b7ae24cf49d 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -55,9 +55,10 @@ class CRM_Contribute_BAO_Contribution extends CRM_Contribute_DAO_Contribution { /** * Field for all the objects related to this contribution + * * @var array of objects (e.g membership object, participant object) */ - public $_relatedObjects = array(); + public $_relatedObjects = []; /** * Field for the component - either 'event' (participant) or 'contribute' @@ -99,26 +100,27 @@ public function __construct() { * * @return \CRM_Contribute_BAO_Contribution * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ - public static function add(&$params, $ids = array()) { + public static function add(&$params, $ids = []) { if (empty($params)) { return NULL; } //per http://wiki.civicrm.org/confluence/display/CRM/Database+layer we are moving away from $ids array $contributionID = CRM_Utils_Array::value('contribution', $ids, CRM_Utils_Array::value('id', $params)); - $duplicates = array(); + $duplicates = []; if (self::checkDuplicate($params, $duplicates, $contributionID)) { $message = ts("Duplicate error - existing contribution record(s) have a matching Transaction ID or Invoice ID. Contribution record ID(s) are: " . implode(', ', $duplicates)); throw new CRM_Core_Exception($message); } // first clean up all the money fields - $moneyFields = array( + $moneyFields = [ 'total_amount', 'net_amount', 'fee_amount', 'non_deductible_amount', - ); + ]; //if priceset is used, no need to cleanup money if (!empty($params['skipCleanMoney'])) { @@ -161,12 +163,15 @@ public static function add(&$params, $ids = array()) { else { // Since the fee amount is expecting this (later on) ensure it is always set. // It would only not be set for an update where it is unchanged. - $params['contribution_status_id'] = civicrm_api3('Contribution', 'getvalue', array('id' => $contributionID, 'return' => 'contribution_status_id')); + $params['contribution_status_id'] = civicrm_api3('Contribution', 'getvalue', [ + 'id' => $contributionID, + 'return' => 'contribution_status_id', + ]); } if (!$contributionID && CRM_Utils_Array::value('membership_id', $params) - && self::checkContributeSettings('deferred_revenue_enabled') + && Civi::settings()->get('deferred_revenue_enabled') ) { $memberStartDate = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_Membership', $params['membership_id'], 'start_date'); if ($memberStartDate) { @@ -287,15 +292,16 @@ public static function isUpdateToRecurringContribution($params) { /** * Get defaults for new entity. + * * @return array */ public static function getDefaults() { - return array( + return [ 'payment_instrument_id' => key(CRM_Core_OptionGroup::values('payment_instrument', - FALSE, FALSE, FALSE, 'AND is_default = 1') + FALSE, FALSE, FALSE, 'AND is_default = 1') ), - 'contribution_status_id' => CRM_Core_Pseudoconstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'), - ); + 'contribution_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'), + ]; } /** @@ -348,7 +354,7 @@ public static function getValues($params, &$values, &$ids) { * @throws CRM_Core_Exception */ public static function getValuesWithMappings($params) { - $values = $ids = array(); + $values = $ids = []; $contribution = self::getValues($params, $values, $ids); if (is_null($contribution)) { throw new CRM_Core_Exception('No contribution found'); @@ -387,10 +393,10 @@ public static function calculateMissingAmountParams(&$params, $contributionID) { if (isset($params['fee_amount']) || isset($params['total_amount'])) { // We have an existing contribution and fee_amount or total_amount has been passed in but not net_amount. // net_amount may need adjusting. - $contribution = civicrm_api3('Contribution', 'getsingle', array( + $contribution = civicrm_api3('Contribution', 'getsingle', [ 'id' => $contributionID, - 'return' => array('total_amount', 'net_amount', 'fee_amount'), - )); + 'return' => ['total_amount', 'net_amount', 'fee_amount'], + ]); $totalAmount = isset($params['total_amount']) ? $params['total_amount'] : CRM_Utils_Array::value('total_amount', $contribution); $feeAmount = isset($params['fee_amount']) ? $params['fee_amount'] : CRM_Utils_Array::value('fee_amount', $contribution); $params['net_amount'] = $totalAmount - $feeAmount; @@ -407,16 +413,16 @@ public static function calculateMissingAmountParams(&$params, $contributionID) { */ protected static function getBillingAddressParams($params, $billingLocationTypeID) { $hasBillingField = FALSE; - $billingFields = array( + $billingFields = [ 'street_address', 'city', 'state_province_id', 'postal_code', 'country_id', - ); + ]; //build address array - $addressParams = array(); + $addressParams = []; $addressParams['location_type_id'] = $billingLocationTypeID; $addressParams['is_billing'] = 1; @@ -431,7 +437,7 @@ protected static function getBillingAddressParams($params, $billingLocationTypeI $hasBillingField = TRUE; } } - return array($hasBillingField, $addressParams); + return [$hasBillingField, $addressParams]; } /** @@ -452,7 +458,7 @@ public static function getPaymentProcessorReadyAddressParams($params, $billingLo $addressParams[substr($name, 9)] = $addressParams[$field]; } } - return array($hasBillingField, $addressParams); + return [$hasBillingField, $addressParams]; } /** @@ -472,7 +478,7 @@ public function getNumTermsByContributionAndMembershipType($membershipTypeID, $c SELECT membership_num_terms FROM civicrm_line_item li LEFT JOIN civicrm_price_field_value v ON li.price_field_value_id = v.id WHERE contribution_id = %1 AND membership_type_id = %2", - array(1 => array($contributionID, 'Integer'), 2 => array($membershipTypeID, 'Integer')) + [1 => [$contributionID, 'Integer'], 2 => [$membershipTypeID, 'Integer']] ); // default of 1 is precautionary return empty($numTerms) ? 1 : $numTerms; @@ -488,8 +494,14 @@ public function getNumTermsByContributionAndMembershipType($membershipTypeID, $c * * @return CRM_Contribute_BAO_Contribution */ - public static function create(&$params, $ids = array()) { - $dateFields = array('receive_date', 'cancel_date', 'receipt_date', 'thankyou_date', 'revenue_recognition_date'); + public static function create(&$params, $ids = []) { + $dateFields = [ + 'receive_date', + 'cancel_date', + 'receipt_date', + 'thankyou_date', + 'revenue_recognition_date', + ]; foreach ($dateFields as $df) { if (isset($params[$df])) { $params[$df] = CRM_Utils_Date::isoToMysql($params[$df]); @@ -517,13 +529,13 @@ public static function create(&$params, $ids = array()) { $session = CRM_Core_Session::singleton(); if (!empty($params['note'])) { - $noteParams = array( + $noteParams = [ 'entity_table' => 'civicrm_contribution', 'note' => $params['note'], 'entity_id' => $contribution->id, 'contact_id' => $session->get('userID'), 'modified_date' => date('Ymd'), - ); + ]; if (!$noteParams['contact_id']) { $noteParams['contact_id'] = $params['contact_id']; } @@ -533,12 +545,12 @@ public static function create(&$params, $ids = array()) { // make entry in batch entity batch table if (!empty($params['batch_id'])) { // in some update cases we need to get extra fields - ie an update that doesn't pass in all these params - $titleFields = array( + $titleFields = [ 'contact_id', 'total_amount', 'currency', 'financial_type_id', - ); + ]; $retrieveRequired = 0; foreach ($titleFields as $titleField) { if (!isset($contribution->$titleField)) { @@ -555,13 +567,13 @@ public static function create(&$params, $ids = array()) { $transaction->commit(); - $activity = civicrm_api3('Activity', 'get', array( + $activity = civicrm_api3('Activity', 'get', [ 'source_record_id' => $contribution->id, - 'options' => array('limit' => 1), + 'options' => ['limit' => 1], 'sequential' => 1, 'activity_type_id' => 'Contribution', - 'return' => array('id', 'campaign'), - )); + 'return' => ['id', 'campaign'], + ]); //CRM-18406: Update activity when edit contribution. if ($activity['count']) { @@ -582,12 +594,12 @@ public static function create(&$params, $ids = array()) { "action=view&reset=1&id={$contribution->id}&cid={$contribution->contact_id}&context=home" ); // in some update cases we need to get extra fields - ie an update that doesn't pass in all these params - $titleFields = array( + $titleFields = [ 'contact_id', 'total_amount', 'currency', 'financial_type_id', - ); + ]; $retrieveRequired = 0; foreach ($titleFields as $titleField) { if (!isset($contribution->$titleField)) { @@ -601,7 +613,7 @@ public static function create(&$params, $ids = array()) { $financialType = CRM_Contribute_PseudoConstant::financialType($contribution->financial_type_id); $title = CRM_Contact_BAO_Contact::displayName($contribution->contact_id) . ' - (' . CRM_Utils_Money::format($contribution->total_amount, $contribution->currency) . ' ' . ' - ' . $financialType . ')'; - $recentOther = array(); + $recentOther = []; if (CRM_Core_Permission::checkActionPermission('CiviContribute', CRM_Core_Action::UPDATE)) { $recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/contribution', "action=update&reset=1&id={$contribution->id}&cid={$contribution->contact_id}&context=home" @@ -714,14 +726,14 @@ public static function retrieve(&$params, &$defaults, &$ids) { public static function &importableFields($contactType = 'Individual', $status = TRUE) { if (!self::$_importableFields) { if (!self::$_importableFields) { - self::$_importableFields = array(); + self::$_importableFields = []; } if (!$status) { - $fields = array('' => array('title' => ts('- do not import -'))); + $fields = ['' => ['title' => ts('- do not import -')]]; } else { - $fields = array('' => array('title' => ts('- Contribution Fields -'))); + $fields = ['' => ['title' => ts('- Contribution Fields -')]]; } $note = CRM_Core_DAO_Note::import(); @@ -731,12 +743,12 @@ public static function &importableFields($contactType = 'Individual', $status = $contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL); // Using new Dedupe rule. - $ruleParams = array( + $ruleParams = [ 'contact_type' => $contactType, 'used' => 'Unsupervised', - ); + ]; $fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams); - $tmpContactField = array(); + $tmpContactField = []; if (is_array($fieldsArray)) { foreach ($fieldsArray as $value) { //skip if there is no dupe rule @@ -785,7 +797,7 @@ public static function &importableFields($contactType = 'Individual', $status = public static function &exportableFields($checkPermission = TRUE) { if (!self::$_exportableFields) { if (!self::$_exportableFields) { - self::$_exportableFields = array(); + self::$_exportableFields = []; } $fields = CRM_Contribute_DAO_Contribution::export(); @@ -808,70 +820,70 @@ public static function &exportableFields($checkPermission = TRUE) { $financialAccount = CRM_Financial_DAO_FinancialAccount::export(); - $contributionPage = array( - 'contribution_page' => array( + $contributionPage = [ + 'contribution_page' => [ 'title' => ts('Contribution Page'), 'name' => 'contribution_page', 'where' => 'civicrm_contribution_page.title', 'data_type' => CRM_Utils_Type::T_STRING, - ), - ); + ], + ]; - $contributionNote = array( - 'contribution_note' => array( + $contributionNote = [ + 'contribution_note' => [ 'title' => ts('Contribution Note'), 'name' => 'contribution_note', 'data_type' => CRM_Utils_Type::T_TEXT, - ), - ); + ], + ]; - $extraFields = array( - 'contribution_batch' => array( + $extraFields = [ + 'contribution_batch' => [ 'title' => ts('Batch Name'), - ), - ); + ], + ]; // CRM-17787 - $campaignTitle = array( - 'contribution_campaign_title' => array( + $campaignTitle = [ + 'contribution_campaign_title' => [ 'title' => ts('Campaign Title'), 'name' => 'campaign_title', 'where' => 'civicrm_campaign.title', 'data_type' => CRM_Utils_Type::T_STRING, - ), - ); - $softCreditFields = array( - 'contribution_soft_credit_name' => array( + ], + ]; + $softCreditFields = [ + 'contribution_soft_credit_name' => [ 'name' => 'contribution_soft_credit_name', 'title' => ts('Soft Credit For'), 'where' => 'civicrm_contact_d.display_name', 'data_type' => CRM_Utils_Type::T_STRING, - ), - 'contribution_soft_credit_amount' => array( + ], + 'contribution_soft_credit_amount' => [ 'name' => 'contribution_soft_credit_amount', 'title' => ts('Soft Credit Amount'), 'where' => 'civicrm_contribution_soft.amount', 'data_type' => CRM_Utils_Type::T_MONEY, - ), - 'contribution_soft_credit_type' => array( + ], + 'contribution_soft_credit_type' => [ 'name' => 'contribution_soft_credit_type', 'title' => ts('Soft Credit Type'), 'where' => 'contribution_softcredit_type.label', 'data_type' => CRM_Utils_Type::T_STRING, - ), - 'contribution_soft_credit_contribution_id' => array( + ], + 'contribution_soft_credit_contribution_id' => [ 'name' => 'contribution_soft_credit_contribution_id', 'title' => ts('Soft Credit For Contribution ID'), 'where' => 'civicrm_contribution_soft.contribution_id', 'data_type' => CRM_Utils_Type::T_INT, - ), - 'contribution_soft_credit_contact_id' => array( + ], + 'contribution_soft_credit_contact_id' => [ 'name' => 'contribution_soft_credit_contact_id', 'title' => ts('Soft Credit For Contact ID'), 'where' => 'civicrm_contact_d.id', 'data_type' => CRM_Utils_Type::T_INT, - ), - ); + ], + ]; $fields = array_merge($fields, $contributionPage, $contributionNote, $extraFields, $softCreditFields, $financialAccount, $campaignTitle, @@ -986,6 +998,7 @@ protected static function getRelatedMemberships($contributionID) { * @param $pledgeID * @param $pledgePaymentIDs * @param $contributionStatusId + * * @return array */ protected static function cancel($processContributionObject, $memberships, $contributionId, $membershipStatuses, $updateResult, $participant, $oldStatus, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId) { @@ -1091,7 +1104,7 @@ public function addSelectWhereClause() { * @return array|null */ public static function getTotalAmountAndCount($status = NULL, $startDate = NULL, $endDate = NULL) { - $where = array(); + $where = []; switch ($status) { case 'Valid': $where[] = 'contribution_status_id = 1'; @@ -1138,17 +1151,17 @@ public static function getTotalAmountAndCount($status = NULL, $startDate = NULL, "; $dao = CRM_Core_DAO::executeQuery($query); - $amount = array(); + $amount = []; $count = 0; while ($dao->fetch()) { $count += $dao->total_count; $amount[] = CRM_Utils_Money::format($dao->total_amount, $dao->currency); } if ($count) { - return array( + return [ 'amount' => implode(', ', $amount), 'count' => $count, - ); + ]; } return NULL; } @@ -1168,11 +1181,11 @@ public static function deleteContribution($id) { $results = NULL; //delete activity record - $params = array( + $params = [ 'source_record_id' => $id, // activity type id for contribution 'activity_type_id' => 6, - ); + ]; CRM_Activity_BAO_Activity::deleteActivity($params); @@ -1216,10 +1229,10 @@ public static function deleteContribution($id) { CRM_Utils_Hook::post('delete', 'Contribution', $dao->id, $dao); // delete the recently created Contribution - $contributionRecent = array( + $contributionRecent = [ 'id' => $id, 'type' => 'Contribution', - ); + ]; CRM_Utils_Recent::del($contributionRecent); return $results; @@ -1238,20 +1251,19 @@ public static function deleteContribution($id) { * @throws \CiviCRM_API3_Exception */ public static function failPayment($contributionID, $contactID, $message) { - civicrm_api3('activity', 'create', array( + civicrm_api3('activity', 'create', [ 'activity_type_id' => 'Failed Payment', 'details' => $message, 'subject' => ts('Payment failed at payment processor'), 'source_record_id' => $contributionID, - 'source_contact_id' => CRM_Core_Session::getLoggedInContactID() ? CRM_Core_Session::getLoggedInContactID() : - $contactID, - )); + 'source_contact_id' => CRM_Core_Session::getLoggedInContactID() ? CRM_Core_Session::getLoggedInContactID() : $contactID, + ]); // CRM-20336 Make sure that the contribution status is Failed, not Pending. - civicrm_api3('contribution', 'create', array( + civicrm_api3('contribution', 'create', [ 'id' => $contributionID, 'contribution_status_id' => 'Failed', - )); + ]); } /** @@ -1273,17 +1285,17 @@ public static function checkDuplicate($input, &$duplicates, $id = NULL) { $trxn_id = CRM_Utils_Array::value('trxn_id', $input); $invoice_id = CRM_Utils_Array::value('invoice_id', $input); - $clause = array(); - $input = array(); + $clause = []; + $input = []; if ($trxn_id) { $clause[] = "trxn_id = %1"; - $input[1] = array($trxn_id, 'String'); + $input[1] = [$trxn_id, 'String']; } if ($invoice_id) { $clause[] = "invoice_id = %2"; - $input[2] = array($invoice_id, 'String'); + $input[2] = [$invoice_id, 'String']; } if (empty($clause)) { @@ -1293,7 +1305,7 @@ public static function checkDuplicate($input, &$duplicates, $id = NULL) { $clause = implode(' OR ', $clause); if ($id) { $clause = "( $clause ) AND id != %3"; - $input[3] = array($id, 'Integer'); + $input[3] = [$id, 'Integer']; } $query = "SELECT id FROM civicrm_contribution WHERE $clause"; @@ -1365,38 +1377,38 @@ public static function getContributionFields($addExtraFields = TRUE) { * Add extra fields specific to contribution. */ public static function getSpecialContributionFields() { - $extraFields = array( - 'contribution_soft_credit_name' => array( + $extraFields = [ + 'contribution_soft_credit_name' => [ 'name' => 'contribution_soft_credit_name', 'title' => ts('Soft Credit Name'), 'headerPattern' => '/^soft_credit_name$/i', 'where' => 'civicrm_contact_d.display_name', - ), - 'contribution_soft_credit_email' => array( + ], + 'contribution_soft_credit_email' => [ 'name' => 'contribution_soft_credit_email', 'title' => ts('Soft Credit Email'), 'headerPattern' => '/^soft_credit_email$/i', 'where' => 'soft_email.email', - ), - 'contribution_soft_credit_phone' => array( + ], + 'contribution_soft_credit_phone' => [ 'name' => 'contribution_soft_credit_phone', 'title' => ts('Soft Credit Phone'), 'headerPattern' => '/^soft_credit_phone$/i', 'where' => 'soft_phone.phone', - ), - 'contribution_soft_credit_contact_id' => array( + ], + 'contribution_soft_credit_contact_id' => [ 'name' => 'contribution_soft_credit_contact_id', 'title' => ts('Soft Credit Contact ID'), 'headerPattern' => '/^soft_credit_contact_id$/i', 'where' => 'civicrm_contribution_soft.contact_id', - ), - 'contribution_pcp_title' => array( + ], + 'contribution_pcp_title' => [ 'name' => 'contribution_pcp_title', 'title' => ts('Personal Campaign Page Title'), 'headerPattern' => '/^contribution_pcp_title$/i', 'where' => 'contribution_pcp.title', - ), - ); + ], + ]; return $extraFields; } @@ -1418,14 +1430,14 @@ public static function getCurrentandGoalAmount($pageID) { "; $config = CRM_Core_Config::singleton(); - $params = array(1 => array($pageID, 'Integer')); + $params = [1 => [$pageID, 'Integer']]; $dao = CRM_Core_DAO::executeQuery($query, $params); if ($dao->fetch()) { - return array($dao->goal, $dao->total); + return [$dao->goal, $dao->total]; } else { - return array(NULL, NULL); + return [NULL, NULL]; } } @@ -1434,17 +1446,17 @@ public static function getCurrentandGoalAmount($pageID) { * * The returned array provides details about the original contribution & donor. * - * @todo - this is a confusing function called from one place. It has a test. It would be - * nice to deprecate it. - * * @param int $honorId * In Honor of Contact ID. * * @return array * list of contribution fields + * @todo - this is a confusing function called from one place. It has a test. It would be + * nice to deprecate it. + * */ public static function getHonorContacts($honorId) { - $params = array(); + $params = []; $honorDAO = new CRM_Contribute_DAO_ContributionSoft(); $honorDAO->contact_id = $honorId; $honorDAO->find(); @@ -1509,7 +1521,7 @@ public static function annual($contactIDs) { $query = self::getAnnualQuery($contactIDs); $dao = CRM_Core_DAO::executeQuery($query); $count = 0; - $amount = $average = array(); + $amount = $average = []; while ($dao->fetch()) { if ($dao->count > 0 && $dao->amount > 0) { $count += $dao->count; @@ -1518,13 +1530,13 @@ public static function annual($contactIDs) { } } if ($count > 0) { - return array( + return [ $count, implode(', ', $amount), implode(', ', $average), - ); + ]; } - return array(0, 0, 0); + return [0, 0, 0]; } /** @@ -1541,8 +1553,8 @@ public static function annual($contactIDs) { public static function checkDuplicateIds($params) { $dao = new CRM_Contribute_DAO_Contribution(); - $clause = array(); - $input = array(); + $clause = []; + $input = []; foreach ($params as $k => $v) { if ($v) { $clause[] = "$k = '$v'"; @@ -1571,7 +1583,7 @@ public static function checkDuplicateIds($params) { * associated array */ public static function getContributionDetails($exportMode, $componentIds) { - $paymentDetails = array(); + $paymentDetails = []; $componentClause = ' IN ( ' . implode(',', $componentIds) . ' ) '; if ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) { @@ -1611,13 +1623,13 @@ public static function getContributionDetails($exportMode, $componentIds) { $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { - $paymentDetails[$dao->id] = array( + $paymentDetails[$dao->id] = [ 'total_amount' => $dao->total_amount, 'contribution_status' => $dao->status, 'receive_date' => $dao->receive_date, 'pay_instru' => $dao->payment_instrument, 'trxn_id' => $dao->trxn_id, - ); + ]; } return $paymentDetails; @@ -1654,7 +1666,7 @@ public static function createAddress($params, $billingLocationTypeID) { * @param int $contactId */ public static function deleteAddress($contributionId = NULL, $contactId = NULL) { - $clauses = array(); + $clauses = []; $contactJoin = NULL; if ($contributionId) { @@ -1682,7 +1694,7 @@ public static function deleteAddress($contributionId = NULL, $contactId = NULL) $dao = CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { - $params = array('id' => $dao->id); + $params = ['id' => $dao->id]; CRM_Core_BAO_Block::blockDelete('Address', $params); } } @@ -1702,7 +1714,7 @@ public static function deleteAddress($contributionId = NULL, $contactId = NULL) public static function checkOnlinePendingContribution($componentId, $componentName) { $contributionId = NULL; if (!$componentId || - !in_array($componentName, array('Event', 'Membership')) + !in_array($componentName, ['Event', 'Membership']) ) { return $contributionId; } @@ -1754,16 +1766,16 @@ public static function checkOnlinePendingContribution($componentId, $componentNa * * This function by-passes hooks - to address this - don't use this function. * - * @deprecated - * - * Use api contribute.completetransaction - * For failures use failPayment (preferably exposing by api in the process). - * * @param array $params * @param bool $processContributionObject * * @return array * @throws \Exception + * @deprecated + * + * Use api contribute.completetransaction + * For failures use failPayment (preferably exposing by api in the process). + * */ public static function transitionComponents($params, $processContributionObject = FALSE) { // get minimum required values. @@ -1776,17 +1788,17 @@ public static function transitionComponents($params, $processContributionObject // if we already processed contribution object pass previous status id. $previousContriStatusId = CRM_Utils_Array::value('previous_contribution_status_id', $params); - $updateResult = array(); + $updateResult = []; $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); // we process only ( Completed, Cancelled, or Failed ) contributions. if (!$contributionId || - !in_array($contributionStatusId, array( + !in_array($contributionStatusId, [ array_search('Completed', $contributionStatuses), array_search('Cancelled', $contributionStatuses), array_search('Failed', $contributionStatuses), - )) + ]) ) { return $updateResult; } @@ -1823,7 +1835,7 @@ public static function transitionComponents($params, $processContributionObject $baseIPN = new CRM_Core_Payment_BaseIPN(); - $input = $ids = $objects = array(); + $input = $ids = $objects = []; $input['component'] = CRM_Utils_Array::value('component', $componentDetails); $ids['contribution'] = $contributionId; @@ -1918,13 +1930,19 @@ public static function transitionComponents($params, $processContributionObject // only pending contribution related object processed. if ($previousContriStatusId && - !in_array($contributionStatuses[$previousContriStatusId], array('Pending', 'Partially paid')) + !in_array($contributionStatuses[$previousContriStatusId], [ + 'Pending', + 'Partially paid', + ]) ) { // this is case when we already processed contribution object. return $updateResult; } elseif (!$previousContriStatusId && - !in_array($contributionStatuses[$contribution->contribution_status_id], array('Pending', 'Partially paid')) + !in_array($contributionStatuses[$contribution->contribution_status_id], [ + 'Pending', + 'Partially paid', + ]) ) { // this is case when we are going to process contribution object later. return $updateResult; @@ -2007,14 +2025,14 @@ public static function transitionComponents($params, $processContributionObject (array) $membership ); - $formattedParams = array( + $formattedParams = [ 'status_id' => CRM_Utils_Array::value('id', $calcStatus, array_search('Current', $membershipStatuses) ), 'join_date' => CRM_Utils_Date::customFormat($dates['join_date'], $format), 'start_date' => CRM_Utils_Date::customFormat($dates['start_date'], $format), 'end_date' => CRM_Utils_Date::customFormat($dates['end_date'], $format), - ); + ]; CRM_Utils_Hook::pre('edit', 'Membership', $membership->id, $formattedParams); @@ -2022,7 +2040,7 @@ public static function transitionComponents($params, $processContributionObject $membership->save(); //updating the membership log - $membershipLog = array(); + $membershipLog = []; $membershipLog = $formattedParams; $logStartDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('log_start_date', $dates), $format); $logStartDate = ($logStartDate) ? CRM_Utils_Date::isoToMysql($logStartDate) : $formattedParams['start_date']; @@ -2038,24 +2056,24 @@ public static function transitionComponents($params, $processContributionObject //update related Memberships. CRM_Member_BAO_Membership::updateRelatedMemberships($membership->id, $formattedParams); - foreach (array('Membership Signup', 'Membership Renewal') as $activityType) { + foreach (['Membership Signup', 'Membership Renewal'] as $activityType) { $scheduledActivityID = CRM_Utils_Array::value('id', civicrm_api3('Activity', 'Get', - array( + [ 'source_record_id' => $membership->id, 'activity_type_id' => $activityType, 'status_id' => 'Scheduled', - 'options' => array( + 'options' => [ 'limit' => 1, 'sort' => 'id DESC', - ), - ) + ], + ] ) ); // 1. Update Schedule Membership Signup/Renewal activity to completed on successful payment of pending membership // 2. OR Create renewal activity scheduled if its membership renewal will be paid later if ($scheduledActivityID) { - CRM_Activity_BAO_Activity::addActivity($membership, $activityType, $membership->contact_id, array('id' => $scheduledActivityID)); + CRM_Activity_BAO_Activity::addActivity($membership, $activityType, $membership->contact_id, ['id' => $scheduledActivityID]); break; } } @@ -2066,11 +2084,11 @@ public static function transitionComponents($params, $processContributionObject CRM_Activity_BAO_Activity::addActivity($membership, 'Change Membership Status', NULL, - array( + [ 'subject' => "Status changed from {$allStatus[$oldStatus]} to {$allStatus[$membership->status_id]}", 'source_contact_id' => $membershipLog['modified_id'], 'priority_id' => 'Normal', - ) + ] ); } @@ -2106,8 +2124,8 @@ public static function transitionComponents($params, $processContributionObject // process contribution object. if ($processContribution) { - $contributionParams = array(); - $fields = array( + $contributionParams = []; + $fields = [ 'contact_id', 'total_amount', 'receive_date', @@ -2121,7 +2139,7 @@ public static function transitionComponents($params, $processContributionObject 'non_deductible_amount', 'receipt_date', 'check_number', - ); + ]; foreach ($fields as $field) { if (empty($params[$field])) { continue; @@ -2129,7 +2147,7 @@ public static function transitionComponents($params, $processContributionObject $contributionParams[$field] = $params[$field]; } - $ids = array('contribution' => $contributionId); + $ids = ['contribution' => $contributionId]; $contribution = CRM_Contribute_BAO_Contribution::create($contributionParams, $ids); } @@ -2144,7 +2162,7 @@ public static function transitionComponents($params, $processContributionObject * @return array */ public static function getComponentDetails($contributionId) { - $componentDetails = $pledgePayment = array(); + $componentDetails = $pledgePayment = []; if (!$contributionId) { return $componentDetails; } @@ -2167,7 +2185,7 @@ public static function getComponentDetails($contributionId) { WHERE c.id = $contributionId"; $dao = CRM_Core_DAO::executeQuery($query); - $componentDetails = array(); + $componentDetails = []; while ($dao->fetch()) { $componentDetails['component'] = $dao->participant_id ? 'event' : 'contribute'; @@ -2180,7 +2198,7 @@ public static function getComponentDetails($contributionId) { } if ($dao->membership_id) { if (!isset($componentDetails['membership'])) { - $componentDetails['membership'] = $componentDetails['membership_type'] = array(); + $componentDetails['membership'] = $componentDetails['membership_type'] = []; } $componentDetails['membership'][] = $dao->membership_id; $componentDetails['membership_type'][] = $dao->membership_type_id; @@ -2271,9 +2289,9 @@ protected static function repeatTransaction(&$contribution, &$input, $contributi } if (!empty($contributionParams['contribution_recur_id'])) { - $recurringContribution = civicrm_api3('ContributionRecur', 'getsingle', array( + $recurringContribution = civicrm_api3('ContributionRecur', 'getsingle', [ 'id' => $contributionParams['contribution_recur_id'], - )); + ]); if (!empty($recurringContribution['campaign_id'])) { // CRM-17718 the campaign id on the contribution recur record should get precedence. $contributionParams['campaign_id'] = $recurringContribution['campaign_id']; @@ -2285,7 +2303,10 @@ protected static function repeatTransaction(&$contribution, &$input, $contributi } $templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution( $contributionParams['contribution_recur_id'], - array_intersect_key($contributionParams, array('total_amount' => TRUE, 'financial_type_id' => TRUE)) + array_intersect_key($contributionParams, [ + 'total_amount' => TRUE, + 'financial_type_id' => TRUE, + ]) ); $input['line_item'] = $contributionParams['line_item'] = $templateContribution['line_item']; @@ -2328,7 +2349,7 @@ protected static function repeatTransaction(&$contribution, &$input, $contributi */ public static function getOnbehalfIds($contributionId, $contributorId = NULL) { - $ids = array(); + $ids = []; if (!$contributionId) { return $ids; @@ -2357,11 +2378,11 @@ public static function getOnbehalfIds($contributionId, $contributorId = NULL) { $activityContacts = CRM_Activity_BAO_ActivityContact::buildOptions('record_type_id', 'validate'); $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); - $params = array( - 1 => array($activityTypeId, 'Integer'), - 2 => array($contributionId, 'Integer'), - 3 => array($sourceID, 'Integer'), - ); + $params = [ + 1 => [$activityTypeId, 'Integer'], + 2 => [$contributionId, 'Integer'], + 3 => [$sourceID, 'Integer'], + ]; $sourceContactId = CRM_Core_DAO::singleValueQuery($activityQuery, $params); @@ -2407,7 +2428,7 @@ public static function getContributionDates() { else { $year = date('Y'); } - $year = array('Y' => $year); + $year = ['Y' => $year]; $yearDate = $config->fiscalYearStart; $yearDate = array_merge($year, $yearDate); $yearDate = CRM_Utils_Date::format($yearDate); @@ -2416,17 +2437,18 @@ public static function getContributionDates() { $now = date('Ymd'); - return array( + return [ 'now' => $now, 'yearDate' => $yearDate, 'monthDate' => $monthDate, - ); + ]; } /** * Load objects relations to contribution object. * Objects are stored in the $_relatedObjects property * In the first instance we are just moving functionality from BASEIpn - + * * @see http://issues.civicrm.org/jira/browse/CRM-9996 * * Note that the unit test for the BaseIPN class tests this function @@ -2630,20 +2652,23 @@ public function composeMessageArray(&$input, &$ids, &$values, $returnMessageText } // todo remove strtolower - check consistency if (strtolower($this->_component) == 'event') { - $eventParams = array('id' => $this->_relatedObjects['participant']->event_id); - $values['event'] = array(); + $eventParams = ['id' => $this->_relatedObjects['participant']->event_id]; + $values['event'] = []; CRM_Event_BAO_Event::retrieve($eventParams, $values['event']); //get location details - $locationParams = array('entity_id' => $this->_relatedObjects['participant']->event_id, 'entity_table' => 'civicrm_event'); + $locationParams = [ + 'entity_id' => $this->_relatedObjects['participant']->event_id, + 'entity_table' => 'civicrm_event', + ]; $values['location'] = CRM_Core_BAO_Location::getValues($locationParams); - $ufJoinParams = array( + $ufJoinParams = [ 'entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'module' => 'CiviEvent', - ); + ]; list($custom_pre_id, $custom_post_ids @@ -2679,12 +2704,12 @@ public function composeMessageArray(&$input, &$ids, &$values, $returnMessageText if (isset($ids['onbehalf_dupe_alert'])) { $values['onbehalf_dupe_alert'] = $ids['onbehalf_dupe_alert']; } - $entityBlock = array( + $entityBlock = [ 'contact_id' => $ids['contact'], 'location_type_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_LocationType', 'Home', 'id', 'name' ), - ); + ]; $address = CRM_Core_BAO_Address::getValues($entityBlock); $template->assign('onBehalfAddress', $address[$entityBlock['location_type_id']]['display']); } @@ -2753,16 +2778,16 @@ public function composeMessageArray(&$input, &$ids, &$values, $returnMessageText * * @return array */ - public function _gatherMessageValues($input, &$values, $ids = array()) { + public function _gatherMessageValues($input, &$values, $ids = []) { // set display address of contributor if ($this->address_id) { - $addressParams = array('id' => $this->address_id); + $addressParams = ['id' => $this->address_id]; $addressDetails = CRM_Core_BAO_Address::getValues($addressParams, FALSE, 'id'); $addressDetails = array_values($addressDetails); } // Else we assign the billing address of the contribution contact. else { - $addressParams = array('contact_id' => $this->contact_id, 'is_billing' => 1); + $addressParams = ['contact_id' => $this->contact_id, 'is_billing' => 1]; $addressDetails = (array) CRM_Core_BAO_Address::getValues($addressParams); $addressDetails = array_values($addressDetails); } @@ -2784,7 +2809,7 @@ public function _gatherMessageValues($input, &$values, $ids = array()) { // This is precautionary as there are some legacy flows, but it should really be // loaded by now. if (!isset($this->_relatedObjects['contributionPage'])) { - $this->loadRelatedEntitiesByID(array('contributionPage' => $this->contribution_page_id)); + $this->loadRelatedEntitiesByID(['contributionPage' => $this->contribution_page_id]); } // CRM-8254 - override default currency if applicable $config = CRM_Core_Config::singleton(); @@ -2805,15 +2830,18 @@ public function _gatherMessageValues($input, &$values, $ids = array()) { $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($this->id); if (!empty($lineItems)) { $firstLineItem = reset($lineItems); - $priceSet = array(); + $priceSet = []; if (CRM_Utils_Array::value('price_set_id', $firstLineItem)) { - $priceSet = civicrm_api3('PriceSet', 'getsingle', array('id' => $firstLineItem['price_set_id'], 'return' => 'is_quick_config, id')); + $priceSet = civicrm_api3('PriceSet', 'getsingle', [ + 'id' => $firstLineItem['price_set_id'], + 'return' => 'is_quick_config, id', + ]); $values['priceSetID'] = $priceSet['id']; } foreach ($lineItems as &$eachItem) { if (isset($this->_relatedObjects['membership']) - && is_array($this->_relatedObjects['membership']) - && array_key_exists($eachItem['membership_type_id'], $this->_relatedObjects['membership'])) { + && is_array($this->_relatedObjects['membership']) + && array_key_exists($eachItem['membership_type_id'], $this->_relatedObjects['membership'])) { $eachItem['join_date'] = CRM_Utils_Date::customFormat($this->_relatedObjects['membership'][$eachItem['membership_type_id']]->join_date); $eachItem['start_date'] = CRM_Utils_Date::customFormat($this->_relatedObjects['membership'][$eachItem['membership_type_id']]->start_date); $eachItem['end_date'] = CRM_Utils_Date::customFormat($this->_relatedObjects['membership'][$eachItem['membership_type_id']]->end_date); @@ -2837,16 +2865,16 @@ public function _gatherMessageValues($input, &$values, $ids = array()) { } else { // event - $eventParams = array( + $eventParams = [ 'id' => $this->_relatedObjects['event']->id, - ); - $values['event'] = array(); + ]; + $values['event'] = []; CRM_Event_BAO_Event::retrieve($eventParams, $values['event']); // add custom fields for event $eventGroupTree = CRM_Core_BAO_CustomGroup::getTree('Event', NULL, $this->_relatedObjects['event']->id); - $eventCustomGroup = array(); + $eventCustomGroup = []; foreach ($eventGroupTree as $key => $group) { if ($key === 'info') { continue; @@ -2864,16 +2892,16 @@ public function _gatherMessageValues($input, &$values, $ids = array()) { $values['event']['customGroup'] = $eventCustomGroup; //get participant details - $participantParams = array( + $participantParams = [ 'id' => $this->_relatedObjects['participant']->id, - ); + ]; - $values['participant'] = array(); + $values['participant'] = []; CRM_Event_BAO_Participant::getValues($participantParams, $values['participant'], $participantIds); // add custom fields for event $participantGroupTree = CRM_Core_BAO_CustomGroup::getTree('Participant', NULL, $this->_relatedObjects['participant']->id); - $participantCustomGroup = array(); + $participantCustomGroup = []; foreach ($participantGroupTree as $key => $group) { if ($key === 'info') { continue; @@ -2891,17 +2919,17 @@ public function _gatherMessageValues($input, &$values, $ids = array()) { $values['participant']['customGroup'] = $participantCustomGroup; //get location details - $locationParams = array( + $locationParams = [ 'entity_id' => $this->_relatedObjects['event']->id, 'entity_table' => 'civicrm_event', - ); + ]; $values['location'] = CRM_Core_BAO_Location::getValues($locationParams); - $ufJoinParams = array( + $ufJoinParams = [ 'entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'module' => 'CiviEvent', - ); + ]; list($custom_pre_id, $custom_post_ids @@ -2926,7 +2954,7 @@ public function _gatherMessageValues($input, &$values, $ids = array()) { $groupTree = CRM_Core_BAO_CustomGroup::getTree('Contribution', NULL, $this->id); - $customGroup = array(); + $customGroup = []; foreach ($groupTree as $key => $group) { if ($key === 'info') { continue; @@ -2984,28 +3012,31 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa //assign honor information to receipt message $softRecord = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id); - $honorParams = ['soft_credit_type' => NULL, 'honor_block_is_active' => NULL]; + $honorParams = [ + 'soft_credit_type' => NULL, + 'honor_block_is_active' => NULL, + ]; if (isset($softRecord['soft_credit'])) { //if id of contribution page is present if (!empty($values['id'])) { - $values['honor'] = array( - 'honor_profile_values' => array(), + $values['honor'] = [ + 'honor_profile_values' => [], 'honor_profile_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'uf_group_id', 'entity_id'), 'honor_id' => $softRecord['soft_credit'][1]['contact_id'], - ); + ]; $honorParams['soft_credit_type'] = $softRecord['soft_credit'][1]['soft_credit_type_label']; $honorParams['honor_block_is_active'] = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFJoin', $values['id'], 'is_active', 'entity_id'); } else { //offline contribution - $softCreditTypes = $softCredits = array(); + $softCreditTypes = $softCredits = []; foreach ($softRecord['soft_credit'] as $key => $softCredit) { $softCreditTypes[$key] = $softCredit['soft_credit_type_label']; - $softCredits[$key] = array( + $softCredits[$key] = [ 'Name' => $softCredit['contact_name'], 'Amount' => CRM_Utils_Money::format($softCredit['amount'], $softCredit['currency']), - ); + ]; } $template->assign('softCreditTypes', $softCreditTypes); $template->assign('softCredits', $softCredits); @@ -3032,7 +3063,13 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa $values['amount'] = $this->total_amount; } - $pcpParams = ['pcpBlock' => NULL, 'pcp_display_in_roll' => NULL, 'pcp_roll_nickname' => NULL, 'pcp_personal_note' => NULL, 'title' => NULL]; + $pcpParams = [ + 'pcpBlock' => NULL, + 'pcp_display_in_roll' => NULL, + 'pcp_roll_nickname' => NULL, + 'pcp_personal_note' => NULL, + 'title' => NULL, + ]; if (strtolower($this->_component) == 'contribute') { //PCP Info @@ -3084,7 +3121,7 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa if ($this->_component == 'event') { $template->assign('title', $values['event']['title']); $participantRoles = CRM_Event_PseudoConstant::participantRole(); - $viewRoles = array(); + $viewRoles = []; foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->_relatedObjects['participant']->role_id) as $k => $v) { $viewRoles[] = $participantRoles[$v]; } @@ -3100,13 +3137,13 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa $isTest = TRUE; } - $values['params'] = array(); + $values['params'] = []; //to get email of primary participant. $primaryEmail = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Email', $this->_relatedObjects['participant']->contact_id, 'email', 'contact_id'); - $primaryAmount[] = array( + $primaryAmount[] = [ 'label' => $this->_relatedObjects['participant']->fee_level . ' - ' . $primaryEmail, 'amount' => $this->_relatedObjects['participant']->fee_amount, - ); + ]; //build an array of cId/pId of participants $additionalIDs = CRM_Event_BAO_Event::buildCustomProfile($this->_relatedObjects['participant']->id, NULL, $this->_relatedObjects['contact']->id, $isTest, TRUE); unset($additionalIDs[$this->_relatedObjects['participant']->id]); @@ -3117,7 +3154,7 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa //set additionalParticipant true $values['params']['additionalParticipant'] = TRUE; foreach ($additionalIDs as $pId => $cId) { - $amount = array(); + $amount = []; //to change the status pending to completed $additional = new CRM_Event_DAO_Participant(); $additional->id = $pId; @@ -3131,11 +3168,14 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa if (!$additionalParticipantInfo) { $additionalParticipantInfo = CRM_Contact_BAO_Contact::displayName($additional->contact_id); } - $amount[0] = array('label' => $additional->fee_level, 'amount' => $additional->fee_amount); - $primaryAmount[] = array( + $amount[0] = [ + 'label' => $additional->fee_level, + 'amount' => $additional->fee_amount, + ]; + $primaryAmount[] = [ 'label' => $additional->fee_level . ' - ' . $additionalParticipantInfo, 'amount' => $additional->fee_amount, - ); + ]; $additional->save(); $template->assign('amount', $amount); CRM_Event_BAO_Event::sendMail($cId, $values, $pId, $isTest, $returnMessageText); @@ -3180,7 +3220,7 @@ public static function isCancelSubscriptionSupported($contributionId, $isNotCanc $cacheKeyString = "$contributionId"; $cacheKeyString .= $isNotCancelled ? '_1' : '_0'; - static $supportsCancel = array(); + static $supportsCancel = []; if (!array_key_exists($cacheKeyString, $supportsCancel)) { $supportsCancel[$cacheKeyString] = FALSE; @@ -3213,7 +3253,7 @@ public static function isSubscriptionCancelled($contributionId) { FROM civicrm_contribution_recur cr LEFT JOIN civicrm_contribution con ON ( cr.id = con.contribution_recur_id ) WHERE con.id = %1 LIMIT 1"; - $params = array(1 => array($contributionId, 'Integer')); + $params = [1 => [$contributionId, 'Integer']]; $statusId = CRM_Core_DAO::singleValueQuery($sql, $params); $status = CRM_Contribute_PseudoConstant::contributionStatus($statusId); if ($status == 'Cancelled') { @@ -3236,7 +3276,7 @@ public static function isSubscriptionCancelled($contributionId) { public static function recordFinancialAccounts(&$params, $financialTrxnValues = NULL) { $skipRecords = $update = $return = $isRelatedId = FALSE; - $additionalParticipantId = array(); + $additionalParticipantId = []; $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); $contributionStatus = empty($params['contribution_status_id']) ? NULL : $contributionStatuses[$params['contribution_status_id']]; @@ -3323,10 +3363,10 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues = !($contributionStatus == 'Pending' && !$params['contribution']->is_pay_later) ) { $skipRecords = TRUE; - $pendingStatus = array( + $pendingStatus = [ 'Pending', 'In Progress', - ); + ]; if (in_array($contributionStatus, $pendingStatus)) { $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship( $params['financial_type_id'], @@ -3335,17 +3375,17 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues = } elseif (!empty($params['payment_processor'])) { $params['to_financial_account_id'] = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($params['payment_processor'], NULL, 'civicrm_payment_processor'); - $params['payment_instrument_id'] = civicrm_api3('PaymentProcessor', 'getvalue', array( + $params['payment_instrument_id'] = civicrm_api3('PaymentProcessor', 'getvalue', [ 'id' => $params['payment_processor'], 'return' => 'payment_instrument_id', - )); + ]); } elseif (!empty($params['payment_instrument_id'])) { $params['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($params['payment_instrument_id']); } else { $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('financial_account_type', NULL, " AND v.name LIKE 'Asset' ")); - $queryParams = array(1 => array($relationTypeId, 'Integer')); + $queryParams = [1 => [$relationTypeId, 'Integer']]; $params['to_financial_account_id'] = CRM_Core_DAO::singleValueQuery("SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = %1", $queryParams); } @@ -3354,7 +3394,7 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues = $totalAmount = $params['total_amount'] = $params['prevContribution']->total_amount; } //build financial transaction params - $trxnParams = array( + $trxnParams = [ 'contribution_id' => $params['contribution']->id, 'to_financial_account_id' => $params['to_financial_account_id'], 'trxn_date' => !empty($params['contribution']->receive_date) ? $params['contribution']->receive_date : date('YmdHis'), @@ -3371,7 +3411,7 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues = 'check_number' => CRM_Utils_Array::value('check_number', $params), 'pan_truncation' => CRM_Utils_Array::value('pan_truncation', $params), 'card_type_id' => CRM_Utils_Array::value('card_type_id', $params), - ); + ]; if ($contributionStatus == 'Refunded' || $contributionStatus == 'Chargeback' || $contributionStatus == 'Cancelled') { $trxnParams['trxn_date'] = !empty($params['contribution']->cancel_date) ? $params['contribution']->cancel_date : date('YmdHis'); if (isset($params['refund_trxn_id'])) { @@ -3509,7 +3549,10 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues = if (isset($params['refund_trxn_id'])) { $refundIDs = CRM_Core_BAO_FinancialTrxn::getRefundTransactionIDs($params['id']); if (!empty($refundIDs['financialTrxnId']) && $refundIDs['trxn_id'] != $params['refund_trxn_id']) { - civicrm_api3('FinancialTrxn', 'create', array('id' => $refundIDs['financialTrxnId'], 'trxn_id' => $params['refund_trxn_id'])); + civicrm_api3('FinancialTrxn', 'create', [ + 'id' => $refundIDs['financialTrxnId'], + 'trxn_id' => $params['refund_trxn_id'], + ]); } } $cardType = CRM_Utils_Array::value('card_type_id', $params); @@ -3539,11 +3582,11 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues = // create batch entry if batch_id is passed and // ensure no batch entry is been made on 'Pending' or 'Failed' contribution, CRM-16611 if (!empty($params['batch_id']) && !empty($financialTxn)) { - $entityParams = array( + $entityParams = [ 'batch_id' => $params['batch_id'], 'entity_table' => 'civicrm_financial_trxn', 'entity_id' => $financialTxn->id, - ); + ]; CRM_Batch_BAO_EntityBatch::create($entityParams); } @@ -3570,12 +3613,12 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues = * @param array $params * Contribution object, line item array and params for trxn. * - * @todo stop passing $params by reference. It is unclear the purpose of doing this & - * adds unpredictability. - * * @param string $context * Update scenarios. * + * @todo stop passing $params by reference. It is unclear the purpose of doing this & + * adds unpredictability. + * */ public static function updateFinancialAccounts(&$params, $context = NULL) { $trxnID = NULL; @@ -3591,10 +3634,14 @@ public static function updateFinancialAccounts(&$params, $context = NULL) { ) { return; } - if ((($previousContributionStatus == 'Partially paid' - && $currentContributionStatus == 'Completed') - || ($previousContributionStatus == 'Pending' && $params['prevContribution']->is_pay_later == TRUE - && $currentContributionStatus == 'Partially paid')) + // The 'right' way to add payments or refunds is through the Payment.create api. That api + // then updates the contribution but this process shoud not also record another financial trxn. + if ((($previousContributionStatus == 'Partially paid' && $currentContributionStatus == 'Completed') + || ($previousContributionStatus == 'Pending refund' && $currentContributionStatus == 'Completed') + // This concept of pay_later as different to any other sort of pending is deprecated & it's unclear + // why it is here or where it is handled instead. + || ($previousContributionStatus == 'Pending' && $params['prevContribution']->is_pay_later == TRUE + && $currentContributionStatus == 'Partially paid')) && $context == 'changedStatus' ) { return; @@ -3660,19 +3707,22 @@ public static function updateFinancialAccounts(&$params, $context = NULL) { $query = "UPDATE civicrm_financial_item SET status_id = %1 WHERE entity_id = %2 and entity_table = 'civicrm_line_item'"; $sql = "SELECT id, amount FROM civicrm_financial_item WHERE entity_id = %1 and entity_table = 'civicrm_line_item'"; - $entityParams = array( + $entityParams = [ 'entity_table' => 'civicrm_financial_item', - ); + ]; foreach ($params['line_item'] as $fieldId => $fields) { foreach ($fields as $fieldValueId => $lineItemDetails) { - $fparams = array( - 1 => array(CRM_Core_PseudoConstant::getKey('CRM_Financial_BAO_FinancialItem', 'status_id', 'Paid'), 'Integer'), - 2 => array($lineItemDetails['id'], 'Integer'), - ); + $fparams = [ + 1 => [ + CRM_Core_PseudoConstant::getKey('CRM_Financial_BAO_FinancialItem', 'status_id', 'Paid'), + 'Integer', + ], + 2 => [$lineItemDetails['id'], 'Integer'], + ]; CRM_Core_DAO::executeQuery($query, $fparams); - $fparams = array( - 1 => array($lineItemDetails['id'], 'Integer'), - ); + $fparams = [ + 1 => [$lineItemDetails['id'], 'Integer'], + ]; $financialItem = CRM_Core_DAO::executeQuery($sql, $fparams); while ($financialItem->fetch()) { $entityParams['entity_id'] = $financialItem->id; @@ -3711,7 +3761,7 @@ public static function updateFinancialAccounts(&$params, $context = NULL) { $currency = $params['contribution']->currency; } $previousLineItemTotal = CRM_Utils_Array::value('line_total', CRM_Utils_Array::value($fieldValueId, $previousLineItems), 0); - $itemParams = array( + $itemParams = [ 'transaction_date' => $receiveDate, 'contact_id' => $params['prevContribution']->contact_id, 'currency' => $currency, @@ -3721,7 +3771,7 @@ public static function updateFinancialAccounts(&$params, $context = NULL) { 'financial_account_id' => $financialAccount, 'entity_table' => 'civicrm_line_item', 'entity_id' => $lineItemDetails['id'], - ); + ]; $financialItem = CRM_Financial_BAO_FinancialItem::create($itemParams, NULL, $trxnIds); // @todo we should stop passing $params by reference - splitting this out would be a step towards that. $params['line_item'][$fieldId][$fieldValueId]['deferred_line_total'] = $itemParams['amount']; @@ -3774,7 +3824,7 @@ public static function updateFinancialAccounts(&$params, $context = NULL) { * @return bool */ public static function isContributionStatusNegative($status_id) { - $reversalStatuses = array('Cancelled', 'Chargeback', 'Refunded'); + $reversalStatuses = ['Cancelled', 'Chargeback', 'Refunded']; return in_array(CRM_Contribute_PseudoConstant::contributionStatus($status_id, 'name'), $reversalStatuses); } @@ -3800,22 +3850,22 @@ public static function checkStatusValidation($values, &$fields, &$errors) { } } $contributionStatuses = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name'); - $checkStatus = array( - 'Cancelled' => array('Completed', 'Refunded'), - 'Completed' => array('Cancelled', 'Refunded', 'Chargeback'), - 'Pending' => array('Cancelled', 'Completed', 'Failed', 'Partially paid'), - 'In Progress' => array('Cancelled', 'Completed', 'Failed'), - 'Refunded' => array('Cancelled', 'Completed'), - 'Partially paid' => array('Completed'), - ); + $checkStatus = [ + 'Cancelled' => ['Completed', 'Refunded'], + 'Completed' => ['Cancelled', 'Refunded', 'Chargeback'], + 'Pending' => ['Cancelled', 'Completed', 'Failed', 'Partially paid'], + 'In Progress' => ['Cancelled', 'Completed', 'Failed'], + 'Refunded' => ['Cancelled', 'Completed'], + 'Partially paid' => ['Completed'], + ]; if (!in_array($contributionStatuses[$fields['contribution_status_id']], - CRM_Utils_Array::value($contributionStatuses[$values['contribution_status_id']], $checkStatus, array())) + CRM_Utils_Array::value($contributionStatuses[$values['contribution_status_id']], $checkStatus, [])) ) { - $errors['contribution_status_id'] = ts("Cannot change contribution status from %1 to %2.", array( + $errors['contribution_status_id'] = ts("Cannot change contribution status from %1 to %2.", [ 1 => $contributionStatuses[$values['contribution_status_id']], 2 => $contributionStatuses[$fields['contribution_status_id']], - )); + ]); } } @@ -3839,17 +3889,18 @@ public static function deleteContactContribution($contactId) { /** * Get options for a given contribution field. - * @see CRM_Core_DAO::buildOptions * * @param string $fieldName * @param string $context see CRM_Core_DAO::buildOptionsContext. - * @param array $props whatever is known about this dao object. + * @param array $props whatever is known about this dao object. * * @return array|bool + * @see CRM_Core_DAO::buildOptions + * */ - public static function buildOptions($fieldName, $context = NULL, $props = array()) { + public static function buildOptions($fieldName, $context = NULL, $props = []) { $className = __CLASS__; - $params = array(); + $params = []; if (isset($props['orderColumn'])) { $params['orderColumn'] = $props['orderColumn']; } @@ -3859,10 +3910,10 @@ public static function buildOptions($fieldName, $context = NULL, $props = array( $className = 'CRM_Contribute_BAO_ContributionPage'; // Filter results by contribution page if (!empty($props['contribution_page_id'])) { - $page = civicrm_api('contribution_page', 'getsingle', array( + $page = civicrm_api('contribution_page', 'getsingle', [ 'version' => 3, 'id' => ($props['contribution_page_id']), - )); + ]); $types = (array) CRM_Utils_Array::value('payment_processor', $page, 0); $params['condition'] = 'id IN (' . implode(',', $types) . ')'; } @@ -3958,7 +4009,7 @@ public static function addActivityForPayment($targetCid, $trxnObj, $activityType $srcRecId = $contributionId; // activity params - $activityParams = array( + $activityParams = [ 'source_contact_id' => $targetCid, 'source_record_id' => $srcRecId, 'activity_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', $activityType), @@ -3966,7 +4017,7 @@ public static function addActivityForPayment($targetCid, $trxnObj, $activityType 'activity_date_time' => $date, 'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Completed'), 'skipRecentView' => TRUE, - ); + ]; // create activity with target contacts $session = CRM_Core_Session::singleton(); @@ -4027,7 +4078,15 @@ public static function getPaymentInfo($id, $component = 'contribution', $getTrxn $paymentBalance = CRM_Contribute_BAO_Contribution::getContributionBalance($contributionId, $total); - $contribution = civicrm_api3('Contribution', 'getsingle', array('id' => $contributionId, 'return' => array('currency', 'is_pay_later', 'contribution_status_id', 'financial_type_id'))); + $contribution = civicrm_api3('Contribution', 'getsingle', [ + 'id' => $contributionId, + 'return' => [ + 'currency', + 'is_pay_later', + 'contribution_status_id', + 'financial_type_id', + ], + ]); $info['payLater'] = $contribution['is_pay_later']; $info['contribution_status'] = $contribution['contribution_status']; @@ -4048,7 +4107,7 @@ public static function getPaymentInfo($id, $component = 'contribution', $getTrxn $info['balance'] = $paymentBalance; $info['id'] = $id; $info['component'] = $component; - $rows = array(); + $rows = []; if ($getTrxnInfo && $baseTrxnId) { // Need to exclude fee trxn rows so filter out rows where TO FINANCIAL ACCOUNT is expense account $sql = " @@ -4067,10 +4126,10 @@ public static function getPaymentInfo($id, $component = 'contribution', $getTrxn WHERE con.id = %1 AND ft.is_payment = 1 GROUP BY ft.id"; - $queryParams = array( - 1 => array($contributionId, 'Integer'), - 2 => array($feeFinancialAccount, 'Integer'), - ); + $queryParams = [ + 1 => [$contributionId, 'Integer'], + 2 => [$feeFinancialAccount, 'Integer'], + ]; $resultDAO = CRM_Core_DAO::executeQuery($sql, $queryParams); $statuses = CRM_Contribute_PseudoConstant::contributionStatus(); @@ -4089,26 +4148,26 @@ public static function getPaymentInfo($id, $component = 'contribution', $getTrxn // show payment edit link only for payments done via backoffice form $paymentEditLink = ''; if (empty($resultDAO->payment_processor_id) && CRM_Core_Permission::check('edit contributions')) { - $links = array( - CRM_Core_Action::UPDATE => array( + $links = [ + CRM_Core_Action::UPDATE => [ 'name' => "", 'url' => 'civicrm/payment/edit', 'class' => 'medium-popup', 'qs' => "reset=1&id=%%id%%&contribution_id=%%contribution_id%%", 'title' => ts('Edit Payment'), - ), - ); + ], + ]; $paymentEditLink = CRM_Core_Action::formLink( $links, - CRM_Core_Action::mask(array(CRM_Core_Permission::EDIT)), - array( + CRM_Core_Action::mask([CRM_Core_Permission::EDIT]), + [ 'id' => $resultDAO->id, 'contribution_id' => $contributionId, - ) + ] ); } - $val = array( + $val = [ 'id' => $resultDAO->id, 'total_amount' => $resultDAO->total_amount, 'financial_type' => $resultDAO->financial_account, @@ -4118,7 +4177,7 @@ public static function getPaymentInfo($id, $component = 'contribution', $getTrxn 'status' => $statuses[$resultDAO->status_id], 'currency' => $resultDAO->currency, 'action' => $paymentEditLink, - ); + ]; if ($paidByName == 'Check') { $val['check_number'] = $resultDAO->check_number; } @@ -4179,7 +4238,7 @@ public static function checkTaxAmount($params, $isLineItem = FALSE) { $params['prevContribution'] = self::getOriginalContribution($params['id']); } - foreach (array('total_amount', 'financial_type_id', 'fee_amount') as $field) { + foreach (['total_amount', 'financial_type_id', 'fee_amount'] as $field) { if (!isset($params[$field])) { if ($field == 'total_amount' && $params['prevContribution']->tax_amount) { // Tax amount gets added back on later.... @@ -4199,7 +4258,7 @@ public static function checkTaxAmount($params, $isLineItem = FALSE) { // Assign tax Amount on update of contribution if (!empty($params['prevContribution']->tax_amount)) { $params['tax_amount'] = 'null'; - CRM_Price_BAO_LineItem::getLineItemArray($params, array($params['id'])); + CRM_Price_BAO_LineItem::getLineItemArray($params, [$params['id']]); foreach ($params['line_item'] as $setID => $priceField) { foreach ($priceField as $priceFieldID => $priceFieldValue) { $params['line_item'][$setID][$priceFieldID]['tax_amount'] = $params['tax_amount']; @@ -4219,7 +4278,7 @@ public static function checkTaxAmount($params, $isLineItem = FALSE) { // Get Line Item on update of contribution if (isset($params['id'])) { - CRM_Price_BAO_LineItem::getLineItemArray($params, array($params['id'])); + CRM_Price_BAO_LineItem::getLineItemArray($params, [$params['id']]); } else { CRM_Price_BAO_LineItem::getLineItemArray($params); @@ -4233,7 +4292,7 @@ public static function checkTaxAmount($params, $isLineItem = FALSE) { } elseif (isset($params['api.line_item.create'])) { // Update total amount of contribution using lineItem - $taxAmountArray = array(); + $taxAmountArray = []; foreach ($params['api.line_item.create'] as $key => $value) { if (isset($value['financial_type_id']) && array_key_exists($value['financial_type_id'], $taxRates)) { $taxRate = $taxRates[$value['financial_type_id']]; @@ -4246,7 +4305,7 @@ public static function checkTaxAmount($params, $isLineItem = FALSE) { } else { // update line item of contrbution - if (isset($params['financial_type_id']) && array_key_exists($params['financial_type_id'], $taxRates) && $isLineItem) { + if (isset($params['financial_type_id']) && array_key_exists($params['financial_type_id'], $taxRates) && $isLineItem) { $taxRate = $taxRates[$params['financial_type_id']]; $taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($params['line_total'], $taxRate, $unknownIfMoneyIsClean); $params['tax_amount'] = round($taxAmount['tax_amount'], 2); @@ -4277,9 +4336,9 @@ public static function checkFinancialTypeChange($financialTypeId, $contributionI } } $sql = 'SELECT financial_type_id FROM civicrm_line_item WHERE contribution_id = %1 GROUP BY financial_type_id;'; - $params = array( - '1' => array($contributionId, 'Integer'), - ); + $params = [ + '1' => [$contributionId, 'Integer'], + ]; $result = CRM_Core_DAO::executeQuery($sql, $params); if ($result->N > 1) { $errors['financial_type_id'] = ts('One or more line items have a different financial type than the contribution. Editing the financial type is not yet supported in this situation.'); @@ -4350,7 +4409,7 @@ public static function updateRelatedPledge( if ($updatePledgePaymentStatus) { CRM_Pledge_BAO_PledgePayment::updatePledgePaymentStatus($pledgeID, - array($pledgePaymentID), + [$pledgePaymentID], $contribution_status_id, NULL, $total_amount, @@ -4362,13 +4421,13 @@ public static function updateRelatedPledge( /** * Compute the stats values * - * @deprecated - * * @param string $stat either 'mode' or 'median' * @param string $sql * @param string $alias of civicrm_contribution * * @return array|null + * @deprecated + * */ public static function computeStats($stat, $sql, $alias = NULL) { CRM_Core_Error::deprecatedFunctionWarning('computeStats is now deprecated'); @@ -4385,7 +4444,7 @@ public static function computeStats($stat, $sql, $alias = NULL) { * @throws \CiviCRM_API3_Exception */ public static function isSingleLineItem($id) { - $lineItemCount = civicrm_api3('LineItem', 'getcount', array('contribution_id' => $id)); + $lineItemCount = civicrm_api3('LineItem', 'getcount', ['contribution_id' => $id]); return ($lineItemCount == 1); } @@ -4411,10 +4470,10 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re $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)) { - $input['prevContribution'] = CRM_Contribute_BAO_Contribution::getValues(array('id' => $contribution->id), + $input['prevContribution'] = CRM_Contribute_BAO_Contribution::getValues(['id' => $contribution->id], CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray); } - $inputContributionWhiteList = array( + $inputContributionWhiteList = [ 'fee_amount', 'net_amount', 'trxn_id', @@ -4427,7 +4486,7 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re 'contribution_status_id', 'card_type_id', 'pan_truncation', - ); + ]; if (self::isSingleLineItem($primaryContributionID)) { $inputContributionWhiteList[] = 'financial_type_id'; } @@ -4449,10 +4508,10 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re $completedContributionStatusID = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed'); - $contributionParams = array_merge(array( + $contributionParams = array_merge([ 'contribution_status_id' => $completedContributionStatusID, 'source' => self::getRecurringContributionDescription($contribution, $event), - ), array_intersect_key($input, array_fill_keys($inputContributionWhiteList, 1) + ], array_intersect_key($input, array_fill_keys($inputContributionWhiteList, 1) )); // CRM-20678 Ensure that the currency is correct in subseqent transcations. @@ -4480,7 +4539,7 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re self::repeatTransaction($contribution, $input, $contributionParams, $paymentProcessorId); $contributionParams['financial_type_id'] = $contribution->financial_type_id; - $values = array(); + $values = []; if (isset($input['is_email_receipt'])) { $values['is_email_receipt'] = $input['is_email_receipt']; } @@ -4539,10 +4598,10 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re CRM_Contribute_BAO_ContributionRecur::addrecurSoftCredit($objects['contributionRecur']->id, $contribution->id); } - $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array( + $contributionStatuses = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', [ 'labelColumn' => 'name', 'flip' => 1, - )); + ]); if (isset($input['prevContribution']) && (!$input['prevContribution']->is_pay_later && $input['prevContribution']->contribution_status_id == $contributionStatuses['Pending'])) { $input['payment_processor'] = $paymentProcessorId; } @@ -4581,10 +4640,10 @@ public static function completeOrder(&$input, &$ids, $objects, $transaction, $re if (!array_key_exists('is_email_receipt', $values) || $values['is_email_receipt'] == 1 ) { - civicrm_api3('Contribution', 'sendconfirmation', array( + civicrm_api3('Contribution', 'sendconfirmation', [ 'id' => $contribution->id, 'payment_processor_id' => $paymentProcessorId, - )); + ]); CRM_Core_Error::debug_log_message("Receipt sent"); } @@ -4631,30 +4690,41 @@ public static function sendMail(&$input, &$ids, $contributionID, &$values, $values['contribution_status'] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $contribution->contribution_status_id); $return = $contribution->composeMessageArray($input, $ids, $values, $returnMessageText); if ((!isset($input['receipt_update']) || $input['receipt_update']) && empty($contribution->receipt_date)) { - civicrm_api3('Contribution', 'create', array('receipt_date' => 'now', 'id' => $contribution->id)); + civicrm_api3('Contribution', 'create', [ + 'receipt_date' => 'now', + 'id' => $contribution->id, + ]); } return $return; } /** * Generate From email and from name in an array values + * * @param array $input * @param \CRM_Contribute_BAO_Contribution $contribution + * * @return array */ public static function generateFromEmailAndName($input, $contribution) { // Use input value if supplied. if (!empty($input['receipt_from_email'])) { - return array(CRM_Utils_array::value('receipt_from_name', $input, ''), $input['receipt_from_email']); + return [ + CRM_Utils_array::value('receipt_from_name', $input, ''), + $input['receipt_from_email'], + ]; } // if we are still empty see if we can use anything from a contribution page. - $pageValues = array(); + $pageValues = []; if (!empty($contribution->contribution_page_id)) { - $pageValues = civicrm_api3('ContributionPage', 'getsingle', array('id' => $contribution->contribution_page_id)); + $pageValues = civicrm_api3('ContributionPage', 'getsingle', ['id' => $contribution->contribution_page_id]); } // if we are still empty see if we can use anything from a contribution page. if (!empty($pageValues['receipt_from_email'])) { - return array($pageValues['receipt_from_name'], $pageValues['receipt_from_email']); + return [ + $pageValues['receipt_from_name'], + $pageValues['receipt_from_email'], + ]; } // If we are still empty fall back to the domain or logged in user information. return CRM_Core_BAO_Domain::getDefaultReceiptFrom(); @@ -4675,10 +4745,10 @@ public static function createCreditNoteId() { do { $creditNoteNum++; $creditNoteId = CRM_Utils_Array::value('credit_notes_prefix', $prefixValue) . "" . $creditNoteNum; - $result = civicrm_api3('Contribution', 'getcount', array( + $result = civicrm_api3('Contribution', 'getcount', [ 'sequential' => 1, 'creditnote_id' => $creditNoteId, - )); + ]); } while ($result > 0); return $creditNoteId; @@ -4687,6 +4757,11 @@ public static function createCreditNoteId() { /** * Load related memberships. * + * @param array $ids + * + * @return array $ids + * + * @throws Exception * @deprecated * * Note that in theory it should be possible to retrieve these from the line_item table @@ -4697,19 +4772,14 @@ public static function createCreditNoteId() { * * I don't know if it never worked or broke as a result of https://issues.civicrm.org/jira/browse/CRM-14918. * - * @param array $ids - * - * @return array $ids - * - * @throws Exception */ public function loadRelatedMembershipObjects($ids = []) { $query = " SELECT membership_id FROM civicrm_membership_payment WHERE contribution_id = %1 "; - $params = array(1 => array($this->id, 'Integer')); - $ids['membership'] = (array) CRM_Utils_Array::value('membership', $ids, array()); + $params = [1 => [$this->id, 'Integer']]; + $ids['membership'] = (array) CRM_Utils_Array::value('membership', $ids, []); $dao = CRM_Core_DAO::executeQuery($query, $params); while ($dao->fetch()) { @@ -4784,10 +4854,10 @@ protected static function getRecurringContributionDescription($contribution, $ev return $contribution->source; } elseif (!empty($contribution->contribution_page_id) && is_numeric($contribution->contribution_page_id)) { - $contributionPageTitle = civicrm_api3('ContributionPage', 'getvalue', array( + $contributionPageTitle = civicrm_api3('ContributionPage', 'getvalue', [ 'id' => $contribution->contribution_page_id, 'return' => 'title', - )); + ]); return ts('Online Contribution') . ': ' . $contributionPageTitle; } elseif ($event) { @@ -4813,23 +4883,28 @@ public static function addPayments($contributions, $contributionStatusId = NULL) FROM civicrm_financial_trxn ft INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_table = 'civicrm_contribution' WHERE eft.entity_id = %1 AND ft.is_payment = 1 ORDER BY ft.id DESC LIMIT 1"; - $contributionStatus = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', array( + $contributionStatus = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'contribution_status_id', [ 'labelColumn' => 'name', - )); + ]); foreach ($contributions as $contribution) { if (!($contributionStatus[$contribution->contribution_status_id] == 'Partially paid' || CRM_Utils_Array::value($contributionStatusId, $contributionStatus) == 'Partially paid') ) { continue; } - $ftDao = CRM_Core_DAO::executeQuery($ftSql, array(1 => array($contribution->id, 'Integer'))); + $ftDao = CRM_Core_DAO::executeQuery($ftSql, [ + 1 => [ + $contribution->id, + 'Integer', + ], + ]); $ftDao->fetch(); // store financial item Proportionaly. - $trxnParams = array( + $trxnParams = [ 'total_amount' => $ftDao->total_amount, 'contribution_id' => $contribution->id, - ); + ]; self::assignProportionalLineItems($trxnParams, $ftDao->id, $contribution->total_amount); } } @@ -4850,11 +4925,11 @@ public static function assignProportionalLineItems($trxnParams, $trxnId, $contri if (!empty($lineItems)) { // get financial item list($ftIds, $taxItems) = self::getLastFinancialItemIds($trxnParams['contribution_id']); - $entityParams = array( + $entityParams = [ 'contribution_total_amount' => $contributionTotalAmount, 'trxn_total_amount' => $trxnParams['total_amount'], 'trxn_id' => $trxnId, - ); + ]; self::createProportionalFinancialEntries($entityParams, $lineItems, $ftIds, $taxItems); } } @@ -4912,10 +4987,10 @@ public static function getFinancialAccountForStatusChangeTrxn($params, $default) } $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus($params['contribution_status_id'], 'name'); - $preferredAccountsRelationships = array( + $preferredAccountsRelationships = [ 'Refunded' => 'Credit/Contra Revenue Account is', 'Chargeback' => 'Chargeback Account is', - ); + ]; if (in_array($contributionStatus, array_keys($preferredAccountsRelationships))) { $financialTypeID = !empty($params['financial_type_id']) ? $params['financial_type_id'] : $params['prevContribution']->financial_type_id; @@ -4944,12 +5019,12 @@ public static function getFinancialAccountForStatusChangeTrxn($params, $default) * @return array */ protected function addContributionPageValuesToValuesHeavyHandedly(&$values) { - $contributionPageValues = array(); + $contributionPageValues = []; CRM_Contribute_BAO_ContributionPage::setValues( $this->contribution_page_id, $contributionPageValues ); - $valuesToCopy = array( + $valuesToCopy = [ // These are the values that I believe to be useful. 'id', 'title', @@ -5000,7 +5075,7 @@ protected function addContributionPageValuesToValuesHeavyHandedly(&$values) { 'thankyou_text', 'thankyou_title', - ); + ]; foreach ($valuesToCopy as $valueToCopy) { if (isset($contributionPageValues[$valueToCopy])) { $values[$valueToCopy] = $contributionPageValues[$valueToCopy]; @@ -5054,12 +5129,12 @@ public static function transitionComponentWithReturnMessage($contributionId, $st return $statusMsg; } - $params = array( + $params = [ 'contribution_id' => $contributionId, 'contribution_status_id' => $statusId, 'previous_contribution_status_id' => $previousStatusId, 'receive_date' => $receiveDate, - ); + ]; $updateResult = CRM_Contribute_BAO_Contribution::transitionComponents($params); @@ -5095,7 +5170,10 @@ public static function transitionComponentWithReturnMessage($contributionId, $st break; } - $statusMsg .= "
" . ts("Membership for %1 has been %2.", array(1 => $userDisplayName, 2 => $statusNameMsgPart)); + $statusMsg .= "
" . ts("Membership for %1 has been %2.", [ + 1 => $userDisplayName, + 2 => $statusNameMsgPart, + ]); } if ($componentName == 'CiviEvent') { @@ -5103,10 +5181,10 @@ public static function transitionComponentWithReturnMessage($contributionId, $st CRM_Event_PseudoConstant::participantStatus() ); if ($updatedStatusName == 'Cancelled') { - $statusMsg .= "
" . ts("Event Registration for %1 has been Cancelled.", array(1 => $userDisplayName)); + $statusMsg .= "
" . ts("Event Registration for %1 has been Cancelled.", [1 => $userDisplayName]); } elseif ($updatedStatusName == 'Registered') { - $statusMsg .= "
" . ts("Event Registration for %1 has been updated.", array(1 => $userDisplayName)); + $statusMsg .= "
" . ts("Event Registration for %1 has been updated.", [1 => $userDisplayName]); } } @@ -5115,13 +5193,13 @@ public static function transitionComponentWithReturnMessage($contributionId, $st CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name') ); if ($updatedStatusName == 'Cancelled') { - $statusMsg .= "
" . ts("Pledge Payment for %1 has been Cancelled.", array(1 => $userDisplayName)); + $statusMsg .= "
" . ts("Pledge Payment for %1 has been Cancelled.", [1 => $userDisplayName]); } elseif ($updatedStatusName == 'Failed') { - $statusMsg .= "
" . ts("Pledge Payment for %1 has been Failed.", array(1 => $userDisplayName)); + $statusMsg .= "
" . ts("Pledge Payment for %1 has been Failed.", [1 => $userDisplayName]); } elseif ($updatedStatusName == 'Completed') { - $statusMsg .= "
" . ts("Pledge Payment for %1 has been updated.", array(1 => $userDisplayName)); + $statusMsg .= "
" . ts("Pledge Payment for %1 has been updated.", [1 => $userDisplayName]); } } } @@ -5137,7 +5215,7 @@ public static function transitionComponentWithReturnMessage($contributionId, $st * @return \CRM_Contribute_BAO_Contribution|null */ private static function getOriginalContribution($contributionID) { - return self::getValues(array('id' => $contributionID), CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray); + return self::getValues(['id' => $contributionID], CRM_Core_DAO::$_nullArray, CRM_Core_DAO::$_nullArray); } /** @@ -5151,8 +5229,6 @@ private static function getOriginalContribution($contributionID) { * for historical reasons. Going forwards we can hope to add tests & improve readibility * of that function * - * @todo move recordFinancialAccounts & helper functions to their own class? - * * @param array $params * Params as passed to contribution.create * @@ -5165,6 +5241,8 @@ private static function getOriginalContribution($contributionID) { * @param int $previousLineItemTotal * * @return float + * @todo move recordFinancialAccounts & helper functions to their own class? + * */ protected static function getFinancialItemAmountFromParams($params, $context, $lineItemDetails, $isARefund, $previousLineItemTotal) { if ($context == 'changedAmount') { @@ -5191,7 +5269,7 @@ protected static function getFinancialItemAmountFromParams($params, $context, $l elseif (empty($lineItemDetails['line_total'])) { // follow legacy code path Civi::log() - ->warning('Deprecated bit of code, please log a ticket explaining how you got here!', array('civi.tag' => 'deprecated')); + ->warning('Deprecated bit of code, please log a ticket explaining how you got here!', ['civi.tag' => 'deprecated']); return $params['total_amount']; } else { @@ -5276,13 +5354,13 @@ protected static function isPaymentInstrumentChange(&$params, $pendingStatuses) public static function updateMembershipBasedOnCompletionOfContribution($contribution, $primaryContributionID, $changeDate) { $memberships = self::getRelatedMemberships($contribution->id); foreach ($memberships as $membership) { - $membershipParams = array( + $membershipParams = [ 'id' => $membership['id'], 'contact_id' => $membership['contact_id'], 'is_test' => $membership['is_test'], 'membership_type_id' => $membership['membership_type_id'], 'membership_activity_status' => 'Completed', - ); + ]; $currentMembership = CRM_Member_BAO_Membership::getContactMembership($membershipParams['contact_id'], $membershipParams['membership_type_id'], @@ -5313,11 +5391,11 @@ public static function updateMembershipBasedOnCompletionOfContribution($contribu ); // @todo remove all this stuff in favour of letting the api call further down handle in // (it is a duplication of what the api does). - $dates = array_fill_keys(array( + $dates = array_fill_keys([ 'join_date', 'start_date', 'end_date', - ), NULL); + ], NULL); if ($currentMembership) { /* * Fixed FOR CRM-4433 @@ -5380,39 +5458,39 @@ protected static function getContributionPaymentLinks($id, $balance, $contributi // but not for Failed contributions, where we don't accept additional payments at the moment. // (in some cases the contribution is 'Pending' and only the payment is failed. In those we // do accept more payments agains them. - return array(); + return []; } - $actionLinks = array(); + $actionLinks = []; if ((int) $balance > 0) { if (CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()) { - $actionLinks[] = array( - 'url' => CRM_Utils_System::url('civicrm/payment', array( + $actionLinks[] = [ + 'url' => CRM_Utils_System::url('civicrm/payment', [ 'action' => 'add', 'reset' => 1, 'id' => $id, 'mode' => 'live', - )), + ]), 'title' => ts('Submit Credit Card payment'), - ); + ]; } - $actionLinks[] = array( - 'url' => CRM_Utils_System::url('civicrm/payment', array( + $actionLinks[] = [ + 'url' => CRM_Utils_System::url('civicrm/payment', [ 'action' => 'add', 'reset' => 1, 'id' => $id, - )), + ]), 'title' => ts('Record Payment'), - ); + ]; } elseif ((int) $balance < 0) { - $actionLinks[] = array( - 'url' => CRM_Utils_System::url('civicrm/payment', array( + $actionLinks[] = [ + 'url' => CRM_Utils_System::url('civicrm/payment', [ 'action' => 'add', 'reset' => 1, 'id' => $id, - )), + ]), 'title' => ts('Record Refund'), - ); + ]; } return $actionLinks; } @@ -5558,7 +5636,7 @@ public static function allowUpdateRevenueRecognitionDate($contributionId) { * @return null */ public static function recordAlwaysAccountsReceivable(&$trxnParams, $contributionParams) { - if (!self::checkContributeSettings('always_post_to_accounts_receivable')) { + if (!Civi::settings()->get('always_post_to_accounts_receivable')) { return NULL; } $statusId = $contributionParams['contribution']->contribution_status_id; @@ -5567,9 +5645,9 @@ public static function recordAlwaysAccountsReceivable(&$trxnParams, $contributio $previousContributionStatus = empty($contributionParams['prevContribution']) ? NULL : $contributionStatuses[$contributionParams['prevContribution']->contribution_status_id]; // Return if contribution status is not completed. if (!($contributionStatus == 'Completed' && (empty($previousContributionStatus) - || (!empty($previousContributionStatus) && $previousContributionStatus == 'Pending' - && $contributionParams['prevContribution']->is_pay_later == 0 - ))) + || (!empty($previousContributionStatus) && $previousContributionStatus == 'Pending' + && $contributionParams['prevContribution']->is_pay_later == 0 + ))) ) { return NULL; } @@ -5628,9 +5706,9 @@ public static function getSalesTaxFinancialAccounts() { INNER JOIN civicrm_financial_account cfa ON ce.financial_account_id = cfa.id WHERE `entity_table` = 'civicrm_financial_type' AND cfa.is_tax = 1 AND ce.account_relationship = %1 GROUP BY cfa.id"; $accountRel = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Sales Tax Account is' ")); - $queryParams = array(1 => array($accountRel, 'Integer')); + $queryParams = [1 => [$accountRel, 'Integer']]; $dao = CRM_Core_DAO::executeQuery($query, $queryParams); - $financialAccount = array(); + $financialAccount = []; while ($dao->fetch()) { $financialAccount[$dao->id] = $dao->id; } @@ -5644,6 +5722,7 @@ public static function getSalesTaxFinancialAccounts() { * * @param array $eftParams * + * @throws \CiviCRM_API3_Exception */ public static function createProportionalEntry($entityParams, $eftParams) { $paid = 0; @@ -5667,22 +5746,27 @@ public static function getLastFinancialItemIds($contributionId) { FROM civicrm_financial_item fi INNER JOIN civicrm_line_item li ON li.id = fi.entity_id and fi.entity_table = 'civicrm_line_item' WHERE li.contribution_id = %1"; - $dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($contributionId, 'Integer'))); - $ftIds = $taxItems = array(); + $dao = CRM_Core_DAO::executeQuery($sql, [ + 1 => [ + $contributionId, + 'Integer', + ], + ]); + $ftIds = $taxItems = []; $salesTaxFinancialAccount = self::getSalesTaxFinancialAccounts(); while ($dao->fetch()) { /* if sales tax item*/ if (in_array($dao->financial_account_id, $salesTaxFinancialAccount)) { - $taxItems[$dao->price_field_value_id] = array( + $taxItems[$dao->price_field_value_id] = [ 'financial_item_id' => $dao->id, 'amount' => $dao->tax_amount, - ); + ]; } else { $ftIds[$dao->price_field_value_id] = $dao->id; } } - return array($ftIds, $taxItems); + return [$ftIds, $taxItems]; } /** @@ -5696,12 +5780,13 @@ public static function getLastFinancialItemIds($contributionId) { * * @param array $taxItems * + * @throws \CiviCRM_API3_Exception */ public static function createProportionalFinancialEntries($entityParams, $lineItems, $ftIds, $taxItems) { - $eftParams = array( + $eftParams = [ 'entity_table' => 'civicrm_financial_item', 'financial_trxn_id' => $entityParams['trxn_id'], - ); + ]; foreach ($lineItems as $key => $value) { if ($value['qty'] == 0) { continue; @@ -5725,13 +5810,13 @@ public static function createProportionalFinancialEntries($entityParams, $lineIt * @throws \CRM_Core_Exception */ protected function loadRelatedEntitiesByID($ids) { - $entities = array( + $entities = [ 'contact' => 'CRM_Contact_BAO_Contact', 'contributionRecur' => 'CRM_Contribute_BAO_ContributionRecur', 'contributionType' => 'CRM_Financial_BAO_FinancialType', 'financialType' => 'CRM_Financial_BAO_FinancialType', 'contributionPage' => 'CRM_Contribute_BAO_ContributionPage', - ); + ]; foreach ($entities as $entity => $bao) { if (!empty($ids[$entity])) { $this->_relatedObjects[$entity] = new $bao(); @@ -5778,6 +5863,7 @@ protected function isEmailReceipt($input) { * @param bool $escapeSmarty * * @return array + * @throws \CiviCRM_API3_Exception */ public static function replaceContributionTokens( $contributionIds, @@ -5789,11 +5875,11 @@ public static function replaceContributionTokens( $escapeSmarty ) { if (empty($contributionIds)) { - return array(); + return []; } - $contributionDetails = array(); + $contributionDetails = []; foreach ($contributionIds as $id) { - $result = civicrm_api3('Contribution', 'get', array('id' => $id)); + $result = civicrm_api3('Contribution', 'get', ['id' => $id]); $contributionDetails[$result['values'][$result['id']]['contact_id']]['subject'] = CRM_Utils_Token::replaceContributionTokens($subject, $result, FALSE, $subjectToken, FALSE, $escapeSmarty); $contributionDetails[$result['values'][$result['id']]['contact_id']]['text'] = CRM_Utils_Token::replaceContributionTokens($text, $result, FALSE, $messageToken, FALSE, $escapeSmarty); $contributionDetails[$result['values'][$result['id']]['contact_id']]['html'] = CRM_Utils_Token::replaceContributionTokens($html, $result, FALSE, $messageToken, FALSE, $escapeSmarty); diff --git a/CRM/Contribute/BAO/Widget.php b/CRM/Contribute/BAO/Widget.php index 45ecc4116cf8..e4bff0b4ffec 100644 --- a/CRM/Contribute/BAO/Widget.php +++ b/CRM/Contribute/BAO/Widget.php @@ -127,6 +127,7 @@ public static function getContributionPageData($contributionPageID, $widgetID, $ $now = time(); if ($dao->start_date) { $startDate = CRM_Utils_Date::unixTime($dao->start_date); + $data['start_date'] = $dao->start_date; if ($startDate && $startDate >= $now) { $data['is_active'] = FALSE; $data['campaign_start'] = ts('Campaign starts on %1', [ @@ -137,6 +138,7 @@ public static function getContributionPageData($contributionPageID, $widgetID, $ if ($dao->end_date) { $endDate = CRM_Utils_Date::unixTime($dao->end_date); + $data['end_date'] = $dao->end_date; if ($endDate && $endDate < $now ) { diff --git a/CRM/Contribute/DAO/Contribution.php b/CRM/Contribute/DAO/Contribution.php index c95672ed773e..54b70dd9066b 100644 --- a/CRM/Contribute/DAO/Contribution.php +++ b/CRM/Contribute/DAO/Contribution.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/Contribution.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:99cdf75ae6e6bf73bc5ff6871a3baf82) + * (GenCodeChecksum:67d7c56983261917119041820da97eb8) */ /** @@ -31,35 +31,35 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO { /** * Contribution ID * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * FK to Financial Type for (total_amount - non_deductible_amount). * - * @var int unsigned + * @var int */ public $financial_type_id; /** * The Contribution Page which triggered this contribution * - * @var int unsigned + * @var int */ public $contribution_page_id; /** * FK to Payment Instrument * - * @var int unsigned + * @var int */ public $payment_instrument_id; @@ -167,29 +167,29 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO { /** * Conditional foreign key to civicrm_contribution_recur id. Each contribution made in connection with a recurring contribution carries a foreign key to the recurring contribution record. This assumes we can track these processor initiated events. * - * @var int unsigned + * @var int */ public $contribution_recur_id; /** - * @var boolean + * @var bool */ public $is_test; /** - * @var boolean + * @var bool */ public $is_pay_later; /** - * @var int unsigned + * @var int */ public $contribution_status_id; /** * Conditional foreign key to civicrm_address.id. We insert an address record for each contribution when we have associated billing name and address data. * - * @var int unsigned + * @var int */ public $address_id; @@ -201,7 +201,7 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO { /** * The campaign for which this contribution has been triggered. * - * @var int unsigned + * @var int */ public $campaign_id; @@ -315,7 +315,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'contribution_page_id' => [ 'name' => 'contribution_page_id', @@ -337,7 +337,7 @@ public static function &fields() { 'table' => 'civicrm_contribution_page', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'payment_instrument_id' => [ 'name' => 'payment_instrument_id', @@ -357,7 +357,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ] + ], ], 'receive_date' => [ 'name' => 'receive_date', @@ -550,7 +550,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'cancel_date' => [ 'name' => 'cancel_date', @@ -723,7 +723,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'contribution_status', 'optionEditPath' => 'civicrm/admin/options/contribution_status', - ] + ], ], 'contribution_address_id' => [ 'name' => 'address_id', @@ -776,7 +776,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'creditnote_id' => [ 'name' => 'creditnote_id', diff --git a/CRM/Contribute/DAO/ContributionPage.php b/CRM/Contribute/DAO/ContributionPage.php index e75fa97d995e..c1b45382c739 100644 --- a/CRM/Contribute/DAO/ContributionPage.php +++ b/CRM/Contribute/DAO/ContributionPage.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/ContributionPage.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:923a4b6d8829d7aa6cc24e18d62114ff) + * (GenCodeChecksum:c7122b219c06cf7e22ca2d5dfe8fd77c) */ /** @@ -31,7 +31,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * Contribution Id * - * @var int unsigned + * @var int */ public $id; @@ -52,7 +52,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * default financial type assigned to contributions submitted via this page, e.g. Contribution, Campaign Contribution * - * @var int unsigned + * @var int */ public $financial_type_id; @@ -66,28 +66,28 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - processing logic must reject transaction at confirmation stage if pay method != credit card * - * @var boolean + * @var bool */ public $is_credit_card_only; /** * if true - allows real-time monetary transactions otherwise non-monetary transactions * - * @var boolean + * @var bool */ public $is_monetary; /** * if true - allows recurring contributions, valid only for PayPal_Standard * - * @var boolean + * @var bool */ public $is_recur; /** * if false, the confirm page in contribution pages gets skipped * - * @var boolean + * @var bool */ public $is_confirm_enabled; @@ -101,28 +101,28 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - supports recurring intervals * - * @var boolean + * @var bool */ public $is_recur_interval; /** * if true - asks user for recurring installments * - * @var boolean + * @var bool */ public $is_recur_installments; /** * if true - user is able to adjust payment start date * - * @var boolean + * @var bool */ public $adjust_recur_start_date; /** * if true - allows the user to send payment directly to the org later * - * @var boolean + * @var bool */ public $is_pay_later; @@ -143,7 +143,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * is partial payment enabled for this online contribution page * - * @var boolean + * @var bool */ public $is_partial_payment; @@ -171,14 +171,14 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true, page will include an input text field where user can enter their own amount * - * @var boolean + * @var bool */ public $is_allow_other_amount; /** * FK to civicrm_option_value. * - * @var int unsigned + * @var int */ public $default_amount_id; @@ -227,7 +227,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true, receipt is automatically emailed to contact on success * - * @var boolean + * @var bool */ public $is_email_receipt; @@ -269,7 +269,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; @@ -283,7 +283,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * Is this property active? * - * @var boolean + * @var bool */ public $amount_block_is_active; @@ -304,7 +304,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * FK to civicrm_contact, who created this contribution page * - * @var int unsigned + * @var int */ public $created_id; @@ -325,21 +325,21 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * The campaign for which we are collecting contributions with this page. * - * @var int unsigned + * @var int */ public $campaign_id; /** * Can people share the contribution page through social media? * - * @var boolean + * @var bool */ public $is_share; /** * if true - billing block is required for online contribution page * - * @var boolean + * @var bool */ public $is_billing_required; @@ -435,7 +435,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'payment_processor' => [ 'name' => 'payment_processor', @@ -456,7 +456,7 @@ public static function &fields() { 'table' => 'civicrm_payment_processor', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'is_credit_card_only' => [ 'name' => 'is_credit_card_only', @@ -526,7 +526,7 @@ public static function &fields() { 'optionGroupName' => 'recur_frequency_units', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', - ] + ], ], 'is_recur_interval' => [ 'name' => 'is_recur_interval', @@ -949,7 +949,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'campaign_id' => [ 'name' => 'campaign_id', @@ -966,7 +966,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'is_share' => [ 'name' => 'is_share', diff --git a/CRM/Contribute/DAO/ContributionProduct.php b/CRM/Contribute/DAO/ContributionProduct.php index 8fa970114ce3..5913150b44b5 100644 --- a/CRM/Contribute/DAO/ContributionProduct.php +++ b/CRM/Contribute/DAO/ContributionProduct.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/ContributionProduct.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:b5a1b3fa2819c4dfe99635fef8583a42) + * (GenCodeChecksum:565e6473df8dd62f25ba951b18860b5c) */ /** @@ -29,17 +29,17 @@ class CRM_Contribute_DAO_ContributionProduct extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; /** - * @var int unsigned + * @var int */ public $product_id; /** - * @var int unsigned + * @var int */ public $contribution_id; @@ -84,7 +84,7 @@ class CRM_Contribute_DAO_ContributionProduct extends CRM_Core_DAO { /** * FK to Financial Type(for membership price sets only). * - * @var int unsigned + * @var int */ public $financial_type_id; @@ -245,7 +245,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Contribute/DAO/ContributionRecur.php b/CRM/Contribute/DAO/ContributionRecur.php index 525f08b968f5..dbbbb137f022 100644 --- a/CRM/Contribute/DAO/ContributionRecur.php +++ b/CRM/Contribute/DAO/ContributionRecur.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9859d3b98d51f0f1df207253199186ab) + * (GenCodeChecksum:4af8fee211119c1b0184dd09932c546e) */ /** @@ -31,14 +31,14 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { /** * Contribution Recur ID * - * @var int unsigned + * @var int */ public $id; /** * Foreign key to civicrm_contact.id. * - * @var int unsigned + * @var int */ public $contact_id; @@ -66,14 +66,14 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { /** * Number of time units for recurrence of payment. * - * @var int unsigned + * @var int */ public $frequency_interval; /** * Total number of payments to be made. Set this to 0 if this is an open-ended commitment i.e. no set end date. * - * @var int unsigned + * @var int */ public $installments; @@ -129,7 +129,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { /** * Optionally used to store a link to a payment token used for this recurring contribution. * - * @var int unsigned + * @var int */ public $payment_token_id; @@ -148,19 +148,19 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { public $invoice_id; /** - * @var int unsigned + * @var int */ public $contribution_status_id; /** - * @var boolean + * @var bool */ public $is_test; /** * Day in the period when the payment should be charged e.g. 1st of month, 15th etc. * - * @var int unsigned + * @var int */ public $cycle_day; @@ -174,7 +174,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { /** * Number of failed charge attempts since last success. Business rule could be set to deactivate on more than x failures. * - * @var int unsigned + * @var int */ public $failure_count; @@ -188,42 +188,42 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { /** * Some systems allow contributor to set a number of installments - but then auto-renew the subscription or commitment if they do not cancel. * - * @var boolean + * @var bool */ public $auto_renew; /** * Foreign key to civicrm_payment_processor.id * - * @var int unsigned + * @var int */ public $payment_processor_id; /** * FK to Financial Type * - * @var int unsigned + * @var int */ public $financial_type_id; /** * FK to Payment Instrument * - * @var int unsigned + * @var int */ public $payment_instrument_id; /** * The campaign for which this contribution has been triggered. * - * @var int unsigned + * @var int */ public $campaign_id; /** * if true, receipt is automatically emailed to contact on each successful payment * - * @var boolean + * @var bool */ public $is_email_receipt; @@ -330,7 +330,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'frequency_unit' => [ 'name' => 'frequency_unit', @@ -352,7 +352,7 @@ public static function &fields() { 'optionGroupName' => 'recur_frequency_units', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', - ] + ], ], 'frequency_interval' => [ 'name' => 'frequency_interval', @@ -552,7 +552,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'contribution_status', 'optionEditPath' => 'civicrm/admin/options/contribution_status', - ] + ], ], 'is_test' => [ 'name' => 'is_test', @@ -665,7 +665,7 @@ public static function &fields() { 'table' => 'civicrm_payment_processor', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'financial_type_id' => [ 'name' => 'financial_type_id', @@ -686,7 +686,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'payment_instrument_id' => [ 'name' => 'payment_instrument_id', @@ -704,7 +704,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ] + ], ], 'contribution_campaign_id' => [ 'name' => 'campaign_id', @@ -726,7 +726,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'is_email_receipt' => [ 'name' => 'is_email_receipt', diff --git a/CRM/Contribute/DAO/ContributionSoft.php b/CRM/Contribute/DAO/ContributionSoft.php index 75f2dcd4a760..812701f4e7c4 100644 --- a/CRM/Contribute/DAO/ContributionSoft.php +++ b/CRM/Contribute/DAO/ContributionSoft.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/ContributionSoft.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:b9a4bdee130cdaf934a53e456cd0e3e8) + * (GenCodeChecksum:e14061776c0e1add8462e32454a01fe1) */ /** @@ -31,21 +31,21 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO { /** * Soft Contribution ID * - * @var int unsigned + * @var int */ public $id; /** * FK to contribution table. * - * @var int unsigned + * @var int */ public $contribution_id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; @@ -66,12 +66,12 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO { /** * FK to civicrm_pcp.id * - * @var int unsigned + * @var int */ public $pcp_id; /** - * @var boolean + * @var bool */ public $pcp_display_in_roll; @@ -88,7 +88,7 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO { /** * Soft Credit Type ID.Implicit FK to civicrm_option_value where option_group = soft_credit_type. * - * @var int unsigned + * @var int */ public $soft_credit_type_id; @@ -210,7 +210,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'pcp_id' => [ 'name' => 'pcp_id', @@ -228,7 +228,7 @@ public static function &fields() { 'table' => 'civicrm_pcp', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'pcp_display_in_roll' => [ 'name' => 'pcp_display_in_roll', @@ -284,7 +284,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'soft_credit_type', 'optionEditPath' => 'civicrm/admin/options/soft_credit_type', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Contribute/DAO/Premium.php b/CRM/Contribute/DAO/Premium.php index 8302aef5e581..48a7bfcd2d29 100644 --- a/CRM/Contribute/DAO/Premium.php +++ b/CRM/Contribute/DAO/Premium.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/Premium.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:09b04d3dd373d7dc64bc873b56b5e171) + * (GenCodeChecksum:5193d923732bb6b983b32e86e9441d72) */ /** @@ -29,7 +29,7 @@ class CRM_Contribute_DAO_Premium extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; @@ -41,14 +41,14 @@ class CRM_Contribute_DAO_Premium extends CRM_Core_DAO { public $entity_table; /** - * @var int unsigned + * @var int */ public $entity_id; /** * Is the Premiums feature enabled for this page? * - * @var boolean + * @var bool */ public $premiums_active; @@ -83,7 +83,7 @@ class CRM_Contribute_DAO_Premium extends CRM_Core_DAO { /** * Boolean. Should we automatically display minimum contribution amount text after the premium descriptions. * - * @var boolean + * @var bool */ public $premiums_display_min_contribution; @@ -95,7 +95,7 @@ class CRM_Contribute_DAO_Premium extends CRM_Core_DAO { public $premiums_nothankyou_label; /** - * @var int unsigned + * @var int */ public $premiums_nothankyou_position; diff --git a/CRM/Contribute/DAO/PremiumsProduct.php b/CRM/Contribute/DAO/PremiumsProduct.php index ff19638fb757..cdc9f3e15430 100644 --- a/CRM/Contribute/DAO/PremiumsProduct.php +++ b/CRM/Contribute/DAO/PremiumsProduct.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:b6944ad257ea16a60d6c1cf79ca391b0) + * (GenCodeChecksum:400970a4b33e5fc5af3784b5dbf9f90c) */ /** @@ -31,33 +31,33 @@ class CRM_Contribute_DAO_PremiumsProduct extends CRM_Core_DAO { /** * Contribution ID * - * @var int unsigned + * @var int */ public $id; /** * Foreign key to premiums settings record. * - * @var int unsigned + * @var int */ public $premiums_id; /** * Foreign key to each product object. * - * @var int unsigned + * @var int */ public $product_id; /** - * @var int unsigned + * @var int */ public $weight; /** * FK to Financial Type. * - * @var int unsigned + * @var int */ public $financial_type_id; @@ -159,7 +159,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Contribute/DAO/Product.php b/CRM/Contribute/DAO/Product.php index e897a5476606..a5fdc7f728c6 100644 --- a/CRM/Contribute/DAO/Product.php +++ b/CRM/Contribute/DAO/Product.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/Product.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:7db77c58d48112d25da791aba4586080) + * (GenCodeChecksum:6bebe01d00d19465a5536aa561934fbc) */ /** @@ -29,7 +29,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; @@ -92,7 +92,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO { /** * FK to Financial Type. * - * @var int unsigned + * @var int */ public $financial_type_id; @@ -113,7 +113,7 @@ class CRM_Contribute_DAO_Product extends CRM_Core_DAO { /** * Disabling premium removes it from the premiums_premium join table below. * - * @var boolean + * @var bool */ public $is_active; @@ -313,7 +313,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'financial_type_id' => [ 'name' => 'financial_type_id', @@ -331,7 +331,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'min_contribution' => [ 'name' => 'min_contribution', @@ -394,7 +394,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::periodType', - ] + ], ], 'fixed_period_start_day' => [ 'name' => 'fixed_period_start_day', @@ -425,7 +425,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getPremiumUnits', - ] + ], ], 'duration_interval' => [ 'name' => 'duration_interval', @@ -456,7 +456,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getPremiumUnits', - ] + ], ], 'frequency_interval' => [ 'name' => 'frequency_interval', diff --git a/CRM/Contribute/DAO/Widget.php b/CRM/Contribute/DAO/Widget.php index 9d77dfb9bfb3..aa2cbc3fab30 100644 --- a/CRM/Contribute/DAO/Widget.php +++ b/CRM/Contribute/DAO/Widget.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/Widget.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:0605d26592e841a169687b225d891bc8) + * (GenCodeChecksum:c958a95fa7e2ff07a891780d343cd308) */ /** @@ -31,21 +31,21 @@ class CRM_Contribute_DAO_Widget extends CRM_Core_DAO { /** * Contribution Id * - * @var int unsigned + * @var int */ public $id; /** * The Contribution Page which triggered this contribution * - * @var int unsigned + * @var int */ public $contribution_page_id; /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; diff --git a/CRM/Contribute/Form/AbstractEditPayment.php b/CRM/Contribute/Form/AbstractEditPayment.php index f410a2bf7130..62f1fe7a0b30 100644 --- a/CRM/Contribute/Form/AbstractEditPayment.php +++ b/CRM/Contribute/Form/AbstractEditPayment.php @@ -151,7 +151,7 @@ class CRM_Contribute_Form_AbstractEditPayment extends CRM_Contact_Form_Task { * Is this contribution associated with an online * financial transaction * - * @var boolean + * @var bool */ public $_online = FALSE; diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index ab46198a0b7a..f426a800e821 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -75,7 +75,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP * Is this contribution associated with an online. * financial transaction * - * @var boolean + * @var bool */ public $_online = FALSE; @@ -692,7 +692,7 @@ public function buildQuickForm() { } // CRM-16189, add Revenue Recognition Date - if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) { + if (Civi::settings()->get('deferred_revenue_enabled')) { $revenueDate = $this->add('date', 'revenue_recognition_date', ts('Revenue Recognition Date'), CRM_Core_SelectValues::date(NULL, 'M Y', NULL, 5)); if ($this->_id && !CRM_Contribute_BAO_Contribution::allowUpdateRevenueRecognitionDate($this->_id)) { $revenueDate->freeze(); diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index 971479e6332d..28ff5f2aaf90 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -176,7 +176,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { /** * Contribution page supports memberships - * @var boolean + * @var bool */ public $_useForMember; diff --git a/CRM/Contribute/Form/ContributionPage.php b/CRM/Contribute/Form/ContributionPage.php index d47d7a522407..0c3833443d0d 100644 --- a/CRM/Contribute/Form/ContributionPage.php +++ b/CRM/Contribute/Form/ContributionPage.php @@ -53,21 +53,21 @@ class CRM_Contribute_Form_ContributionPage extends CRM_Core_Form { /** * Are we in single form mode or wizard mode? * - * @var boolean + * @var bool */ protected $_single; /** * Is this the first page? * - * @var boolean + * @var bool */ protected $_first = FALSE; /** * Is this the last page? * - * @var boolean + * @var bool */ protected $_last = FALSE; diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index 8351b6d9ad8b..c4281faffeda 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -46,14 +46,14 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Contribute/Form/Task.php b/CRM/Contribute/Form/Task.php index fac10e2ac666..bd509799230a 100644 --- a/CRM/Contribute/Form/Task.php +++ b/CRM/Contribute/Form/Task.php @@ -54,7 +54,7 @@ class CRM_Contribute_Form_Task extends CRM_Core_Form_Task { /** * The flag to tell if there are soft credits included. * - * @var boolean + * @var bool */ public $_includesSoftCredits = FALSE; diff --git a/CRM/Contribute/Form/Task/Delete.php b/CRM/Contribute/Form/Task/Delete.php index 8601ee564c11..0722cd9541a6 100644 --- a/CRM/Contribute/Form/Task/Delete.php +++ b/CRM/Contribute/Form/Task/Delete.php @@ -42,7 +42,7 @@ class CRM_Contribute_Form_Task_Delete extends CRM_Contribute_Form_Task { * Are we operating in "single mode", i.e. deleting one * specific contribution? * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Contribute/Form/Task/Email.php b/CRM/Contribute/Form/Task/Email.php index 1300c85d5e7e..56cb5d471b49 100644 --- a/CRM/Contribute/Form/Task/Email.php +++ b/CRM/Contribute/Form/Task/Email.php @@ -40,7 +40,7 @@ class CRM_Contribute_Form_Task_Email extends CRM_Contribute_Form_Task { * Are we operating in "single mode", i.e. sending email to one * specific contact? * - * @var boolean + * @var bool */ public $_single = FALSE; diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index f2742ee109e2..a38c5e93274c 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -43,7 +43,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { * Are we operating in "single mode", i.e. updating the task of only * one specific contribution? * - * @var boolean + * @var bool */ public $_single = FALSE; diff --git a/CRM/Contribute/Form/Task/PDF.php b/CRM/Contribute/Form/Task/PDF.php index c27b4fd176ac..96d9985e9ae1 100644 --- a/CRM/Contribute/Form/Task/PDF.php +++ b/CRM/Contribute/Form/Task/PDF.php @@ -41,7 +41,7 @@ class CRM_Contribute_Form_Task_PDF extends CRM_Contribute_Form_Task { * Are we operating in "single mode", i.e. updating the task of only * one specific contribution? * - * @var boolean + * @var bool */ public $_single = FALSE; diff --git a/CRM/Contribute/Form/Task/Status.php b/CRM/Contribute/Form/Task/Status.php index 348ed223870d..bc291dc167b3 100644 --- a/CRM/Contribute/Form/Task/Status.php +++ b/CRM/Contribute/Form/Task/Status.php @@ -40,7 +40,7 @@ class CRM_Contribute_Form_Task_Status extends CRM_Contribute_Form_Task { * Are we operating in "single mode", i.e. updating the task of only * one specific contribution? * - * @var boolean + * @var bool */ public $_single = FALSE; diff --git a/CRM/Contribute/Import/Field.php b/CRM/Contribute/Import/Field.php index 969441ef83e9..83943e405a39 100644 --- a/CRM/Contribute/Import/Field.php +++ b/CRM/Contribute/Import/Field.php @@ -56,8 +56,9 @@ class CRM_Contribute_Import_Field { public $_type; /** - * Is this field required - * @var boolean + * Is this field required. + * + * @var bool */ public $_required; diff --git a/CRM/Contribute/Import/Parser.php b/CRM/Contribute/Import/Parser.php index 939eef3d8018..9ceac6a63d6e 100644 --- a/CRM/Contribute/Import/Parser.php +++ b/CRM/Contribute/Import/Parser.php @@ -114,7 +114,7 @@ abstract class CRM_Contribute_Import_Parser extends CRM_Import_Parser { /** * Whether the file has a column header or not * - * @var boolean + * @var bool */ protected $_haveColumnHeader; diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index f2250641c625..1c2d23a3bc42 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -83,14 +83,14 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Core/BAO/ActionSchedule.php b/CRM/Core/BAO/ActionSchedule.php index af9acb87a39d..ba2130a493df 100644 --- a/CRM/Core/BAO/ActionSchedule.php +++ b/CRM/Core/BAO/ActionSchedule.php @@ -546,6 +546,12 @@ protected static function sendReminderSms($tokenRow, $schedule, $toContactID) { return ["sms_phone_missing" => "Couldn't find recipient's phone number."]; } + // dev/core#369 If an SMS provider is deleted then the relevant row in the action_schedule_table is set to NULL + // So we need to exclude them. + if (CRM_Utils_System::isNull($schedule->sms_provider_id)) { + return ["sms_provider_missing" => "SMS reminder cannot be sent because the SMS provider has been deleted."]; + } + $messageSubject = $tokenRow->render('subject'); $sms_body_text = $tokenRow->render('sms_body_text'); diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 3ce2b0cdbb2b..cbe0066deca0 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -1318,6 +1318,9 @@ public static function buildOptions($fieldName, $context = NULL, $props = []) { } } if (!empty($props['country_id'])) { + if (!CRM_Utils_Rule::commaSeparatedIntegers(implode(',', (array) $props['country_id']))) { + throw new CRM_Core_Exception(ts('Province limit or default country setting is incorrect')); + } $params['condition'] = 'country_id IN (' . implode(',', (array) $props['country_id']) . ')'; } break; @@ -1330,6 +1333,9 @@ public static function buildOptions($fieldName, $context = NULL, $props = []) { if ($context != 'get' && $context != 'validate') { $config = CRM_Core_Config::singleton(); if (!empty($config->countryLimit) && is_array($config->countryLimit)) { + if (!CRM_Utils_Rule::commaSeparatedIntegers(implode(',', $config->countryLimit))) { + throw new CRM_Core_Exception(ts('Available Country setting is incorrect')); + } $params['condition'] = 'id IN (' . implode(',', $config->countryLimit) . ')'; } } @@ -1338,6 +1344,9 @@ public static function buildOptions($fieldName, $context = NULL, $props = []) { // Filter county list based on chosen state case 'county_id': if (!empty($props['state_province_id'])) { + if (!CRM_Utils_Rule::commaSeparatedIntegers(implode(',', (array) $props['state_province_id']))) { + throw new CRM_Core_Exception(ts('Can only accept Integers for state_province_id filtering')); + } $params['condition'] = 'state_province_id IN (' . implode(',', (array) $props['state_province_id']) . ')'; } break; diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 19f1ce3bf507..5c49f22862c3 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -599,7 +599,7 @@ public static function &getFields( if (!empty($customDataSubType)) { $subtypeClause = array(); foreach ($customDataSubType as $subtype) { - $subtype = CRM_Core_DAO::VALUE_SEPARATOR . $subtype . CRM_Core_DAO::VALUE_SEPARATOR; + $subtype = CRM_Core_DAO::VALUE_SEPARATOR . CRM_Utils_Type::escape($subtype, 'String') . CRM_Core_DAO::VALUE_SEPARATOR; $subtypeClause[] = "$cgTable.extends_entity_column_value LIKE '%{$subtype}%'"; } if (!$onlySubType) { diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php index d20a3188d916..b74b6637bd08 100644 --- a/CRM/Core/BAO/CustomGroup.php +++ b/CRM/Core/BAO/CustomGroup.php @@ -481,6 +481,7 @@ public static function getTree( $params = []; $sqlParamKey = 1; + $subType = ''; if (!empty($subTypes)) { foreach ($subTypes as $key => $subType) { $subTypeClauses[] = self::whereListHas("civicrm_custom_group.extends_entity_column_value", self::validateSubTypeByEntity($entityType, $subType)); @@ -562,67 +563,7 @@ public static function getTree( } if (empty($groupTree)) { - $groupTree = $multipleFieldGroups = []; - $crmDAO = CRM_Core_DAO::executeQuery($queryString, $params); - $customValueTables = []; - - // process records - while ($crmDAO->fetch()) { - // get the id's - $groupID = $crmDAO->civicrm_custom_group_id; - $fieldId = $crmDAO->civicrm_custom_field_id; - if ($crmDAO->civicrm_custom_group_is_multiple) { - $multipleFieldGroups[$groupID] = $crmDAO->civicrm_custom_group_table_name; - } - // create an array for groups if it does not exist - if (!array_key_exists($groupID, $groupTree)) { - $groupTree[$groupID] = []; - $groupTree[$groupID]['id'] = $groupID; - - // populate the group information - foreach ($toReturn['custom_group'] as $fieldName) { - $fullFieldName = "civicrm_custom_group_$fieldName"; - if ($fieldName == 'id' || - is_null($crmDAO->$fullFieldName) - ) { - continue; - } - // CRM-5507 - // This is an old bit of code - per the CRM number & probably does not work reliably if - // that one contact sub-type exists. - if ($fieldName == 'extends_entity_column_value' && !empty($subTypes[0])) { - $groupTree[$groupID]['subtype'] = self::validateSubTypeByEntity($entityType, $subType); - } - $groupTree[$groupID][$fieldName] = $crmDAO->$fullFieldName; - } - $groupTree[$groupID]['fields'] = []; - - $customValueTables[$crmDAO->civicrm_custom_group_table_name] = []; - } - - // add the fields now (note - the query row will always contain a field) - // we only reset this once, since multiple values come is as multiple rows - if (!array_key_exists($fieldId, $groupTree[$groupID]['fields'])) { - $groupTree[$groupID]['fields'][$fieldId] = []; - } - - $customValueTables[$crmDAO->civicrm_custom_group_table_name][$crmDAO->civicrm_custom_field_column_name] = 1; - $groupTree[$groupID]['fields'][$fieldId]['id'] = $fieldId; - // populate information for a custom field - foreach ($toReturn['custom_field'] as $fieldName) { - $fullFieldName = "civicrm_custom_field_$fieldName"; - if ($fieldName == 'id' || - is_null($crmDAO->$fullFieldName) - ) { - continue; - } - $groupTree[$groupID]['fields'][$fieldId][$fieldName] = $crmDAO->$fullFieldName; - } - } - - if (!empty($customValueTables)) { - $groupTree['info'] = ['tables' => $customValueTables]; - } + list($multipleFieldGroups, $groupTree) = self::buildGroupTree($entityType, $toReturn, $subTypes, $queryString, $params, $subType); $cache->set($cacheKey, $groupTree); $cache->set($multipleFieldGroupCacheKey, $multipleFieldGroups); @@ -2212,4 +2153,82 @@ public static function getMultipleFieldGroup() { return $multipleGroup; } + /** + * Build the metadata tree for the custom group. + * + * @param string $entityType + * @param array $toReturn + * @param array $subTypes + * @param string $queryString + * @param array $params + * @param string $subType + * + * @return array + * @throws \CRM_Core_Exception + */ + private static function buildGroupTree($entityType, $toReturn, $subTypes, $queryString, $params, $subType) { + $groupTree = $multipleFieldGroups = []; + $crmDAO = CRM_Core_DAO::executeQuery($queryString, $params); + $customValueTables = []; + + // process records + while ($crmDAO->fetch()) { + // get the id's + $groupID = $crmDAO->civicrm_custom_group_id; + $fieldId = $crmDAO->civicrm_custom_field_id; + if ($crmDAO->civicrm_custom_group_is_multiple) { + $multipleFieldGroups[$groupID] = $crmDAO->civicrm_custom_group_table_name; + } + // create an array for groups if it does not exist + if (!array_key_exists($groupID, $groupTree)) { + $groupTree[$groupID] = []; + $groupTree[$groupID]['id'] = $groupID; + + // populate the group information + foreach ($toReturn['custom_group'] as $fieldName) { + $fullFieldName = "civicrm_custom_group_$fieldName"; + if ($fieldName == 'id' || + is_null($crmDAO->$fullFieldName) + ) { + continue; + } + // CRM-5507 + // This is an old bit of code - per the CRM number & probably does not work reliably if + // that one contact sub-type exists. + if ($fieldName == 'extends_entity_column_value' && !empty($subTypes[0])) { + $groupTree[$groupID]['subtype'] = self::validateSubTypeByEntity($entityType, $subType); + } + $groupTree[$groupID][$fieldName] = $crmDAO->$fullFieldName; + } + $groupTree[$groupID]['fields'] = []; + + $customValueTables[$crmDAO->civicrm_custom_group_table_name] = []; + } + + // add the fields now (note - the query row will always contain a field) + // we only reset this once, since multiple values come is as multiple rows + if (!array_key_exists($fieldId, $groupTree[$groupID]['fields'])) { + $groupTree[$groupID]['fields'][$fieldId] = []; + } + + $customValueTables[$crmDAO->civicrm_custom_group_table_name][$crmDAO->civicrm_custom_field_column_name] = 1; + $groupTree[$groupID]['fields'][$fieldId]['id'] = $fieldId; + // populate information for a custom field + foreach ($toReturn['custom_field'] as $fieldName) { + $fullFieldName = "civicrm_custom_field_$fieldName"; + if ($fieldName == 'id' || + is_null($crmDAO->$fullFieldName) + ) { + continue; + } + $groupTree[$groupID]['fields'][$fieldId][$fieldName] = $crmDAO->$fullFieldName; + } + } + + if (!empty($customValueTables)) { + $groupTree['info'] = ['tables' => $customValueTables]; + } + return [$multipleFieldGroups, $groupTree]; + } + } diff --git a/CRM/Core/BAO/CustomQuery.php b/CRM/Core/BAO/CustomQuery.php index 790487e43891..610478c603f9 100644 --- a/CRM/Core/BAO/CustomQuery.php +++ b/CRM/Core/BAO/CustomQuery.php @@ -96,7 +96,7 @@ class CRM_Core_BAO_CustomQuery { /** * Searching for contacts? * - * @var boolean + * @var bool */ protected $_contactSearch; @@ -351,6 +351,12 @@ public function where() { foreach ($value as $key => $val) { $value[$key] = str_replace(['[', ']', ','], ['\[', '\]', '[:comma:]'], $val); $value[$key] = str_replace('|', '[:separator:]', $value[$key]); + if ($field['data_type'] == 'String') { + $value[$key] = CRM_Utils_Type::escape($value[$key], 'String'); + } + elseif ($value) { + $value[$key] = CRM_Utils_Type::escape($value[$key], 'Integer'); + } } $value = implode(',', $value); } diff --git a/CRM/Core/BAO/PrevNextCache.php b/CRM/Core/BAO/PrevNextCache.php index bca6a1824bb2..bdc8e44ba131 100644 --- a/CRM/Core/BAO/PrevNextCache.php +++ b/CRM/Core/BAO/PrevNextCache.php @@ -138,19 +138,18 @@ public static function deleteItem($id = NULL, $cacheKey = NULL, $entityTable = ' } /** - * Delete from the previous next cache table for a pair of ids. + * Delete pair from the previous next cache table to remove it from further merge consideration. + * + * The pair may have been flipped, so make sure we delete using both orders * * @param int $id1 * @param int $id2 * @param string $cacheKey - * @param bool $isViceVersa - * @param string $entityTable */ - public static function deletePair($id1, $id2, $cacheKey = NULL, $isViceVersa = FALSE, $entityTable = 'civicrm_contact') { - $sql = "DELETE FROM civicrm_prevnext_cache WHERE entity_table = %1"; - $params = [1 => [$entityTable, 'String']]; + public static function deletePair($id1, $id2, $cacheKey = NULL) { + $sql = "DELETE FROM civicrm_prevnext_cache WHERE entity_table = 'civicrm_contact'"; - $pair = !$isViceVersa ? "entity_id1 = %2 AND entity_id2 = %3" : "(entity_id1 = %2 AND entity_id2 = %3) OR (entity_id1 = %3 AND entity_id2 = %2)"; + $pair = "(entity_id1 = %2 AND entity_id2 = %3) OR (entity_id1 = %3 AND entity_id2 = %2)"; $sql .= " AND ( {$pair} )"; $params[2] = [$id1, 'Integer']; $params[3] = [$id2, 'Integer']; diff --git a/CRM/Core/ClassLoader.php b/CRM/Core/ClassLoader.php index 2a9606d5275a..a87e8ea783b9 100644 --- a/CRM/Core/ClassLoader.php +++ b/CRM/Core/ClassLoader.php @@ -190,7 +190,7 @@ private function getHtmlPurifierPath() { // we do this to prevent a autoloader errors with joomla / 3rd party packages // Use absolute path, since we don't know the content of include_path yet. // CRM-11304 - $file = dirname(__FILE__) . '/../../vendor/ezyang/htmlpurifier/library/HTMLPurifier/Bootstrap.php'; + $file = dirname(__FILE__) . '/../../packages/IDS/vendors/htmlpurifer/HTMLPurifier/Bootstrap.php'; if (file_exists($file)) { return $file; } diff --git a/CRM/Core/CodeGen/Main.php b/CRM/Core/CodeGen/Main.php index 7729ea81e8e4..351ef233effa 100644 --- a/CRM/Core/CodeGen/Main.php +++ b/CRM/Core/CodeGen/Main.php @@ -37,13 +37,18 @@ class CRM_Core_CodeGen_Main { public $database; /** - * @var string|NULL path in which to store a marker that indicates the last execution of - * GenCode. If a matching marker already exists, GenCode doesn't run. + * Path in which to store a marker that indicates the last execution of GenCode. + * + * If a matching marker already exists, GenCode doesn't run. + * + * @var string|null */ public $digestPath; /** - * @var string|NULL a digest of the inputs to the code-generator (eg the properties and source files) + * Digest of the inputs to the code-generator (eg the properties and source files). + * + * @var string|null */ public $sourceDigest; diff --git a/CRM/Core/CodeGen/Specification.php b/CRM/Core/CodeGen/Specification.php index e5da1c609aa2..101b3426b412 100644 --- a/CRM/Core/CodeGen/Specification.php +++ b/CRM/Core/CodeGen/Specification.php @@ -318,7 +318,7 @@ public function getField(&$fieldXML, &$fields) { // need this case since some versions of mysql do not have boolean as a valid column type and hence it // is changed to tinyint. hopefully after 2 yrs this case can be removed. $field['sqlType'] = 'tinyint'; - $field['phpType'] = $type; + $field['phpType'] = 'bool'; $field['crmType'] = 'CRM_Utils_Type::T_' . strtoupper($type); break; @@ -340,6 +340,7 @@ public function getField(&$fieldXML, &$fields) { $field['phpType'] = $this->value('phpType', $fieldXML, $type); $field['sqlType'] = $type; if ($type == 'int unsigned') { + $field['phpType'] = 'int'; $field['crmType'] = 'CRM_Utils_Type::T_INT'; } else { @@ -369,6 +370,7 @@ public function getField(&$fieldXML, &$fields) { $field['uniqueName'] = $this->value('uniqueName', $fieldXML); $field['serialize'] = $this->value('serialize', $fieldXML); $field['html'] = $this->value('html', $fieldXML); + $field['protected'] = $this->value('protected', $fieldXML); if (!empty($field['html'])) { $validOptions = [ 'type', diff --git a/CRM/Core/Component/Info.php b/CRM/Core/Component/Info.php index fd4b55c5be33..1d2989c52c99 100644 --- a/CRM/Core/Component/Info.php +++ b/CRM/Core/Component/Info.php @@ -31,8 +31,6 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2019 - * $Id$ - * */ abstract class CRM_Core_Component_Info { @@ -79,14 +77,16 @@ abstract class CRM_Core_Component_Info { const COMPONENT_MENU_XML = 'Menu'; /** - * Stores component information. - * @var array component settings as key/value pairs + * Component settings as key/value pairs. + * + * @var array */ public $info; /** - * Stores component keyword. - * @var string name of component keyword + * Component keyword. + * + * @var string */ protected $keyword; diff --git a/CRM/Core/Controller.php b/CRM/Core/Controller.php index a5141627c7d3..51dda46d20e5 100644 --- a/CRM/Core/Controller.php +++ b/CRM/Core/Controller.php @@ -82,7 +82,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * so the display routine needs to not do any work. (The * parent object takes care of the display) * - * @var boolean + * @var bool */ protected $_embedded = FALSE; @@ -94,7 +94,7 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * Useful when we run form in non civicrm context * and we need to transfer control back.(eg. drupal) * - * @var boolean + * @var bool */ protected $_skipRedirection = FALSE; @@ -102,14 +102,14 @@ class CRM_Core_Controller extends HTML_QuickForm_Controller { * Are we in print mode? if so we need to modify the display * functionality to do a minimal display :) * - * @var boolean + * @var bool */ public $_print = 0; /** * Should we generate a qfKey, true by default * - * @var boolean + * @var bool */ public $_generateQFKey = TRUE; diff --git a/CRM/Core/DAO/ActionLog.php b/CRM/Core/DAO/ActionLog.php index 3ebd410feccb..86a10b240d7d 100644 --- a/CRM/Core/DAO/ActionLog.php +++ b/CRM/Core/DAO/ActionLog.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/ActionLog.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:38f897676ff054f67ba7188470e41dee) + * (GenCodeChecksum:2ccacada384ba37fcf929647dfa3d845) */ /** @@ -29,21 +29,21 @@ class CRM_Core_DAO_ActionLog extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * FK to id of the entity that the action was performed on. Pseudo - FK. * - * @var int unsigned + * @var int */ public $entity_id; @@ -57,7 +57,7 @@ class CRM_Core_DAO_ActionLog extends CRM_Core_DAO { /** * FK to the action schedule that this action originated from. * - * @var int unsigned + * @var int */ public $action_schedule_id; @@ -71,7 +71,7 @@ class CRM_Core_DAO_ActionLog extends CRM_Core_DAO { /** * Was there any error sending the reminder? * - * @var boolean + * @var bool */ public $is_error; @@ -85,7 +85,7 @@ class CRM_Core_DAO_ActionLog extends CRM_Core_DAO { /** * Keeps track of the sequence number of this repetition. * - * @var int unsigned + * @var int */ public $repetition_number; diff --git a/CRM/Core/DAO/ActionMapping.php b/CRM/Core/DAO/ActionMapping.php index fce373b430dd..841bc7d0e24b 100644 --- a/CRM/Core/DAO/ActionMapping.php +++ b/CRM/Core/DAO/ActionMapping.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/ActionMapping.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:eafaaa48176b2854e6b8a7f19fc1ebe6) + * (GenCodeChecksum:c7d2ed31b30490f0a1794fb81b700ac6) */ /** @@ -29,7 +29,7 @@ class CRM_Core_DAO_ActionMapping extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; diff --git a/CRM/Core/DAO/ActionSchedule.php b/CRM/Core/DAO/ActionSchedule.php index 25b0376dda16..d6d17288faae 100644 --- a/CRM/Core/DAO/ActionSchedule.php +++ b/CRM/Core/DAO/ActionSchedule.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/ActionSchedule.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:4d6dca3786a9d3ab90b492be017b045b) + * (GenCodeChecksum:cb2618343c279fbf0baabe1f1ebd9973) */ /** @@ -29,7 +29,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; @@ -57,7 +57,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { /** * Is this the recipient criteria limited to OR in addition to? * - * @var boolean + * @var bool */ public $limit_to; @@ -78,7 +78,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { /** * Reminder Interval. * - * @var int unsigned + * @var int */ public $start_action_offset; @@ -104,7 +104,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { public $start_action_date; /** - * @var boolean + * @var bool */ public $is_repeat; @@ -118,7 +118,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { /** * Time interval for repeating the reminder. * - * @var int unsigned + * @var int */ public $repetition_frequency_interval; @@ -132,7 +132,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { /** * Time interval till repeating the reminder. * - * @var int unsigned + * @var int */ public $end_frequency_interval; @@ -153,7 +153,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { /** * Is this option active? * - * @var boolean + * @var bool */ public $is_active; @@ -202,7 +202,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { /** * Record Activity for this reminder? * - * @var boolean + * @var bool */ public $record_activity; @@ -216,21 +216,21 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { /** * FK to Group * - * @var int unsigned + * @var int */ public $group_id; /** * FK to the message template. * - * @var int unsigned + * @var int */ public $msg_template_id; /** * FK to the message template. * - * @var int unsigned + * @var int */ public $sms_template_id; @@ -263,7 +263,7 @@ class CRM_Core_DAO_ActionSchedule extends CRM_Core_DAO { public $mode; /** - * @var int unsigned + * @var int */ public $sms_provider_id; @@ -438,7 +438,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits', - ] + ], ], 'start_action_condition' => [ 'name' => 'start_action_condition', @@ -494,7 +494,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits', - ] + ], ], 'repetition_frequency_interval' => [ 'name' => 'repetition_frequency_interval', @@ -525,7 +525,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getRecurringFrequencyUnits', - ] + ], ], 'end_frequency_interval' => [ 'name' => 'end_frequency_interval', @@ -692,7 +692,7 @@ public static function &fields() { 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'msg_template_id' => [ 'name' => 'msg_template_id', @@ -774,7 +774,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'msg_mode', 'optionEditPath' => 'civicrm/admin/options/msg_mode', - ] + ], ], 'sms_provider_id' => [ 'name' => 'sms_provider_id', diff --git a/CRM/Core/DAO/Address.php b/CRM/Core/DAO/Address.php index f020412740ff..c7affaf7ffc4 100644 --- a/CRM/Core/DAO/Address.php +++ b/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:a81d4789f6650c68145ab9bf1e4481a8) + * (GenCodeChecksum:2487d5f7de34dffd729bba2d3ea65ed6) */ /** @@ -31,35 +31,35 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO { /** * Unique Address ID * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * Which Location does this address belong to. * - * @var int unsigned + * @var int */ public $location_type_id; /** * Is this the primary address. * - * @var boolean + * @var bool */ public $is_primary; /** * Is this the billing address. * - * @var boolean + * @var bool */ public $is_billing; @@ -152,14 +152,14 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO { /** * Which County does this address belong to. * - * @var int unsigned + * @var int */ public $county_id; /** * Which State_Province does this address belong to. * - * @var int unsigned + * @var int */ public $state_province_id; @@ -187,7 +187,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO { /** * Which Country does this address belong to. * - * @var int unsigned + * @var int */ public $country_id; @@ -208,7 +208,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO { /** * Is this a manually entered geo code * - * @var boolean + * @var bool */ public $manual_geo_code; @@ -227,7 +227,7 @@ class CRM_Core_DAO_Address extends CRM_Core_DAO { /** * FK to Address ID * - * @var int unsigned + * @var int */ public $master_id; @@ -307,7 +307,7 @@ public static function &fields() { 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ] + ], ], 'is_primary' => [ 'name' => 'is_primary', @@ -575,7 +575,7 @@ public static function &fields() { 'table' => 'civicrm_county', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'state_province_id' => [ 'name' => 'state_province_id', @@ -596,7 +596,7 @@ public static function &fields() { 'table' => 'civicrm_state_province', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'postal_code_suffix' => [ 'name' => 'postal_code_suffix', @@ -671,7 +671,7 @@ public static function &fields() { 'keyColumn' => 'id', 'labelColumn' => 'name', 'nameColumn' => 'iso_code', - ] + ], ], 'geo_code_1' => [ 'name' => 'geo_code_1', diff --git a/CRM/Core/DAO/AddressFormat.php b/CRM/Core/DAO/AddressFormat.php index 6db05ca4ad45..4aebbfb3c9e7 100644 --- a/CRM/Core/DAO/AddressFormat.php +++ b/CRM/Core/DAO/AddressFormat.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/AddressFormat.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:08e72cd783856c58dbdaeee364102c01) + * (GenCodeChecksum:144542b9aa31391600f73d885f819091) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_AddressFormat extends CRM_Core_DAO { /** * Address Format Id * - * @var int unsigned + * @var int */ public $id; diff --git a/CRM/Core/DAO/Cache.php b/CRM/Core/DAO/Cache.php index a92e8ad9777a..b9c0d73da33d 100644 --- a/CRM/Core/DAO/Cache.php +++ b/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:0683b150dd60e1ec9b53c00957137a27) + * (GenCodeChecksum:2ed8c033a46531123b2a0bb158487c30) */ /** @@ -29,7 +29,7 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; @@ -57,7 +57,7 @@ class CRM_Core_DAO_Cache extends CRM_Core_DAO { /** * Component that this menu item belongs to * - * @var int unsigned + * @var int */ public $component_id; @@ -171,7 +171,7 @@ public static function &fields() { 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'created_date' => [ 'name' => 'created_date', diff --git a/CRM/Core/DAO/Component.php b/CRM/Core/DAO/Component.php index 710c3b159361..22cbb9af7c09 100644 --- a/CRM/Core/DAO/Component.php +++ b/CRM/Core/DAO/Component.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Component.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:b9121c01e72b5a9a2772dad9274f4549) + * (GenCodeChecksum:71dfa95215b9ca0bdf22286815e2dae2) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Component extends CRM_Core_DAO { /** * Component ID * - * @var int unsigned + * @var int */ public $id; diff --git a/CRM/Core/DAO/Country.php b/CRM/Core/DAO/Country.php index fa5108bc655c..5087ed41384b 100644 --- a/CRM/Core/DAO/Country.php +++ b/CRM/Core/DAO/Country.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Country.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a7e07335fea6b1eea5894c119eaa1c4e) + * (GenCodeChecksum:367384a5604d933a66247bddb06e96bb) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Country extends CRM_Core_DAO { /** * Country Id * - * @var int unsigned + * @var int */ public $id; @@ -59,7 +59,7 @@ class CRM_Core_DAO_Country extends CRM_Core_DAO { /** * Foreign key to civicrm_address_format.id. * - * @var int unsigned + * @var int */ public $address_format_id; @@ -80,14 +80,14 @@ class CRM_Core_DAO_Country extends CRM_Core_DAO { /** * Foreign key to civicrm_worldregion.id. * - * @var int unsigned + * @var int */ public $region_id; /** * Should state/province be displayed as abbreviation for contacts from this country? * - * @var boolean + * @var bool */ public $is_province_abbreviated; @@ -233,7 +233,7 @@ public static function &fields() { 'table' => 'civicrm_worldregion', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'is_province_abbreviated' => [ 'name' => 'is_province_abbreviated', diff --git a/CRM/Core/DAO/County.php b/CRM/Core/DAO/County.php index f3dedbed8e42..853be19f1b43 100644 --- a/CRM/Core/DAO/County.php +++ b/CRM/Core/DAO/County.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/County.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:74b37d0061cdff5aa638ff68f3879b6c) + * (GenCodeChecksum:3ce3045eed44f727cbca947945315329) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_County extends CRM_Core_DAO { /** * County ID * - * @var int unsigned + * @var int */ public $id; @@ -52,7 +52,7 @@ class CRM_Core_DAO_County extends CRM_Core_DAO { /** * ID of State/Province that County belongs * - * @var int unsigned + * @var int */ public $state_province_id; diff --git a/CRM/Core/DAO/CustomField.php b/CRM/Core/DAO/CustomField.php index ee0fb15f20be..4e873afa0bd2 100644 --- a/CRM/Core/DAO/CustomField.php +++ b/CRM/Core/DAO/CustomField.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/CustomField.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a1a27e2af4724a92f37a959ee359428b) + * (GenCodeChecksum:58323f46f5ac021f96591e075b37cca6) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO { /** * Unique Custom Field ID * - * @var int unsigned + * @var int */ public $id; /** * FK to civicrm_custom_group. * - * @var int unsigned + * @var int */ public $custom_group_id; @@ -80,21 +80,21 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO { /** * Is a value required for this property. * - * @var boolean + * @var bool */ public $is_required; /** * Is this property searchable. * - * @var boolean + * @var bool */ public $is_searchable; /** * Is this property range searchable. * - * @var boolean + * @var bool */ public $is_search_range; @@ -143,28 +143,28 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO { /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this property set by PHP Code? A code field is viewable but not editable * - * @var boolean + * @var bool */ public $is_view; /** * number of options per line for checkbox and radio * - * @var int unsigned + * @var int */ public $options_per_line; /** * field length if alphanumeric * - * @var int unsigned + * @var int */ public $text_length; @@ -192,21 +192,21 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO { /** * time format for custom date * - * @var int unsigned + * @var int */ public $time_format; /** * Number of columns in Note Field * - * @var int unsigned + * @var int */ public $note_columns; /** * Number of rows in Note Field * - * @var int unsigned + * @var int */ public $note_rows; @@ -220,7 +220,7 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO { /** * For elements with options, the option group id that is used * - * @var int unsigned + * @var int */ public $option_group_id; @@ -234,7 +234,7 @@ class CRM_Core_DAO_CustomField extends CRM_Core_DAO { /** * Should the multi-record custom field values be displayed in tab table listing * - * @var boolean + * @var bool */ public $in_selector; @@ -301,7 +301,7 @@ public static function &fields() { 'table' => 'civicrm_custom_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'name' => [ 'name' => 'name', @@ -348,7 +348,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_BAO_CustomField::dataType', - ] + ], ], 'html_type' => [ 'name' => 'html_type', @@ -365,7 +365,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::customHtmlType', - ] + ], ], 'default_value' => [ 'name' => 'default_value', @@ -632,7 +632,7 @@ public static function &fields() { 'table' => 'civicrm_option_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'filter' => [ 'name' => 'filter', diff --git a/CRM/Core/DAO/CustomGroup.php b/CRM/Core/DAO/CustomGroup.php index aa7f05551f2c..363c13e419c5 100644 --- a/CRM/Core/DAO/CustomGroup.php +++ b/CRM/Core/DAO/CustomGroup.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/CustomGroup.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9131714b35a45d028cf14456d1e57170) + * (GenCodeChecksum:288ec5d75e51339f23a2057dc1a383d2) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO { /** * Unique Custom Group ID * - * @var int unsigned + * @var int */ public $id; @@ -59,7 +59,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO { /** * FK to civicrm_option_value.id (for option group custom_data_type.) * - * @var int unsigned + * @var int */ public $extends_entity_column_id; @@ -80,7 +80,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO { /** * Will this group be in collapsed or expanded mode on initial display ? * - * @var int unsigned + * @var int */ public $collapse_display; @@ -108,7 +108,7 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO { /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; @@ -122,35 +122,35 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO { /** * Does this group hold multiple values? * - * @var boolean + * @var bool */ public $is_multiple; /** * minimum number of multiple records (typically 0?) * - * @var int unsigned + * @var int */ public $min_multiple; /** * maximum number of multiple records, if 0 - no max * - * @var int unsigned + * @var int */ public $max_multiple; /** * Will this group be in collapsed or expanded mode on advanced search display ? * - * @var int unsigned + * @var int */ public $collapse_adv_display; /** * FK to civicrm_contact, who created this custom group * - * @var int unsigned + * @var int */ public $created_id; @@ -164,14 +164,14 @@ class CRM_Core_DAO_CustomGroup extends CRM_Core_DAO { /** * Is this a reserved Custom Group? * - * @var boolean + * @var bool */ public $is_reserved; /** * Is this property public? * - * @var boolean + * @var bool */ public $is_public; @@ -276,7 +276,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'custom_data_type', 'optionEditPath' => 'civicrm/admin/options/custom_data_type', - ] + ], ], 'extends_entity_column_value' => [ 'name' => 'extends_entity_column_value', @@ -309,7 +309,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::customGroupStyle', - ] + ], ], 'collapse_display' => [ 'name' => 'collapse_display', diff --git a/CRM/Core/DAO/Dashboard.php b/CRM/Core/DAO/Dashboard.php index 42aa0ab23a92..ea13f322039f 100644 --- a/CRM/Core/DAO/Dashboard.php +++ b/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:52a635955e779405d2eaa2b403c41092) + * (GenCodeChecksum:d1fc3dec2d559acdfedb070a6a5bd107) */ /** @@ -29,14 +29,14 @@ class CRM_Core_DAO_Dashboard extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * Domain for dashboard * - * @var int unsigned + * @var int */ public $domain_id; @@ -85,21 +85,21 @@ class CRM_Core_DAO_Dashboard extends CRM_Core_DAO { /** * Is this dashlet active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this dashlet reserved? * - * @var boolean + * @var bool */ public $is_reserved; /** * Number of minutes to cache dashlet content in browser localStorage. * - * @var int unsigned + * @var int */ public $cache_minutes; @@ -161,7 +161,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'name' => [ 'name' => 'name', diff --git a/CRM/Core/DAO/Discount.php b/CRM/Core/DAO/Discount.php index 32dbbb454e4a..17250c3cb3bc 100644 --- a/CRM/Core/DAO/Discount.php +++ b/CRM/Core/DAO/Discount.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Discount.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:74c8162f321ac50b965c1416951fe93a) + * (GenCodeChecksum:a414d91af17f5a6cfd69e3a0fc8fb8ca) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Discount extends CRM_Core_DAO { /** * primary key * - * @var int unsigned + * @var int */ public $id; @@ -45,14 +45,14 @@ class CRM_Core_DAO_Discount extends CRM_Core_DAO { /** * FK to entity table specified in entity_table column. * - * @var int unsigned + * @var int */ public $entity_id; /** * FK to civicrm_price_set * - * @var int unsigned + * @var int */ public $price_set_id; diff --git a/CRM/Core/DAO/Domain.php b/CRM/Core/DAO/Domain.php index 2f84735d7246..e3e5c13014e2 100644 --- a/CRM/Core/DAO/Domain.php +++ b/CRM/Core/DAO/Domain.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Domain.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:c5d80d8a9e689b48c5f6373b9229c442) + * (GenCodeChecksum:74b35dfcc8ad2ade69e9bcb75e2f407b) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Domain extends CRM_Core_DAO { /** * Domain ID * - * @var int unsigned + * @var int */ public $id; @@ -66,7 +66,7 @@ class CRM_Core_DAO_Domain extends CRM_Core_DAO { /** * FK to Contact ID. This is specifically not an FK to avoid circular constraints * - * @var int unsigned + * @var int */ public $contact_id; diff --git a/CRM/Core/DAO/Email.php b/CRM/Core/DAO/Email.php index ac48170decac..1d36308a3081 100644 --- a/CRM/Core/DAO/Email.php +++ b/CRM/Core/DAO/Email.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Email.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:198627a1fa129294e4c7be52939883e1) + * (GenCodeChecksum:6da9864657d2b5e46956386ab414d8d6) */ /** @@ -31,21 +31,21 @@ class CRM_Core_DAO_Email extends CRM_Core_DAO { /** * Unique Email ID * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * Which Location does this email belong to. * - * @var int unsigned + * @var int */ public $location_type_id; @@ -59,28 +59,28 @@ class CRM_Core_DAO_Email extends CRM_Core_DAO { /** * Is this the primary? * - * @var boolean + * @var bool */ public $is_primary; /** * Is this the billing? * - * @var boolean + * @var bool */ public $is_billing; /** * Implicit FK to civicrm_option_value where option_group = email_on_hold. * - * @var int unsigned + * @var int */ public $on_hold; /** * Is this address for bulk mail ? * - * @var boolean + * @var bool */ public $is_bulkmail; @@ -184,7 +184,7 @@ public static function &fields() { 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ] + ], ], 'email' => [ 'name' => 'email', @@ -249,7 +249,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_PseudoConstant::emailOnHoldOptions', - ] + ], ], 'is_bulkmail' => [ 'name' => 'is_bulkmail', diff --git a/CRM/Core/DAO/EntityFile.php b/CRM/Core/DAO/EntityFile.php index 26069113cbef..9ab75998b90f 100644 --- a/CRM/Core/DAO/EntityFile.php +++ b/CRM/Core/DAO/EntityFile.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/EntityFile.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:febc5ccbfb965f8f4ba8477d4db0e5f3) + * (GenCodeChecksum:7a5ef1cb4866290ba8edac3fd92f1102) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_EntityFile extends CRM_Core_DAO { /** * primary key * - * @var int unsigned + * @var int */ public $id; @@ -45,14 +45,14 @@ class CRM_Core_DAO_EntityFile extends CRM_Core_DAO { /** * FK to entity table specified in entity_table column. * - * @var int unsigned + * @var int */ public $entity_id; /** * FK to civicrm_file * - * @var int unsigned + * @var int */ public $file_id; diff --git a/CRM/Core/DAO/EntityTag.php b/CRM/Core/DAO/EntityTag.php index 11bcdfcb5b78..e3ea7a3fe5ba 100644 --- a/CRM/Core/DAO/EntityTag.php +++ b/CRM/Core/DAO/EntityTag.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/EntityTag.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:721b045d10e22535a86c5e927e489477) + * (GenCodeChecksum:16302a8c63dcb3978dbc0d089397be50) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_EntityTag extends CRM_Core_DAO { /** * primary key * - * @var int unsigned + * @var int */ public $id; @@ -45,14 +45,14 @@ class CRM_Core_DAO_EntityTag extends CRM_Core_DAO { /** * FK to entity table specified in entity_table column. * - * @var int unsigned + * @var int */ public $entity_id; /** * FK to civicrm_tag * - * @var int unsigned + * @var int */ public $tag_id; @@ -115,7 +115,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'tag_used_for', 'optionEditPath' => 'civicrm/admin/options/tag_used_for', - ] + ], ], 'entity_id' => [ 'name' => 'entity_id', @@ -148,7 +148,7 @@ public static function &fields() { 'table' => 'civicrm_tag', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Core/DAO/Extension.php b/CRM/Core/DAO/Extension.php index 9bb233277e46..67f396493f18 100644 --- a/CRM/Core/DAO/Extension.php +++ b/CRM/Core/DAO/Extension.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Extension.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:02c87fb773b6c1e61e48e0ddfac2bb5a) + * (GenCodeChecksum:d7421ef144f074ada5688f6e56ab8418) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Extension extends CRM_Core_DAO { /** * Local Extension ID * - * @var int unsigned + * @var int */ public $id; @@ -78,7 +78,7 @@ class CRM_Core_DAO_Extension extends CRM_Core_DAO { /** * Is this extension active? * - * @var boolean + * @var bool */ public $is_active; @@ -127,7 +127,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getExtensionTypes', - ] + ], ], 'full_name' => [ 'name' => 'full_name', diff --git a/CRM/Core/DAO/File.php b/CRM/Core/DAO/File.php index fe4ae741f492..508a449a0d50 100644 --- a/CRM/Core/DAO/File.php +++ b/CRM/Core/DAO/File.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/File.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:994c11201c8b27ec0913d1ce505ef864) + * (GenCodeChecksum:0ddebff42aa9d0c2fe3114281ca95e70) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_File extends CRM_Core_DAO { /** * Unique ID * - * @var int unsigned + * @var int */ public $id; /** * Type of file (e.g. Transcript, Income Tax Return, etc). FK to civicrm_option_value. * - * @var int unsigned + * @var int */ public $file_type_id; @@ -80,7 +80,7 @@ class CRM_Core_DAO_File extends CRM_Core_DAO { /** * FK to civicrm_contact, who uploaded this file * - * @var int unsigned + * @var int */ public $created_id; diff --git a/CRM/Core/DAO/IM.php b/CRM/Core/DAO/IM.php index e53ce78aff36..6d4583a6a1f1 100644 --- a/CRM/Core/DAO/IM.php +++ b/CRM/Core/DAO/IM.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/IM.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:c112fd2803d82fb22d2635f7929c391c) + * (GenCodeChecksum:5a7b60741331c475603af3bb180d2bd7) */ /** @@ -31,21 +31,21 @@ class CRM_Core_DAO_IM extends CRM_Core_DAO { /** * Unique IM ID * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * Which Location does this email belong to. * - * @var int unsigned + * @var int */ public $location_type_id; @@ -59,21 +59,21 @@ class CRM_Core_DAO_IM extends CRM_Core_DAO { /** * Which IM Provider does this screen name belong to. * - * @var int unsigned + * @var int */ public $provider_id; /** * Is this the primary IM for this contact and location. * - * @var boolean + * @var bool */ public $is_primary; /** * Is this the billing? * - * @var boolean + * @var bool */ public $is_billing; @@ -149,7 +149,7 @@ public static function &fields() { 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ] + ], ], 'name' => [ 'name' => 'name', @@ -187,7 +187,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'instant_messenger_service', 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service', - ] + ], ], 'is_primary' => [ 'name' => 'is_primary', diff --git a/CRM/Core/DAO/Job.php b/CRM/Core/DAO/Job.php index 3c0961ef24b0..3f4fe93d7525 100644 --- a/CRM/Core/DAO/Job.php +++ b/CRM/Core/DAO/Job.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Job.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:6a87295b587fb722d7b2026e2f2dbfe7) + * (GenCodeChecksum:752f86f1ad35917f008e81c0bc45786e) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_Job extends CRM_Core_DAO { /** * Job Id * - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this scheduled job for * - * @var int unsigned + * @var int */ public $domain_id; @@ -101,7 +101,7 @@ class CRM_Core_DAO_Job extends CRM_Core_DAO { /** * Is this job active? * - * @var boolean + * @var bool */ public $is_active; @@ -164,7 +164,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'run_frequency' => [ 'name' => 'run_frequency', @@ -184,7 +184,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getJobFrequency', - ] + ], ], 'last_run' => [ 'name' => 'last_run', diff --git a/CRM/Core/DAO/JobLog.php b/CRM/Core/DAO/JobLog.php index 65737e4fffbd..6fd510f4fea3 100644 --- a/CRM/Core/DAO/JobLog.php +++ b/CRM/Core/DAO/JobLog.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/JobLog.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:68e8b90d050e64feef2b1868d83a7923) + * (GenCodeChecksum:647390b654065a0cc421975a24ae14f9) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_JobLog extends CRM_Core_DAO { /** * Job log entry Id * - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this scheduled job for * - * @var int unsigned + * @var int */ public $domain_id; @@ -52,7 +52,7 @@ class CRM_Core_DAO_JobLog extends CRM_Core_DAO { /** * Pointer to job id - not a FK though, just for logging purposes * - * @var int unsigned + * @var int */ public $job_id; @@ -143,7 +143,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'run_time' => [ 'name' => 'run_time', diff --git a/CRM/Core/DAO/LocBlock.php b/CRM/Core/DAO/LocBlock.php index c48de8d06d6f..4c281a54c79c 100644 --- a/CRM/Core/DAO/LocBlock.php +++ b/CRM/Core/DAO/LocBlock.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/LocBlock.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:cc12c8f1ddd73d6d8b1d056dd04696e9) + * (GenCodeChecksum:f2893cf360fe552d5ff1d90e2eb9272c) */ /** @@ -31,47 +31,47 @@ class CRM_Core_DAO_LocBlock extends CRM_Core_DAO { /** * Unique ID * - * @var int unsigned + * @var int */ public $id; /** - * @var int unsigned + * @var int */ public $address_id; /** - * @var int unsigned + * @var int */ public $email_id; /** - * @var int unsigned + * @var int */ public $phone_id; /** - * @var int unsigned + * @var int */ public $im_id; /** - * @var int unsigned + * @var int */ public $address_2_id; /** - * @var int unsigned + * @var int */ public $email_2_id; /** - * @var int unsigned + * @var int */ public $phone_2_id; /** - * @var int unsigned + * @var int */ public $im_2_id; diff --git a/CRM/Core/DAO/LocationType.php b/CRM/Core/DAO/LocationType.php index fbab7fe2dabe..55f9e0c5fec1 100644 --- a/CRM/Core/DAO/LocationType.php +++ b/CRM/Core/DAO/LocationType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/LocationType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a97cc190a4fbeafa8846f48f47dcd63e) + * (GenCodeChecksum:aa147acf0dac148b113c33d4ca12876c) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_LocationType extends CRM_Core_DAO { /** * Location Type ID * - * @var int unsigned + * @var int */ public $id; @@ -66,21 +66,21 @@ class CRM_Core_DAO_LocationType extends CRM_Core_DAO { /** * Is this location type a predefined system location? * - * @var boolean + * @var bool */ public $is_reserved; /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this location type the default? * - * @var boolean + * @var bool */ public $is_default; diff --git a/CRM/Core/DAO/Log.php b/CRM/Core/DAO/Log.php index 61a74d8a3f2c..9193116deff6 100644 --- a/CRM/Core/DAO/Log.php +++ b/CRM/Core/DAO/Log.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Log.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:38303a678c8e5104d63803ce900dc370) + * (GenCodeChecksum:ffaccbd0ebaf86e07a6302fe32e05ea8) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Log extends CRM_Core_DAO { /** * Log ID * - * @var int unsigned + * @var int */ public $id; @@ -45,7 +45,7 @@ class CRM_Core_DAO_Log extends CRM_Core_DAO { /** * Foreign key to the referenced item. * - * @var int unsigned + * @var int */ public $entity_id; @@ -59,7 +59,7 @@ class CRM_Core_DAO_Log extends CRM_Core_DAO { /** * FK to Contact ID of person under whose credentials this data modification was made. * - * @var int unsigned + * @var int */ public $modified_id; diff --git a/CRM/Core/DAO/MailSettings.php b/CRM/Core/DAO/MailSettings.php index 7657ad3a7262..a3aa181b9f2b 100644 --- a/CRM/Core/DAO/MailSettings.php +++ b/CRM/Core/DAO/MailSettings.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/MailSettings.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:419c207b65557941ee6f58e31d1bb6d8) + * (GenCodeChecksum:1818e655bde2e2a0ecd15e7d645ba58a) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO { /** * primary key * - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this match entry for * - * @var int unsigned + * @var int */ public $domain_id; @@ -52,7 +52,7 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO { /** * whether this is the default set of settings for this domain * - * @var boolean + * @var bool */ public $is_default; @@ -94,7 +94,7 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO { /** * port to use when polling * - * @var int unsigned + * @var int */ public $port; @@ -115,7 +115,7 @@ class CRM_Core_DAO_MailSettings extends CRM_Core_DAO { /** * whether to use SSL or not * - * @var boolean + * @var bool */ public $is_ssl; @@ -192,7 +192,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'name' => [ 'name' => 'name', @@ -275,7 +275,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'mail_protocol', 'optionEditPath' => 'civicrm/admin/options/mail_protocol', - ] + ], ], 'server' => [ 'name' => 'server', @@ -370,7 +370,7 @@ public static function &fields() { 'optionGroupName' => 'activity_status', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/activity_status', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Core/DAO/Managed.php b/CRM/Core/DAO/Managed.php index 940c62e68638..68272f34cfdd 100644 --- a/CRM/Core/DAO/Managed.php +++ b/CRM/Core/DAO/Managed.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Managed.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:47e95661423fb2f97b3fd2069c4e404f) + * (GenCodeChecksum:79f57e32601e72d62755569fbf58c801) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Managed extends CRM_Core_DAO { /** * Surrogate Key * - * @var int unsigned + * @var int */ public $id; @@ -59,7 +59,7 @@ class CRM_Core_DAO_Managed extends CRM_Core_DAO { /** * Foreign key to the referenced item. * - * @var int unsigned + * @var int */ public $entity_id; @@ -168,7 +168,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_ManagedEntities::getCleanupOptions', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Core/DAO/Mapping.php b/CRM/Core/DAO/Mapping.php index a4c2e3556a44..d3b2da95e608 100644 --- a/CRM/Core/DAO/Mapping.php +++ b/CRM/Core/DAO/Mapping.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Mapping.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:26d8aa33c9340571c606aa5b8f085c1a) + * (GenCodeChecksum:e0576a33199627f5846830d076b12229) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Mapping extends CRM_Core_DAO { /** * Mapping ID * - * @var int unsigned + * @var int */ public $id; @@ -52,7 +52,7 @@ class CRM_Core_DAO_Mapping extends CRM_Core_DAO { /** * Mapping Type * - * @var int unsigned + * @var int */ public $mapping_type_id; @@ -126,7 +126,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'mapping_type', 'optionEditPath' => 'civicrm/admin/options/mapping_type', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Core/DAO/MappingField.php b/CRM/Core/DAO/MappingField.php index eecc8d44bf87..947eced88209 100644 --- a/CRM/Core/DAO/MappingField.php +++ b/CRM/Core/DAO/MappingField.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/MappingField.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:4c827f0d31c1d9304836b198b0d93374) + * (GenCodeChecksum:d331bef376a07c449d95639eb42f7c31) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO { /** * Mapping Field ID * - * @var int unsigned + * @var int */ public $id; /** * Mapping to which this field belongs * - * @var int unsigned + * @var int */ public $mapping_id; @@ -59,42 +59,42 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO { /** * Column number for mapping set * - * @var int unsigned + * @var int */ public $column_number; /** * Location type of this mapping, if required * - * @var int unsigned + * @var int */ public $location_type_id; /** * Which type of phone does this number belongs. * - * @var int unsigned + * @var int */ public $phone_type_id; /** * Which type of IM Provider does this name belong. * - * @var int unsigned + * @var int */ public $im_provider_id; /** * Which type of website does this site belong * - * @var int unsigned + * @var int */ public $website_type_id; /** * Relationship type, if required * - * @var int unsigned + * @var int */ public $relationship_type_id; @@ -107,7 +107,7 @@ class CRM_Core_DAO_MappingField extends CRM_Core_DAO { * Used to group mapping_field records into related sets (e.g. for criteria sets in search builder mappings). * - * @var int unsigned + * @var int */ public $grouping; @@ -263,7 +263,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'instant_messenger_service', 'optionEditPath' => 'civicrm/admin/options/instant_messenger_service', - ] + ], ], 'website_type_id' => [ 'name' => 'website_type_id', @@ -281,7 +281,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', - ] + ], ], 'relationship_type_id' => [ 'name' => 'relationship_type_id', @@ -338,7 +338,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getSearchBuilderOperators', - ] + ], ], 'value' => [ 'name' => 'value', diff --git a/CRM/Core/DAO/Menu.php b/CRM/Core/DAO/Menu.php index 3815647ba270..1aca8e4b087b 100644 --- a/CRM/Core/DAO/Menu.php +++ b/CRM/Core/DAO/Menu.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Menu.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ea477a411301cae7e78667099c0f654c) + * (GenCodeChecksum:2ba374f38c5906a6338e2c0de34208f6) */ /** @@ -29,14 +29,14 @@ class CRM_Core_DAO_Menu extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this menu item for * - * @var int unsigned + * @var int */ public $domain_id; @@ -111,35 +111,35 @@ class CRM_Core_DAO_Menu extends CRM_Core_DAO { /** * Component that this menu item belongs to * - * @var int unsigned + * @var int */ public $component_id; /** * Is this menu item active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this menu accessible to the public? * - * @var boolean + * @var bool */ public $is_public; /** * Is this menu exposed to the navigation system? * - * @var boolean + * @var bool */ public $is_exposed; /** * Should this menu be exposed via SSL if enabled? * - * @var boolean + * @var bool */ public $is_ssl; @@ -167,7 +167,7 @@ class CRM_Core_DAO_Menu extends CRM_Core_DAO { /** * skip this url being exposed to breadcrumb * - * @var boolean + * @var bool */ public $skipBreadcrumb; @@ -237,7 +237,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'path' => [ 'name' => 'path', @@ -378,7 +378,7 @@ public static function &fields() { 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'is_active' => [ 'name' => 'is_active', diff --git a/CRM/Core/DAO/MessageTemplate.php b/CRM/Core/DAO/MessageTemplate.php index 7ba12439092b..5b4604881fff 100644 --- a/CRM/Core/DAO/MessageTemplate.php +++ b/CRM/Core/DAO/MessageTemplate.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/MessageTemplate.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:988d404fbe6cd84e14a175f71b3f8440) + * (GenCodeChecksum:334135bbbd8614a2501e1cf56715eb46) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO { /** * Message Template ID * - * @var int unsigned + * @var int */ public $id; @@ -64,42 +64,42 @@ class CRM_Core_DAO_MessageTemplate extends CRM_Core_DAO { public $msg_html; /** - * @var boolean + * @var bool */ public $is_active; /** * a pseudo-FK to civicrm_option_value * - * @var int unsigned + * @var int */ public $workflow_id; /** * is this the default message template for the workflow referenced by workflow_id? * - * @var boolean + * @var bool */ public $is_default; /** * is this the reserved message template which we ship for the workflow referenced by workflow_id? * - * @var boolean + * @var bool */ public $is_reserved; /** * Is this message template used for sms? * - * @var boolean + * @var bool */ public $is_sms; /** * a pseudo-FK to civicrm_option_value containing PDF Page Format. * - * @var int unsigned + * @var int */ public $pdf_format_id; @@ -254,7 +254,7 @@ public static function &fields() { 'optionGroupName' => 'pdf_format', 'keyColumn' => 'id', 'optionEditPath' => 'civicrm/admin/options/pdf_format', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Core/DAO/Navigation.php b/CRM/Core/DAO/Navigation.php index 3e025a452bf6..2aa3fc3d0d21 100644 --- a/CRM/Core/DAO/Navigation.php +++ b/CRM/Core/DAO/Navigation.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Navigation.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:f168de98d6c4d46c63abfd789f6fdf24) + * (GenCodeChecksum:377bbf9cfce4cb146a9638344c718b11) */ /** @@ -29,14 +29,14 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this navigation item for * - * @var int unsigned + * @var int */ public $domain_id; @@ -85,21 +85,21 @@ class CRM_Core_DAO_Navigation extends CRM_Core_DAO { /** * Parent navigation item, used for grouping * - * @var int unsigned + * @var int */ public $parent_id; /** * Is this navigation item active? * - * @var boolean + * @var bool */ public $is_active; /** * If separator needs to be added after this menu item * - * @var boolean + * @var bool */ public $has_separator; @@ -169,7 +169,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'label' => [ 'name' => 'label', @@ -267,7 +267,7 @@ public static function &fields() { 'keyColumn' => 'id', 'labelColumn' => 'label', 'nameColumn' => 'name', - ] + ], ], 'is_active' => [ 'name' => 'is_active', diff --git a/CRM/Core/DAO/Note.php b/CRM/Core/DAO/Note.php index 84ecb5ba8006..4fe2a823cc53 100644 --- a/CRM/Core/DAO/Note.php +++ b/CRM/Core/DAO/Note.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Note.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:daafebd13390de67d82735263e9fa886) + * (GenCodeChecksum:c5b4c2796ae7a974e822e74d9e5b4338) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO { /** * Note ID * - * @var int unsigned + * @var int */ public $id; @@ -45,7 +45,7 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO { /** * Foreign key to the referenced item. * - * @var int unsigned + * @var int */ public $entity_id; @@ -59,7 +59,7 @@ class CRM_Core_DAO_Note extends CRM_Core_DAO { /** * FK to Contact ID creator * - * @var int unsigned + * @var int */ public $contact_id; @@ -143,7 +143,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Core_BAO_Note::entityTables', - ] + ], ], 'entity_id' => [ 'name' => 'entity_id', @@ -234,7 +234,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'note_privacy', 'optionEditPath' => 'civicrm/admin/options/note_privacy', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Core/DAO/OpenID.php b/CRM/Core/DAO/OpenID.php index 206cb5ba8846..542d774e9fa6 100644 --- a/CRM/Core/DAO/OpenID.php +++ b/CRM/Core/DAO/OpenID.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/OpenID.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:8f43063bba0682c56356dbf7afa64658) + * (GenCodeChecksum:d63a37d228f3faa87726f65906737301) */ /** @@ -31,21 +31,21 @@ class CRM_Core_DAO_OpenID extends CRM_Core_DAO { /** * Unique OpenID ID * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * Which Location does this email belong to. * - * @var int unsigned + * @var int */ public $location_type_id; @@ -59,14 +59,14 @@ class CRM_Core_DAO_OpenID extends CRM_Core_DAO { /** * Whether or not this user is allowed to login * - * @var boolean + * @var bool */ public $allowed_to_login; /** * Is this the primary email for this contact and location. * - * @var boolean + * @var bool */ public $is_primary; diff --git a/CRM/Core/DAO/OptionGroup.php b/CRM/Core/DAO/OptionGroup.php index fa42e8ebfc46..9908d873aebb 100644 --- a/CRM/Core/DAO/OptionGroup.php +++ b/CRM/Core/DAO/OptionGroup.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/OptionGroup.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:2437cfeb4ae146ce21397bb38dfa08e1) + * (GenCodeChecksum:c9ed24515dcc4ce676fb21518bd90791) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { /** * Option Group ID * - * @var int unsigned + * @var int */ public $id; @@ -66,21 +66,21 @@ class CRM_Core_DAO_OptionGroup extends CRM_Core_DAO { /** * Is this a predefined system option group (i.e. it can not be deleted)? * - * @var boolean + * @var bool */ public $is_reserved; /** * Is this option group active? * - * @var boolean + * @var bool */ public $is_active; /** * A lock to remove the ability to add new options via the UI. * - * @var boolean + * @var bool */ public $is_locked; @@ -166,7 +166,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Utils_Type::dataTypes', - ] + ], ], 'is_reserved' => [ 'name' => 'is_reserved', diff --git a/CRM/Core/DAO/OptionValue.php b/CRM/Core/DAO/OptionValue.php index 2fb21aa4ea27..3f62e140d3ea 100644 --- a/CRM/Core/DAO/OptionValue.php +++ b/CRM/Core/DAO/OptionValue.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/OptionValue.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:356278f04173ed064fa82cacafa7edbe) + * (GenCodeChecksum:803748252a3d5c50be80b18ccdb3132c) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO { /** * Option ID * - * @var int unsigned + * @var int */ public $id; /** * Group which this option belongs to. * - * @var int unsigned + * @var int */ public $option_group_id; @@ -73,21 +73,21 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO { /** * Bitwise logic can be used to create subsets of options within an option_group for different uses. * - * @var int unsigned + * @var int */ public $filter; /** * Is this the default option for the group? * - * @var boolean + * @var bool */ public $is_default; /** * Controls display sort order. * - * @var int unsigned + * @var int */ public $weight; @@ -101,40 +101,40 @@ class CRM_Core_DAO_OptionValue extends CRM_Core_DAO { /** * Is this row simply a display header? Expected usage is to render these as OPTGROUP tags within a SELECT field list of options? * - * @var boolean + * @var bool */ public $is_optgroup; /** * Is this a predefined system object? * - * @var boolean + * @var bool */ public $is_reserved; /** * Is this option active? * - * @var boolean + * @var bool */ public $is_active; /** * Component that this option value belongs/caters to. * - * @var int unsigned + * @var int */ public $component_id; /** * Which Domain is this option value for * - * @var int unsigned + * @var int */ public $domain_id; /** - * @var int unsigned + * @var int */ public $visibility_id; @@ -216,7 +216,7 @@ public static function &fields() { 'table' => 'civicrm_option_group', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'label' => [ 'name' => 'label', @@ -379,7 +379,7 @@ public static function &fields() { 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'domain_id' => [ 'name' => 'domain_id', @@ -396,7 +396,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'visibility_id' => [ 'name' => 'visibility_id', @@ -411,7 +411,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'visibility', 'optionEditPath' => 'civicrm/admin/options/visibility', - ] + ], ], 'icon' => [ 'name' => 'icon', diff --git a/CRM/Core/DAO/Persistent.php b/CRM/Core/DAO/Persistent.php index 3f56e7c6933a..41ffa70f1b38 100644 --- a/CRM/Core/DAO/Persistent.php +++ b/CRM/Core/DAO/Persistent.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Persistent.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:0c52f813dd1e954e1709b819128790f3) + * (GenCodeChecksum:4044954800a1201a4e3c376d48342f4c) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Persistent extends CRM_Core_DAO { /** * Persistent Record Id * - * @var int unsigned + * @var int */ public $id; @@ -59,7 +59,7 @@ class CRM_Core_DAO_Persistent extends CRM_Core_DAO { /** * Config Settings * - * @var boolean + * @var bool */ public $is_config; diff --git a/CRM/Core/DAO/Phone.php b/CRM/Core/DAO/Phone.php index fce47cfc31ec..f85772ce62fa 100644 --- a/CRM/Core/DAO/Phone.php +++ b/CRM/Core/DAO/Phone.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Phone.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a3b4aba6b896154133688f4318ea866b) + * (GenCodeChecksum:ac451e083bb4bbf26f53556086b266bf) */ /** @@ -31,42 +31,42 @@ class CRM_Core_DAO_Phone extends CRM_Core_DAO { /** * Unique Phone ID * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * Which Location does this phone belong to. * - * @var int unsigned + * @var int */ public $location_type_id; /** * Is this the primary phone for this contact and location. * - * @var boolean + * @var bool */ public $is_primary; /** * Is this the billing? * - * @var boolean + * @var bool */ public $is_billing; /** * Which Mobile Provider does this phone belong to. * - * @var int unsigned + * @var int */ public $mobile_provider_id; @@ -94,7 +94,7 @@ class CRM_Core_DAO_Phone extends CRM_Core_DAO { /** * Which type of phone does this number belongs. * - * @var int unsigned + * @var int */ public $phone_type_id; @@ -170,7 +170,7 @@ public static function &fields() { 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ] + ], ], 'is_primary' => [ 'name' => 'is_primary', @@ -277,7 +277,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'phone_type', 'optionEditPath' => 'civicrm/admin/options/phone_type', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Core/DAO/PreferencesDate.php b/CRM/Core/DAO/PreferencesDate.php index 45f75c9cc21a..2441d6c0327c 100644 --- a/CRM/Core/DAO/PreferencesDate.php +++ b/CRM/Core/DAO/PreferencesDate.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/PreferencesDate.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:46e5c6a6ea6b21e1966679f41782c340) + * (GenCodeChecksum:18663ed2b585f1598a26a5a491c67ea6) */ /** @@ -29,7 +29,7 @@ class CRM_Core_DAO_PreferencesDate extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; diff --git a/CRM/Core/DAO/PrevNextCache.php b/CRM/Core/DAO/PrevNextCache.php index 9af6dafa8c1d..682f6984c40c 100644 --- a/CRM/Core/DAO/PrevNextCache.php +++ b/CRM/Core/DAO/PrevNextCache.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/PrevNextCache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ec5d04442cf8976a3163cabeb3ba433c) + * (GenCodeChecksum:dba140c3d2ece863c512ed688df2ebcb) */ /** @@ -29,7 +29,7 @@ class CRM_Core_DAO_PrevNextCache extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; @@ -43,14 +43,14 @@ class CRM_Core_DAO_PrevNextCache extends CRM_Core_DAO { /** * FK to entity table specified in entity_table column. * - * @var int unsigned + * @var int */ public $entity_id1; /** * FK to entity table specified in entity_table column. * - * @var int unsigned + * @var int */ public $entity_id2; @@ -69,7 +69,7 @@ class CRM_Core_DAO_PrevNextCache extends CRM_Core_DAO { public $data; /** - * @var boolean + * @var bool */ public $is_selected; diff --git a/CRM/Core/DAO/PrintLabel.php b/CRM/Core/DAO/PrintLabel.php index 1f20a3825e1f..55916812524c 100644 --- a/CRM/Core/DAO/PrintLabel.php +++ b/CRM/Core/DAO/PrintLabel.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/PrintLabel.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ca56833ea757bf1363d618add294960d) + * (GenCodeChecksum:2bf1df61a7093242ac2cde0d4d8ef1e0) */ /** @@ -29,7 +29,7 @@ class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; @@ -64,7 +64,7 @@ class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO { /** * Implicit FK to civicrm_option_value row in NEW label_type option group * - * @var int unsigned + * @var int */ public $label_type_id; @@ -78,28 +78,28 @@ class CRM_Core_DAO_PrintLabel extends CRM_Core_DAO { /** * Is this default? * - * @var boolean + * @var bool */ public $is_default; /** * Is this option active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this reserved label? * - * @var boolean + * @var bool */ public $is_reserved; /** * FK to civicrm_contact, who created this label layout * - * @var int unsigned + * @var int */ public $created_id; @@ -200,7 +200,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'name_badge', 'optionEditPath' => 'civicrm/admin/options/name_badge', - ] + ], ], 'label_type_id' => [ 'name' => 'label_type_id', @@ -218,7 +218,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'label_type', 'optionEditPath' => 'civicrm/admin/options/label_type', - ] + ], ], 'data' => [ 'name' => 'data', diff --git a/CRM/Core/DAO/RecurringEntity.php b/CRM/Core/DAO/RecurringEntity.php index 9aed7cc92509..cd514f9b3da5 100644 --- a/CRM/Core/DAO/RecurringEntity.php +++ b/CRM/Core/DAO/RecurringEntity.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/RecurringEntity.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:810f5bce8bb650c96703532242f254e8) + * (GenCodeChecksum:9e730db130a597de8528532d06f2ad54) */ /** @@ -29,21 +29,21 @@ class CRM_Core_DAO_RecurringEntity extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; /** * Recurring Entity Parent ID * - * @var int unsigned + * @var int */ public $parent_id; /** * Recurring Entity Child ID * - * @var int unsigned + * @var int */ public $entity_id; @@ -57,7 +57,7 @@ class CRM_Core_DAO_RecurringEntity extends CRM_Core_DAO { /** * 1-this entity, 2-this and the following entities, 3-all the entities * - * @var boolean + * @var bool */ public $mode; diff --git a/CRM/Core/DAO/Setting.php b/CRM/Core/DAO/Setting.php index 5a16f8c65696..bb9401d1a5bf 100644 --- a/CRM/Core/DAO/Setting.php +++ b/CRM/Core/DAO/Setting.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Setting.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:1af3984556a05189587658c306d09348) + * (GenCodeChecksum:7bbe096eb48d3744aa86453cccb99bfb) */ /** @@ -29,7 +29,7 @@ class CRM_Core_DAO_Setting extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; @@ -50,28 +50,28 @@ class CRM_Core_DAO_Setting extends CRM_Core_DAO { /** * Which Domain is this menu item for * - * @var int unsigned + * @var int */ public $domain_id; /** * FK to Contact ID if the setting is localized to a contact * - * @var int unsigned + * @var int */ public $contact_id; /** * Is this setting a contact specific or site wide setting? * - * @var boolean + * @var bool */ public $is_domain; /** * Component that this menu item belongs to * - * @var int unsigned + * @var int */ public $component_id; @@ -85,7 +85,7 @@ class CRM_Core_DAO_Setting extends CRM_Core_DAO { /** * FK to civicrm_contact, who created this setting * - * @var int unsigned + * @var int */ public $created_id; @@ -175,7 +175,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'contact_id' => [ 'name' => 'contact_id', @@ -218,7 +218,7 @@ public static function &fields() { 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'created_date' => [ 'name' => 'created_date', diff --git a/CRM/Core/DAO/StateProvince.php b/CRM/Core/DAO/StateProvince.php index cb0e4b98ed1e..bf17bcd93603 100644 --- a/CRM/Core/DAO/StateProvince.php +++ b/CRM/Core/DAO/StateProvince.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/StateProvince.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:66bbfa3f81cb6baec8d7175f5f32718a) + * (GenCodeChecksum:38620d39135bc4e42f0cc688dff9cb5b) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_StateProvince extends CRM_Core_DAO { /** * State/Province ID * - * @var int unsigned + * @var int */ public $id; @@ -52,7 +52,7 @@ class CRM_Core_DAO_StateProvince extends CRM_Core_DAO { /** * ID of Country that State/Province belong * - * @var int unsigned + * @var int */ public $country_id; diff --git a/CRM/Core/DAO/StatusPreference.php b/CRM/Core/DAO/StatusPreference.php index c2cd8d97d982..94f5d5993802 100644 --- a/CRM/Core/DAO/StatusPreference.php +++ b/CRM/Core/DAO/StatusPreference.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/StatusPreference.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:b30c850f5621be00f3a7e828c7fe7c61) + * (GenCodeChecksum:777d59b72a077ecb4d4caa60e13bb479) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO { /** * Unique Status Preference ID * - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this Status Preference for * - * @var int unsigned + * @var int */ public $domain_id; @@ -59,7 +59,7 @@ class CRM_Core_DAO_StatusPreference extends CRM_Core_DAO { /** * Hush messages up to and including this severity. * - * @var int unsigned + * @var int */ public $ignore_severity; @@ -136,7 +136,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'name' => [ 'name' => 'name', @@ -183,7 +183,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Utils_Check::getSeverityList', - ] + ], ], 'prefs' => [ 'name' => 'prefs', diff --git a/CRM/Core/DAO/SystemLog.php b/CRM/Core/DAO/SystemLog.php index f3c7e8817f93..c1587e0bdd68 100644 --- a/CRM/Core/DAO/SystemLog.php +++ b/CRM/Core/DAO/SystemLog.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/SystemLog.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:edcf9c070365c92afa56f7f3fe79acee) + * (GenCodeChecksum:a2276bcf3bb39a3947bf54b043fa0a05) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_SystemLog extends CRM_Core_DAO { /** * Primary key ID * - * @var int unsigned + * @var int */ public $id; @@ -66,7 +66,7 @@ class CRM_Core_DAO_SystemLog extends CRM_Core_DAO { /** * Optional Contact ID that created the log. Not an FK as we keep this regardless * - * @var int unsigned + * @var int */ public $contact_id; diff --git a/CRM/Core/DAO/Tag.php b/CRM/Core/DAO/Tag.php index 24fc209c681b..826157f63cca 100644 --- a/CRM/Core/DAO/Tag.php +++ b/CRM/Core/DAO/Tag.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Tag.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:8c816585b0863674074b4aaf5c644cab) + * (GenCodeChecksum:3abd98f177e35fd993b77bf08b115e4a) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Tag extends CRM_Core_DAO { /** * Tag ID * - * @var int unsigned + * @var int */ public $id; @@ -52,24 +52,24 @@ class CRM_Core_DAO_Tag extends CRM_Core_DAO { /** * Optional parent id for this tag. * - * @var int unsigned + * @var int */ public $parent_id; /** * Is this tag selectable / displayed * - * @var boolean + * @var bool */ public $is_selectable; /** - * @var boolean + * @var bool */ public $is_reserved; /** - * @var boolean + * @var bool */ public $is_tagset; @@ -81,7 +81,7 @@ class CRM_Core_DAO_Tag extends CRM_Core_DAO { /** * FK to civicrm_contact, who created this tag * - * @var int unsigned + * @var int */ public $created_id; @@ -236,7 +236,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'tag_used_for', 'optionEditPath' => 'civicrm/admin/options/tag_used_for', - ] + ], ], 'created_id' => [ 'name' => 'created_id', diff --git a/CRM/Core/DAO/Timezone.php b/CRM/Core/DAO/Timezone.php index 91418a1c74dc..0c33a2f11d8d 100644 --- a/CRM/Core/DAO/Timezone.php +++ b/CRM/Core/DAO/Timezone.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Timezone.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:e54363ef08090c4dfbed076c842edd03) + * (GenCodeChecksum:7a377d04c1e9cfede74c42b155e301f5) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Timezone extends CRM_Core_DAO { /** * Timezone Id * - * @var int unsigned + * @var int */ public $id; @@ -64,7 +64,7 @@ class CRM_Core_DAO_Timezone extends CRM_Core_DAO { /** * Country Id * - * @var int unsigned + * @var int */ public $country_id; diff --git a/CRM/Core/DAO/UFField.php b/CRM/Core/DAO/UFField.php index 5d6c9183e4e0..7f06eb7a50cb 100644 --- a/CRM/Core/DAO/UFField.php +++ b/CRM/Core/DAO/UFField.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/UFField.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:3acfd1d2bd5f1e54f8aee7f96328cb58) + * (GenCodeChecksum:4e6400ee9a0d081541d8e14366129502) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO { /** * Unique table ID * - * @var int unsigned + * @var int */ public $id; /** * Which form does this field belong to. * - * @var int unsigned + * @var int */ public $uf_group_id; @@ -52,21 +52,21 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO { /** * Is this field currently shareable? If false, hide the field for all sharing contexts. * - * @var boolean + * @var bool */ public $is_active; /** * the field is view only and not editable in user forms. * - * @var boolean + * @var bool */ public $is_view; /** * Is this field required when included in a user or registration form? * - * @var boolean + * @var bool */ public $is_required; @@ -101,35 +101,35 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO { /** * Is this field included as a column in the selector table? * - * @var boolean + * @var bool */ public $in_selector; /** * Is this field included search form of profile? * - * @var boolean + * @var bool */ public $is_searchable; /** * Location type of this mapping, if required * - * @var int unsigned + * @var int */ public $location_type_id; /** * Phone Type Id, if required * - * @var int unsigned + * @var int */ public $phone_type_id; /** * Website Type Id, if required * - * @var int unsigned + * @var int */ public $website_type_id; @@ -150,14 +150,14 @@ class CRM_Core_DAO_UFField extends CRM_Core_DAO { /** * Is this field reserved for use by some other CiviCRM functionality? * - * @var boolean + * @var bool */ public $is_reserved; /** * Include in multi-record listing? * - * @var boolean + * @var bool */ public $is_multi_summary; @@ -224,7 +224,7 @@ public static function &fields() { 'table' => 'civicrm_uf_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'field_name' => [ 'name' => 'field_name', @@ -241,7 +241,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Core_BAO_UFField::getAvailableFieldTitles', - ] + ], ], 'is_active' => [ 'name' => 'is_active', @@ -332,7 +332,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::ufVisibility', - ] + ], ], 'in_selector' => [ 'name' => 'in_selector', @@ -383,7 +383,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'phone_type', 'optionEditPath' => 'civicrm/admin/options/phone_type', - ] + ], ], 'website_type_id' => [ 'name' => 'website_type_id', @@ -398,7 +398,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', - ] + ], ], 'label' => [ 'name' => 'label', diff --git a/CRM/Core/DAO/UFGroup.php b/CRM/Core/DAO/UFGroup.php index 290ed5b3b17e..792c2abb1f56 100644 --- a/CRM/Core/DAO/UFGroup.php +++ b/CRM/Core/DAO/UFGroup.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/UFGroup.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:0f78fb49440e1cf5d43fd3db5a43ee7e) + * (GenCodeChecksum:2a382dd695bc7d2ad3dca96996c5258b) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { /** * Unique table ID * - * @var int unsigned + * @var int */ public $id; /** * Is this form currently active? If false, hide all related fields for all sharing contexts. * - * @var boolean + * @var bool */ public $is_active; @@ -87,7 +87,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { /** * Group id, foreign key from civicrm_group * - * @var int unsigned + * @var int */ public $limit_listings_group_id; @@ -101,42 +101,42 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { /** * foreign key to civicrm_group_id * - * @var int unsigned + * @var int */ public $add_to_group_id; /** * Should a CAPTCHA widget be included this Profile form. * - * @var boolean + * @var bool */ public $add_captcha; /** * Do we want to map results from this profile. * - * @var boolean + * @var bool */ public $is_map; /** * Should edit link display in profile selector * - * @var boolean + * @var bool */ public $is_edit_link; /** * Should we display a link to the website profile in profile selector * - * @var boolean + * @var bool */ public $is_uf_link; /** * Should we update the contact record if we find a duplicate * - * @var boolean + * @var bool */ public $is_update_dupe; @@ -150,7 +150,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { /** * Should we create a cms user for this profile * - * @var boolean + * @var bool */ public $is_cms_user; @@ -162,7 +162,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { /** * Is this group reserved for use by some other CiviCRM functionality? * - * @var boolean + * @var bool */ public $is_reserved; @@ -176,7 +176,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { /** * FK to civicrm_contact, who created this UF group * - * @var int unsigned + * @var int */ public $created_id; @@ -190,7 +190,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { /** * Should we include proximity search feature in this profile search form? * - * @var boolean + * @var bool */ public $is_proximity_search; @@ -211,7 +211,7 @@ class CRM_Core_DAO_UFGroup extends CRM_Core_DAO { /** * Should a Cancel button be included in this Profile form. * - * @var boolean + * @var bool */ public $add_cancel_button; diff --git a/CRM/Core/DAO/UFJoin.php b/CRM/Core/DAO/UFJoin.php index 2f940a4d74a3..05bf4704f997 100644 --- a/CRM/Core/DAO/UFJoin.php +++ b/CRM/Core/DAO/UFJoin.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/UFJoin.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:09aaa3fd826c1b3407d39966f0f11aa7) + * (GenCodeChecksum:00acc4bbb42aee2a24981b30456458c1) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_UFJoin extends CRM_Core_DAO { /** * Unique table ID * - * @var int unsigned + * @var int */ public $id; /** * Is this join currently active? * - * @var boolean + * @var bool */ public $is_active; @@ -59,7 +59,7 @@ class CRM_Core_DAO_UFJoin extends CRM_Core_DAO { /** * Foreign key to the referenced item. * - * @var int unsigned + * @var int */ public $entity_id; @@ -73,7 +73,7 @@ class CRM_Core_DAO_UFJoin extends CRM_Core_DAO { /** * Which form does this field belong to. * - * @var int unsigned + * @var int */ public $uf_group_id; @@ -168,7 +168,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Core_BAO_UFJoin::entityTables', - ] + ], ], 'entity_id' => [ 'name' => 'entity_id', @@ -213,7 +213,7 @@ public static function &fields() { 'table' => 'civicrm_uf_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'module_data' => [ 'name' => 'module_data', diff --git a/CRM/Core/DAO/UFMatch.php b/CRM/Core/DAO/UFMatch.php index 0e072cef5d2e..fc1d60dc1aed 100644 --- a/CRM/Core/DAO/UFMatch.php +++ b/CRM/Core/DAO/UFMatch.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/UFMatch.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:3dbbb5d21dec55536826e465629f7174) + * (GenCodeChecksum:b7305bf7df97967d214db393a34f740f) */ /** @@ -31,21 +31,21 @@ class CRM_Core_DAO_UFMatch extends CRM_Core_DAO { /** * System generated ID. * - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this match entry for * - * @var int unsigned + * @var int */ public $domain_id; /** * UF ID * - * @var int unsigned + * @var int */ public $uf_id; @@ -59,7 +59,7 @@ class CRM_Core_DAO_UFMatch extends CRM_Core_DAO { /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; @@ -130,7 +130,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'uf_id' => [ 'name' => 'uf_id', diff --git a/CRM/Core/DAO/Website.php b/CRM/Core/DAO/Website.php index 6976248baa07..31b4d03d4ebf 100644 --- a/CRM/Core/DAO/Website.php +++ b/CRM/Core/DAO/Website.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Website.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:3c7acea3980658a252658fd11578cfbe) + * (GenCodeChecksum:22c11a2bc194d075912df3279acc6a97) */ /** @@ -31,14 +31,14 @@ class CRM_Core_DAO_Website extends CRM_Core_DAO { /** * Unique Website ID * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; @@ -52,7 +52,7 @@ class CRM_Core_DAO_Website extends CRM_Core_DAO { /** * Which Website type does this website belong to. * - * @var int unsigned + * @var int */ public $website_type_id; @@ -147,7 +147,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'website_type', 'optionEditPath' => 'civicrm/admin/options/website_type', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Core/DAO/WordReplacement.php b/CRM/Core/DAO/WordReplacement.php index dfde25755f69..637bcceb5b37 100644 --- a/CRM/Core/DAO/WordReplacement.php +++ b/CRM/Core/DAO/WordReplacement.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/WordReplacement.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:df2cde8fb1f65a25db724d35387a1342) + * (GenCodeChecksum:1f2d0542e46494b542dce1c0132a1643) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO { /** * Word replacement ID * - * @var int unsigned + * @var int */ public $id; @@ -52,7 +52,7 @@ class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO { /** * Is this entry active? * - * @var boolean + * @var bool */ public $is_active; @@ -64,7 +64,7 @@ class CRM_Core_DAO_WordReplacement extends CRM_Core_DAO { /** * FK to Domain ID. This is for Domain specific word replacement * - * @var int unsigned + * @var int */ public $domain_id; @@ -166,7 +166,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getWordReplacementMatchType', - ] + ], ], 'domain_id' => [ 'name' => 'domain_id', @@ -183,7 +183,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Core/DAO/Worldregion.php b/CRM/Core/DAO/Worldregion.php index fc5b2eb2691a..05665f23037e 100644 --- a/CRM/Core/DAO/Worldregion.php +++ b/CRM/Core/DAO/Worldregion.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Core/Worldregion.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:f326bc6047454a630b352baf190b0cac) + * (GenCodeChecksum:b607c0ba0b25b3f785779384fc6a6887) */ /** @@ -31,7 +31,7 @@ class CRM_Core_DAO_Worldregion extends CRM_Core_DAO { /** * Country Id * - * @var int unsigned + * @var int */ public $id; diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index 07b1a8548967..ede46d09d6fd 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -61,7 +61,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form { /** * Have we already done this search * - * @var boolean + * @var bool */ protected $_done; diff --git a/CRM/Core/IDS.php b/CRM/Core/IDS.php index 92af8f69c282..4d0d513e2c01 100644 --- a/CRM/Core/IDS.php +++ b/CRM/Core/IDS.php @@ -126,7 +126,7 @@ public static function createBaseConfig() { 'filter_type' => 'xml', 'filter_path' => "{$civicrm_root}/packages/IDS/default_filter.xml", 'tmp_path' => $tmpDir, - 'HTML_Purifier_Path' => $civicrm_root . '/vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php', + 'HTML_Purifier_Path' => $civicrm_root . 'packages/IDS/vendors/htmlpurifer/HTMLPurifier.auto.php', 'HTML_Purifier_Cache' => $tmpDir, 'scan_keys' => '', 'exceptions' => ['__utmz', '__utmc'], diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index e8908fea50f1..145c91af5335 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -67,7 +67,7 @@ class CRM_Core_Page { * so the display routine needs to not do any work. (The * parent object takes care of the display) * - * @var boolean + * @var bool */ protected $_embedded = FALSE; @@ -75,7 +75,7 @@ class CRM_Core_Page { * Are we in print mode? if so we need to modify the display * functionality to do a minimal display :) * - * @var boolean + * @var bool */ protected $_print = FALSE; diff --git a/CRM/Core/Page/File.php b/CRM/Core/Page/File.php index 362e3d161686..c1f6cd10bf08 100644 --- a/CRM/Core/Page/File.php +++ b/CRM/Core/Page/File.php @@ -68,12 +68,25 @@ public function run() { $mimeType = ''; $path = CRM_Core_Config::singleton()->customFileUploadDir . $fileName; } - $mimeType = CRM_Utils_Request::retrieveValue('mime-type', 'String', $mimeType, FALSE); if (!$path) { CRM_Core_Error::statusBounce('Could not retrieve the file'); } + if (empty($mimeType)) { + $passedInMimeType = self::convertBadMimeAliasTypes(CRM_Utils_Request::retrieveValue('mime-type', 'String', $mimeType, FALSE)); + if (!in_array($passedInMimeType, explode(',', Civi::settings()->get('requestableMimeTypes')))) { + throw new CRM_Core_Exception("Supplied mime-type is not accepted"); + } + $extension = CRM_Utils_File::getExtensionFromPath($path); + $candidateExtensions = CRM_Utils_File::getAcceptableExtensionsForMimeType($passedInMimeType); + if (!in_array($extension, $candidateExtensions)) { + throw new CRM_Core_Exception("Supplied mime-type does not match file extension"); + } + // Now that we have validated mime-type supplied as much as possible lets now set the MimeType variable/ + $mimeType = $passedInMimeType; + } + $buffer = file_get_contents($path); if (!$buffer) { CRM_Core_Error::statusBounce('The file is either empty or you do not have permission to retrieve the file'); @@ -101,4 +114,33 @@ public function run() { } } + /** + * Translate one mime type to another. + * + * Certain non-standard/weird MIME types have been common. Unfortunately, because + * of the way this controller is used, the weird types may baked-into URLs. + * We clean these up for compatibility. + * + * @param string $type + * Ex: 'image/jpg' + * @return string + * Ex: 'image/jpeg'. + */ + protected static function convertBadMimeAliasTypes($type) { + $badTypes = [ + // Before PNG format was ubiquitous, it was image/x-png? + 'image/x-png' => 'image/png', + + // People see "image/gif" and "image/png" and wrongly guess "image/jpg"? + 'image/jpg' => 'image/jpeg', + 'image/tif' => 'image/tiff', + 'image/svg' => 'image/svg+xml', + + // StackExchange attributes "pjpeg" to some quirk in an old version of IE? + 'image/pjpeg' => 'image/jpeg', + + ]; + return isset($badTypes[$type]) ? $badTypes[$type] : $type; + } + } diff --git a/CRM/Core/Payment/Elavon.php b/CRM/Core/Payment/Elavon.php index 7b91ac425198..8d9df671c4da 100644 --- a/CRM/Core/Payment/Elavon.php +++ b/CRM/Core/Payment/Elavon.php @@ -343,7 +343,13 @@ public function buildXML($requestFields) { $xml = ''; foreach ($requestFields as $key => $value) { - $xml .= '<' . $key . '>' . self::tidyStringforXML($value, $xmlFieldLength[$key]) . ''; + //dev/core/966 Don't send email through the urlencode. + if ($key == 'ssl_email') { + $xml .= '<' . $key . '>' . substr($value, 0, $xmlFieldLength[$key]) . ''; + } + else { + $xml .= '<' . $key . '>' . self::tidyStringforXML($value, $xmlFieldLength[$key]) . ''; + } } $xml .= ''; return $xml; diff --git a/CRM/Core/Permission/Backdrop.php b/CRM/Core/Permission/Backdrop.php index e2277df2f173..915b95f614c7 100644 --- a/CRM/Core/Permission/Backdrop.php +++ b/CRM/Core/Permission/Backdrop.php @@ -41,14 +41,15 @@ class CRM_Core_Permission_Backdrop extends CRM_Core_Permission_DrupalBase { /** * Is this user someone with access for the entire system. * - * @var boolean + * @var bool */ protected $_viewAdminUser = FALSE; protected $_editAdminUser = FALSE; /** * Am in in view permission or edit permission? - * @var boolean + * + * @var bool */ protected $_viewPermission = FALSE; protected $_editPermission = FALSE; diff --git a/CRM/Core/Permission/Drupal.php b/CRM/Core/Permission/Drupal.php index 9c0bbdee78c9..f49c0dd52ec5 100644 --- a/CRM/Core/Permission/Drupal.php +++ b/CRM/Core/Permission/Drupal.php @@ -41,14 +41,14 @@ class CRM_Core_Permission_Drupal extends CRM_Core_Permission_DrupalBase { /** * Is this user someone with access for the entire system. * - * @var boolean + * @var bool */ protected $_viewAdminUser = FALSE; protected $_editAdminUser = FALSE; /** * Am in in view permission or edit permission? - * @var boolean + * @var bool */ protected $_viewPermission = FALSE; protected $_editPermission = FALSE; diff --git a/CRM/Core/Permission/Drupal6.php b/CRM/Core/Permission/Drupal6.php index d969ed42373f..eb1a8801fefe 100644 --- a/CRM/Core/Permission/Drupal6.php +++ b/CRM/Core/Permission/Drupal6.php @@ -41,14 +41,14 @@ class CRM_Core_Permission_Drupal6 extends CRM_Core_Permission_DrupalBase { /** * Is this user someone with access for the entire system. * - * @var boolean + * @var bool */ protected $_viewAdminUser = FALSE; protected $_editAdminUser = FALSE; /** * Am in in view permission or edit permission? - * @var boolean + * @var bool */ protected $_viewPermission = FALSE; protected $_editPermission = FALSE; diff --git a/CRM/Core/Permission/DrupalBase.php b/CRM/Core/Permission/DrupalBase.php index b691211be25a..74baeac71cb9 100644 --- a/CRM/Core/Permission/DrupalBase.php +++ b/CRM/Core/Permission/DrupalBase.php @@ -41,14 +41,15 @@ class CRM_Core_Permission_DrupalBase extends CRM_Core_Permission_Base { /** * Is this user someone with access for the entire system. * - * @var boolean + * @var bool */ protected $_viewAdminUser = FALSE; protected $_editAdminUser = FALSE; /** * Am in in view permission or edit permission? - * @var boolean + * + * @var bool */ protected $_viewPermission = FALSE; protected $_editPermission = FALSE; diff --git a/CRM/Core/Region.php b/CRM/Core/Region.php index a9f9e13b71ae..6ece48f8893d 100644 --- a/CRM/Core/Region.php +++ b/CRM/Core/Region.php @@ -38,7 +38,7 @@ public static function &instance($name, $autocreate = TRUE) { /** * Whether the snippets array has been sorted * - * @var boolean + * @var bool */ public $_isSorted; diff --git a/CRM/Custom/Import/Parser.php b/CRM/Custom/Import/Parser.php index 0832d00bac6e..7193515cf996 100644 --- a/CRM/Custom/Import/Parser.php +++ b/CRM/Custom/Import/Parser.php @@ -62,7 +62,7 @@ abstract class CRM_Custom_Import_Parser extends CRM_Contact_Import_Parser { /** * Whether the file has a column header or not * - * @var boolean + * @var bool */ protected $_haveColumnHeader; diff --git a/CRM/Cxn/DAO/Cxn.php b/CRM/Cxn/DAO/Cxn.php index 7713ee953ff5..c75742e2383b 100644 --- a/CRM/Cxn/DAO/Cxn.php +++ b/CRM/Cxn/DAO/Cxn.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Cxn/Cxn.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:999790d380fa004a25265a1a0126fb95) + * (GenCodeChecksum:bd6f3b0785ec9b05984d8ad32f3b8464) */ /** @@ -31,7 +31,7 @@ class CRM_Cxn_DAO_Cxn extends CRM_Core_DAO { /** * Connection ID * - * @var int unsigned + * @var int */ public $id; @@ -80,7 +80,7 @@ class CRM_Cxn_DAO_Cxn extends CRM_Core_DAO { /** * Is connection currently enabled? * - * @var boolean + * @var bool */ public $is_active; diff --git a/CRM/Dedupe/DAO/Exception.php b/CRM/Dedupe/DAO/Exception.php index cfc6bc3b9a0a..9e0daa833a8b 100644 --- a/CRM/Dedupe/DAO/Exception.php +++ b/CRM/Dedupe/DAO/Exception.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Dedupe/Exception.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:1f39e9ee1f80da1b62c054f6ca4119c5) + * (GenCodeChecksum:eec5ad673402f603903d6f35ad1bcd06) */ /** @@ -31,21 +31,21 @@ class CRM_Dedupe_DAO_Exception extends CRM_Core_DAO { /** * Unique dedupe exception id * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id1; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id2; diff --git a/CRM/Dedupe/DAO/Rule.php b/CRM/Dedupe/DAO/Rule.php index 806185c260a9..5d513b1aaf25 100644 --- a/CRM/Dedupe/DAO/Rule.php +++ b/CRM/Dedupe/DAO/Rule.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Dedupe/Rule.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:99420d466d2982510873b69c179fd9f5) + * (GenCodeChecksum:a7697e9d93641b3240e23f97f4f92329) */ /** @@ -31,14 +31,14 @@ class CRM_Dedupe_DAO_Rule extends CRM_Core_DAO { /** * Unique dedupe rule id * - * @var int unsigned + * @var int */ public $id; /** * The id of the rule group this rule belongs to * - * @var int unsigned + * @var int */ public $dedupe_rule_group_id; @@ -59,7 +59,7 @@ class CRM_Dedupe_DAO_Rule extends CRM_Core_DAO { /** * The length of the matching substring * - * @var int unsigned + * @var int */ public $rule_length; diff --git a/CRM/Dedupe/DAO/RuleGroup.php b/CRM/Dedupe/DAO/RuleGroup.php index 505c8044dcdc..bb54789c0b7a 100644 --- a/CRM/Dedupe/DAO/RuleGroup.php +++ b/CRM/Dedupe/DAO/RuleGroup.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Dedupe/RuleGroup.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:85fc439e89d4d0dfd403efdd1cf67531) + * (GenCodeChecksum:a0c7d9e893a3aec240db9ec4b0e8729d) */ /** @@ -31,7 +31,7 @@ class CRM_Dedupe_DAO_RuleGroup extends CRM_Core_DAO { /** * Unique dedupe rule group id * - * @var int unsigned + * @var int */ public $id; @@ -73,7 +73,7 @@ class CRM_Dedupe_DAO_RuleGroup extends CRM_Core_DAO { /** * Is this a reserved rule - a rule group that has been optimized and cannot be changed by the admin * - * @var boolean + * @var bool */ public $is_reserved; @@ -125,7 +125,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'label', 'condition' => 'parent_id IS NULL', - ] + ], ], 'threshold' => [ 'name' => 'threshold', @@ -160,7 +160,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getDedupeRuleTypes', - ] + ], ], 'name' => [ 'name' => 'name', diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 6703e57a7cda..684393da6c62 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -696,7 +696,7 @@ public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $batchLimi // 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); $cacheParams = [ 'cache_key_string' => self::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions), @@ -1080,8 +1080,6 @@ public static function getRowsElementsAndInfo($mainId, $otherId, $checkPermissio $main = self::getMergeContactDetails($mainId); $other = self::getMergeContactDetails($otherId); - $specialValues['main'] = self::getSpecialValues($main); - $specialValues['other'] = self::getSpecialValues($other); $compareFields = self::retrieveFields($main, $other); @@ -1092,14 +1090,22 @@ public static function getRowsElementsAndInfo($mainId, $otherId, $checkPermissio // CRM-15681 don't display sub-types in UI continue; } - foreach (['main', 'other'] as $moniker) { - $contact = &$$moniker; - $value = CRM_Utils_Array::value($field, $contact); - if (isset($specialValues[$moniker][$field]) && is_string($specialValues[$moniker][$field])) { - $value = CRM_Core_DAO::VALUE_SEPARATOR . trim($specialValues[$moniker][$field], CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR; + foreach (['main' => $main, 'other' => $other] as $moniker => $contact) { + $value = $label = CRM_Utils_Array::value($field, $contact); + $fieldSpec = $fields[$field]; + if (!empty($fieldSpec['serialize']) && is_array($value)) { + // In practice this only applies to preferred_communication_method as the sub types are skipped above + // and no others are serialized. + $labels = []; + foreach ($value as $individualValue) { + $labels[] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_BAO_Contact', $field, $individualValue); + } + $label = implode(', ', $labels); + // We serialize this due to historic handling but it's likely that if we just left it as an + // array all would be well & we would have less code. + $value = CRM_Core_DAO::serializeField($value, $fieldSpec['serialize']); } - $label = isset($specialValues[$moniker]["{$field}_display"]) ? $specialValues[$moniker]["{$field}_display"] : $value; - if (!empty($fields[$field]['type']) && $fields[$field]['type'] == CRM_Utils_Type::T_DATE) { + elseif (!empty($fieldSpec['type']) && $fieldSpec['type'] == CRM_Utils_Type::T_DATE) { if ($value) { $value = str_replace('-', '', $value); $label = CRM_Utils_Date::customFormat($label); @@ -1116,15 +1122,8 @@ public static function getRowsElementsAndInfo($mainId, $otherId, $checkPermissio $label = ts('[x]'); } } - elseif ($field == 'prefix_id') { - $label = CRM_Utils_Array::value('individual_prefix', $contact); - } - elseif ($field == 'suffix_id') { - $label = CRM_Utils_Array::value('individual_suffix', $contact); - } - elseif ($field == 'gender_id' && !empty($value)) { - $genderOptions = civicrm_api3('contact', 'getoptions', ['field' => 'gender_id']); - $label = $genderOptions['values'][$value]; + elseif (!empty($fieldSpec['pseudoconstant'])) { + $label = CRM_Core_PseudoConstant::getLabel('CRM_Contact_BAO_Contact', $field, $value); } elseif ($field == 'current_employer_id' && !empty($value)) { $label = "$value (" . CRM_Contact_BAO_Contact::displayName($value) . ")"; @@ -1818,7 +1817,6 @@ public static function createMergeActivities($mainId, $otherId) { * @param int $batchLimit * @param bool $isSelected * Limit to selected pairs. - * @param array|string $orderByClause * @param bool $includeConflicts * @param array $criteria * Additional criteria to narrow down the merge group. @@ -1831,18 +1829,21 @@ public static function createMergeActivities($mainId, $otherId) { * * @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, $orderByClause = '', $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0) { + public static function getDuplicatePairs($rule_group_id, $group_id, $reloadCacheIfEmpty, $batchLimit, $isSelected, $includeConflicts = TRUE, $criteria = [], $checkPermissions = TRUE, $searchLimit = 0) { $where = self::getWhereString($isSelected); $cacheKeyString = self::getMergeCacheKeyString($rule_group_id, $group_id, $criteria, $checkPermissions); $join = self::getJoinOnDedupeTable(); - $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, $batchLimit, [], $orderByClause, $includeConflicts); + $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, $batchLimit, [], '', $includeConflicts); 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, $cacheKeyString, $criteria, $checkPermissions, $searchLimit); - $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, $batchLimit, [], $orderByClause, $includeConflicts); + $dupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, $join, $where, 0, $batchLimit, [], '', $includeConflicts); return $dupePairs; } return $dupePairs; @@ -1882,38 +1883,6 @@ public static function getMergeCacheKeyString($rule_group_id, $group_id, $criter return $cacheKeyString; } - /** - * @param array $contact - * @return array - * $specialValues - */ - public static function getSpecialValues($contact) { - $preferred_communication_method = CRM_Utils_Array::value('preferred_communication_method', $contact); - $value = empty($preferred_communication_method) ? [] : $preferred_communication_method; - $specialValues = [ - 'preferred_communication_method' => $value, - 'communication_style_id' => $value, - ]; - - if (!empty($contact['preferred_communication_method'])) { - // api 3 returns pref_comm_method as an array, which breaks the lookup; so we reconstruct - $prefCommList = is_array($specialValues['preferred_communication_method']) ? implode(CRM_Core_DAO::VALUE_SEPARATOR, $specialValues['preferred_communication_method']) : $specialValues['preferred_communication_method']; - $specialValues['preferred_communication_method'] = CRM_Core_DAO::VALUE_SEPARATOR . $prefCommList . CRM_Core_DAO::VALUE_SEPARATOR; - } - $names = [ - 'preferred_communication_method' => [ - 'newName' => 'preferred_communication_method_display', - 'groupName' => 'preferred_communication_method', - ], - ]; - CRM_Core_OptionGroup::lookupValues($specialValues, $names); - - if (!empty($contact['communication_style'])) { - $specialValues['communication_style_id_display'] = $contact['communication_style']; - } - return $specialValues; - } - /** * Get the metadata for the merge fields. * @@ -2155,9 +2124,7 @@ protected static function dedupePair(&$migrationInfo, &$resultStats, &$deletedCo CRM_Core_BAO_PrevNextCache::markConflict($mainId, $otherId, $cacheKeyString, $conflicts); } else { - // delete entry from PrevNextCache table so we don't consider the pair next time - // pair may have been flipped, so make sure we delete using both orders - CRM_Core_BAO_PrevNextCache::deletePair($mainId, $otherId, $cacheKeyString, TRUE); + CRM_Core_BAO_PrevNextCache::deletePair($mainId, $otherId, $cacheKeyString); } } diff --git a/CRM/Event/BAO/Event.php b/CRM/Event/BAO/Event.php index 22034dd9f5d3..2729d0969389 100644 --- a/CRM/Event/BAO/Event.php +++ b/CRM/Event/BAO/Event.php @@ -330,6 +330,8 @@ public static function getEvents( * * @return array * Array of event summary values + * + * @throws \CiviCRM_API3_Exception */ public static function getEventSummary() { $eventSummary = $eventIds = []; @@ -338,7 +340,7 @@ public static function getEventSummary() { // get permission and include them here // does not scale, but rearranging code for now // FIXME in a future release - $permissions = CRM_Event_BAO_Event::checkPermission(); + $permissions = self::getAllPermissions(); $validEventIDs = ''; if (empty($permissions[CRM_Core_Permission::VIEW])) { $eventSummary['total_events'] = 0; diff --git a/CRM/Event/Cart/DAO/Cart.php b/CRM/Event/Cart/DAO/Cart.php index 893b1ba406dd..92684931dcd1 100644 --- a/CRM/Event/Cart/DAO/Cart.php +++ b/CRM/Event/Cart/DAO/Cart.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Event/Cart/Cart.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:480e2fc6225765f7ff4930376c1ed70f) + * (GenCodeChecksum:71454cbda07a2fefd75041815b95ed0c) */ /** @@ -31,19 +31,19 @@ class CRM_Event_Cart_DAO_Cart extends CRM_Core_DAO { /** * Cart Id * - * @var int unsigned + * @var int */ public $id; /** * FK to civicrm_contact who created this cart * - * @var int unsigned + * @var int */ public $user_id; /** - * @var boolean + * @var bool */ public $completed; diff --git a/CRM/Event/Cart/DAO/EventInCart.php b/CRM/Event/Cart/DAO/EventInCart.php index 41654c3d24f5..c0147b76dc74 100644 --- a/CRM/Event/Cart/DAO/EventInCart.php +++ b/CRM/Event/Cart/DAO/EventInCart.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Event/Cart/EventInCart.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:0f1e8db14667dfe6351ce2610d4431bd) + * (GenCodeChecksum:b9da5d3acb0b71b79cc3f8d2f7e5ec50) */ /** @@ -31,21 +31,21 @@ class CRM_Event_Cart_DAO_EventInCart extends CRM_Core_DAO { /** * Event In Cart Id * - * @var int unsigned + * @var int */ public $id; /** * FK to Event ID * - * @var int unsigned + * @var int */ public $event_id; /** * FK to Event Cart ID * - * @var int unsigned + * @var int */ public $event_cart_id; diff --git a/CRM/Event/DAO/Event.php b/CRM/Event/DAO/Event.php index f5f563ec1826..4688a7919f6d 100644 --- a/CRM/Event/DAO/Event.php +++ b/CRM/Event/DAO/Event.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Event/Event.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:950e07f412225a94ad11a8220a8f2f19) + * (GenCodeChecksum:02024f3f33a71a88e3206f5a48b3d14f) */ /** @@ -31,7 +31,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * Event * - * @var int unsigned + * @var int */ public $id; @@ -59,21 +59,21 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * Event Type ID.Implicit FK to civicrm_option_value where option_group = event_type. * - * @var int unsigned + * @var int */ public $event_type_id; /** * Should we expose the participant list? Implicit FK to civicrm_option_value where option_group = participant_listing. * - * @var int unsigned + * @var int */ public $participant_listing_id; /** * Public events will be included in the iCal feeds. Access to private event information may be limited using ACLs. * - * @var boolean + * @var bool */ public $is_public; @@ -94,7 +94,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * If true, include registration link on Event Info page. * - * @var boolean + * @var bool */ public $is_online_registration; @@ -122,7 +122,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * Maximum number of registered participants to allow. After max is reached, a custom Event Full message is displayed. If NULL, allow unlimited number of participants. * - * @var int unsigned + * @var int */ public $max_participants; @@ -136,14 +136,14 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * If true, one or more fee amounts must be set and a Payment Processor must be configured for Online Event Registration. * - * @var boolean + * @var bool */ public $is_monetary; /** * Financial type assigned to paid event registrations for this event. Required if is_monetary is true. * - * @var int unsigned + * @var int */ public $financial_type_id; @@ -157,14 +157,14 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * Include a map block on the Event Information page when geocode info is available and a mapping provider has been specified? * - * @var boolean + * @var bool */ public $is_map; /** * Is this Event enabled or disabled/cancelled? * - * @var boolean + * @var bool */ public $is_active; @@ -176,21 +176,21 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * If true, show event location. * - * @var boolean + * @var bool */ public $is_show_location; /** * FK to Location Block ID * - * @var int unsigned + * @var int */ public $loc_block_id; /** * Participant role ID. Implicit FK to civicrm_option_value where option_group = participant_role. * - * @var int unsigned + * @var int */ public $default_role_id; @@ -232,7 +232,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * If true, confirmation is automatically emailed to contact on successful registration. * - * @var boolean + * @var bool */ public $is_email_confirm; @@ -274,14 +274,14 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * FK to civicrm_option_value. * - * @var int unsigned + * @var int */ public $default_fee_id; /** * FK to civicrm_option_value. * - * @var int unsigned + * @var int */ public $default_discount_fee_id; @@ -309,7 +309,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * if true - allows the user to send payment directly to the org later * - * @var boolean + * @var bool */ public $is_pay_later; @@ -330,7 +330,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * is partial payment enabled for this event * - * @var boolean + * @var bool */ public $is_partial_payment; @@ -358,56 +358,56 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * if true - allows the user to register multiple participants for event * - * @var boolean + * @var bool */ public $is_multiple_registrations; /** * Maximum number of additional participants that can be registered on a single booking * - * @var int unsigned + * @var int */ public $max_additional_participants; /** * if true - allows the user to register multiple registrations from same email address. * - * @var boolean + * @var bool */ public $allow_same_participant_emails; /** * Whether the event has waitlist support. * - * @var boolean + * @var bool */ public $has_waitlist; /** * Whether participants require approval before they can finish registering. * - * @var boolean + * @var bool */ public $requires_approval; /** * Expire pending but unconfirmed registrations after this many hours. * - * @var int unsigned + * @var int */ public $expiration_time; /** * Allow self service cancellation or transfer for event? * - * @var boolean + * @var bool */ public $allow_selfcancelxfer; /** * Number of hours prior to event start date to allow self-service cancellation or transfer. * - * @var int unsigned + * @var int */ public $selfcancelxfer_time; @@ -428,7 +428,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * whether the event has template * - * @var boolean + * @var bool */ public $is_template; @@ -442,7 +442,7 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * FK to civicrm_contact, who created this event * - * @var int unsigned + * @var int */ public $created_id; @@ -463,49 +463,49 @@ class CRM_Event_DAO_Event extends CRM_Core_DAO { /** * The campaign for which this event has been created. * - * @var int unsigned + * @var int */ public $campaign_id; /** * Can people share the event through social media? * - * @var boolean + * @var bool */ public $is_share; /** * If false, the event booking confirmation screen gets skipped * - * @var boolean + * @var bool */ public $is_confirm_enabled; /** * Implicit FK to civicrm_event: parent event * - * @var int unsigned + * @var int */ public $parent_event_id; /** * Subevent slot label. Implicit FK to civicrm_option_value where option_group = conference_slot. * - * @var int unsigned + * @var int */ public $slot_label_id; /** * Rule to use when matching registrations for this event * - * @var int unsigned + * @var int */ public $dedupe_rule_group_id; /** * if true than billing block is required this event * - * @var boolean + * @var bool */ public $is_billing_required; @@ -623,7 +623,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'event_type', 'optionEditPath' => 'civicrm/admin/options/event_type', - ] + ], ], 'participant_listing_id' => [ 'name' => 'participant_listing_id', @@ -642,7 +642,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'participant_listing', 'optionEditPath' => 'civicrm/admin/options/participant_listing', - ] + ], ], 'is_public' => [ 'name' => 'is_public', @@ -820,7 +820,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'payment_processor' => [ 'name' => 'payment_processor', @@ -841,7 +841,7 @@ public static function &fields() { 'table' => 'civicrm_payment_processor', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'is_map' => [ 'name' => 'is_map', @@ -937,7 +937,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'participant_role', 'optionEditPath' => 'civicrm/admin/options/participant_role', - ] + ], ], 'intro_text' => [ 'name' => 'intro_text', @@ -1520,7 +1520,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'campaign_id' => [ 'name' => 'campaign_id', @@ -1540,7 +1540,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'is_share' => [ 'name' => 'is_share', @@ -1622,7 +1622,7 @@ public static function &fields() { 'keyColumn' => 'id', 'labelColumn' => 'title', 'nameColumn' => 'name', - ] + ], ], 'is_billing_required' => [ 'name' => 'is_billing_required', diff --git a/CRM/Event/DAO/Participant.php b/CRM/Event/DAO/Participant.php index fc7aaccb3840..946f2171e003 100644 --- a/CRM/Event/DAO/Participant.php +++ b/CRM/Event/DAO/Participant.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Event/Participant.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:07eafc5db4afa9fe7ca200110727d42f) + * (GenCodeChecksum:fd601efb92a34d5c30814c5ea34b323f) */ /** @@ -31,28 +31,28 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO { /** * Participant Id * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * FK to Event ID * - * @var int unsigned + * @var int */ public $event_id; /** * Participant status ID. FK to civicrm_participant_status_type. Default of 1 should map to status = Registered. * - * @var int unsigned + * @var int */ public $status_id; @@ -86,12 +86,12 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO { public $fee_level; /** - * @var boolean + * @var bool */ public $is_test; /** - * @var boolean + * @var bool */ public $is_pay_later; @@ -105,14 +105,14 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO { /** * FK to Participant ID * - * @var int unsigned + * @var int */ public $registered_by_id; /** * FK to Discount ID * - * @var int unsigned + * @var int */ public $discount_id; @@ -126,21 +126,21 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO { /** * The campaign for which this participant has been registered. * - * @var int unsigned + * @var int */ public $campaign_id; /** * Discount Amount * - * @var int unsigned + * @var int */ public $discount_amount; /** * FK to civicrm_event_carts * - * @var int unsigned + * @var int */ public $cart_id; @@ -154,7 +154,7 @@ class CRM_Event_DAO_Participant extends CRM_Core_DAO { /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $transferred_to_contact_id; @@ -266,7 +266,7 @@ public static function &fields() { 'table' => 'civicrm_participant_status_type', 'keyColumn' => 'id', 'labelColumn' => 'label', - ] + ], ], 'participant_role_id' => [ 'name' => 'role_id', @@ -291,7 +291,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'participant_role', 'optionEditPath' => 'civicrm/admin/options/participant_role', - ] + ], ], 'participant_register_date' => [ 'name' => 'register_date', @@ -446,7 +446,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'participant_campaign_id' => [ 'name' => 'campaign_id', @@ -465,7 +465,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'discount_amount' => [ 'name' => 'discount_amount', diff --git a/CRM/Event/DAO/ParticipantPayment.php b/CRM/Event/DAO/ParticipantPayment.php index 39843364b0cb..d9b126bb5cd3 100644 --- a/CRM/Event/DAO/ParticipantPayment.php +++ b/CRM/Event/DAO/ParticipantPayment.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Event/ParticipantPayment.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:33976e80c23c2f9eeaa844c812004b42) + * (GenCodeChecksum:26f5438e86ca3500888b49650bc6d9e8) */ /** @@ -31,21 +31,21 @@ class CRM_Event_DAO_ParticipantPayment extends CRM_Core_DAO { /** * Participant Payment Id * - * @var int unsigned + * @var int */ public $id; /** * Participant Id (FK) * - * @var int unsigned + * @var int */ public $participant_id; /** * FK to contribution table. * - * @var int unsigned + * @var int */ public $contribution_id; diff --git a/CRM/Event/DAO/ParticipantStatusType.php b/CRM/Event/DAO/ParticipantStatusType.php index e04f88ced3fb..7a09e16739e1 100644 --- a/CRM/Event/DAO/ParticipantStatusType.php +++ b/CRM/Event/DAO/ParticipantStatusType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Event/ParticipantStatusType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:8279655ecdaf4a9ca6a0a3a76e945644) + * (GenCodeChecksum:a42abc9dbf891aa6cbb6513ca18067b9) */ /** @@ -31,7 +31,7 @@ class CRM_Event_DAO_ParticipantStatusType extends CRM_Core_DAO { /** * unique participant status type id * - * @var int unsigned + * @var int */ public $id; @@ -59,35 +59,35 @@ class CRM_Event_DAO_ParticipantStatusType extends CRM_Core_DAO { /** * whether this is a status type required by the system * - * @var boolean + * @var bool */ public $is_reserved; /** * whether this status type is active * - * @var boolean + * @var bool */ public $is_active; /** * whether this status type is counted against event size limit * - * @var boolean + * @var bool */ public $is_counted; /** * controls sort order * - * @var int unsigned + * @var int */ public $weight; /** * whether the status type is visible to the public, an implicit foreign key to option_value.value related to the `visibility` option_group * - * @var int unsigned + * @var int */ public $visibility_id; @@ -164,7 +164,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Event_PseudoConstant::participantStatusClassOptions', - ] + ], ], 'is_reserved' => [ 'name' => 'is_reserved', @@ -228,7 +228,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'visibility', 'optionEditPath' => 'civicrm/admin/options/visibility', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Event/Form/ManageEvent.php b/CRM/Event/Form/ManageEvent.php index cd013d81cc3a..d432deadf431 100644 --- a/CRM/Event/Form/ManageEvent.php +++ b/CRM/Event/Form/ManageEvent.php @@ -45,14 +45,14 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form { /** * Is this the first page? * - * @var boolean + * @var bool */ protected $_first = FALSE; /** * Are we in single form mode or wizard mode? * - * @var boolean + * @var bool */ protected $_single; @@ -60,7 +60,7 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form { /** * Are we actually managing an event template? - * @var boolean + * @var bool */ protected $_isTemplate = FALSE; diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index 3a02919e228b..ddc1c2da065f 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -374,7 +374,7 @@ public function buildQuickForm() { $this->addElement('submit', $this->getButtonName('submit'), ts('Add Discount Set to Fee Table'), ['class' => 'crm-form-submit cancel'] ); - if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) { + if (Civi::settings()->get('deferred_revenue_enabled')) { $deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType(); $this->assign('deferredFinancialType', array_keys($deferredFinancialType)); } diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 0b0b31e0dcf2..d0426e4caa24 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -52,7 +52,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment /** * The values for the quickconfig for priceset. * - * @var boolean + * @var bool */ public $_quickConfig = NULL; @@ -106,7 +106,7 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment * Are we operating in "single mode", i.e. adding / editing only * one participant record, or is this a batch add operation * - * @var boolean + * @var bool */ public $_single = FALSE; @@ -1002,7 +1002,7 @@ public function submit($params) { $contributionParams = ['skipCleanMoney' => TRUE]; $lineItem = []; $additionalParticipantDetails = []; - if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) { + if (Civi::settings()->get('deferred_revenue_enabled')) { $eventStartDate = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'start_date'); if (strtotime($eventStartDate) > strtotime(date('Ymt'))) { $contributionParams['revenue_recognition_date'] = date('Ymd', strtotime($eventStartDate)); diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 2e60b956e41a..af19e4423678 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -67,21 +67,21 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { /** * Is participant able to walk registration wizard. * - * @var Boolean + * @var bool */ public $_allowConfirmation; /** * Is participant requires approval. * - * @var Boolean + * @var bool */ public $_requireApproval; /** * Is event configured for waitlist. * - * @var Boolean + * @var bool */ public $_allowWaitlist; @@ -157,7 +157,7 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { /** * Is event already full. * - * @var boolean + * @var bool * */ diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index bc800a62a5d4..8bebdb1e6ab4 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -1052,7 +1052,7 @@ public static function processContribution( ); } - if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) { + if (Civi::settings()->get('deferred_revenue_enabled')) { $eventStartDate = CRM_Utils_Array::value( 'start_date', CRM_Utils_Array::value( diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index fd5a218f3e8e..2684b39fd805 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -69,7 +69,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { /** * Show fee block or not. * - * @var boolean determines if fee block should be shown or hidden + * @var bool determines if fee block should be shown or hidden */ public $_noFees; diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index 4a61657ee308..15451b2d20a0 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -50,14 +50,14 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Event/Form/SelfSvcUpdate.php b/CRM/Event/Form/SelfSvcUpdate.php index de7e8090fc23..f8aafbddb54f 100644 --- a/CRM/Event/Form/SelfSvcUpdate.php +++ b/CRM/Event/Form/SelfSvcUpdate.php @@ -283,7 +283,6 @@ public function postProcess() { * return @void */ public function transferParticipant($params) { - $isBackOfficeArg = $this->isBackoffice ? '&is_backoffice=1' : ''; CRM_Utils_System::redirect(CRM_Utils_System::url( 'civicrm/event/selfsvctransfer', [ @@ -291,6 +290,7 @@ public function transferParticipant($params) { 'action' => 'add', 'pid' => $this->_participant_id, 'cs' => $this->_userChecksum, + 'is_backoffice' => $this->isBackoffice, ] )); } diff --git a/CRM/Event/Form/Task/Badge.php b/CRM/Event/Form/Task/Badge.php index 3f7d87586d5e..6d21b4d8f624 100644 --- a/CRM/Event/Form/Task/Badge.php +++ b/CRM/Event/Form/Task/Badge.php @@ -40,7 +40,7 @@ class CRM_Event_Form_Task_Badge extends CRM_Event_Form_Task { * Are we operating in "single mode", i.e. sending email to one * specific contact? * - * @var boolean + * @var bool */ public $_single = FALSE; diff --git a/CRM/Event/Form/Task/Delete.php b/CRM/Event/Form/Task/Delete.php index ad9acdbddb70..a784355f5fdb 100644 --- a/CRM/Event/Form/Task/Delete.php +++ b/CRM/Event/Form/Task/Delete.php @@ -44,7 +44,7 @@ class CRM_Event_Form_Task_Delete extends CRM_Event_Form_Task { * Are we operating in "single mode", i.e. deleting one * specific participation? * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Event/Form/Task/Email.php b/CRM/Event/Form/Task/Email.php index a9f5ccb6c62e..406a3a74ba05 100644 --- a/CRM/Event/Form/Task/Email.php +++ b/CRM/Event/Form/Task/Email.php @@ -42,7 +42,7 @@ class CRM_Event_Form_Task_Email extends CRM_Event_Form_Task { * Are we operating in "single mode", i.e. sending email to one * specific contact? * - * @var boolean + * @var bool */ public $_single = FALSE; @@ -50,7 +50,7 @@ class CRM_Event_Form_Task_Email extends CRM_Event_Form_Task { * Are we operating in "single mode", i.e. sending email to one * specific contact? * - * @var boolean + * @var bool */ public $_noEmails = FALSE; diff --git a/CRM/Event/Form/Task/PDF.php b/CRM/Event/Form/Task/PDF.php index a16837041e80..2aa2028eaf64 100644 --- a/CRM/Event/Form/Task/PDF.php +++ b/CRM/Event/Form/Task/PDF.php @@ -43,7 +43,7 @@ class CRM_Event_Form_Task_PDF extends CRM_Event_Form_Task { * Are we operating in "single mode", i.e. printing letter to one * specific participant? * - * @var boolean + * @var bool */ public $_single = FALSE; diff --git a/CRM/Event/Import/Parser.php b/CRM/Event/Import/Parser.php index ba14c1bc2d7f..5276b02c1a8f 100644 --- a/CRM/Event/Import/Parser.php +++ b/CRM/Event/Import/Parser.php @@ -62,7 +62,7 @@ abstract class CRM_Event_Import_Parser extends CRM_Import_Parser { /** * Whether the file has a column header or not * - * @var boolean + * @var bool */ protected $_haveColumnHeader; diff --git a/CRM/Event/Page/ManageEvent.php b/CRM/Event/Page/ManageEvent.php index 1a316ef657d6..c2b0a3a55025 100644 --- a/CRM/Event/Page/ManageEvent.php +++ b/CRM/Event/Page/ManageEvent.php @@ -520,7 +520,8 @@ public function whereClause(&$params, $sortBy = TRUE, $force) { if (is_array($value)) { $type = implode(',', $value); } - $clauses[] = "event_type_id IN ({$type})"; + $clauses[] = "event_type_id IN (%2)"; + $params[2] = [$type, 'String']; } $eventsByDates = $this->get('eventsByDates'); diff --git a/CRM/Event/Selector/Search.php b/CRM/Event/Selector/Search.php index fb79e008db8e..b484e7dd06c4 100644 --- a/CRM/Event/Selector/Search.php +++ b/CRM/Event/Selector/Search.php @@ -85,14 +85,14 @@ class CRM_Event_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Financial/BAO/ExportFormat.php b/CRM/Financial/BAO/ExportFormat.php index 1f465383698b..b352f9bb84e0 100644 --- a/CRM/Financial/BAO/ExportFormat.php +++ b/CRM/Financial/BAO/ExportFormat.php @@ -52,7 +52,7 @@ abstract class CRM_Financial_BAO_ExportFormat { /** * Download Exported file. - * @var boolean + * @var bool */ public $_isDownloadFile; diff --git a/CRM/Financial/BAO/FinancialAccount.php b/CRM/Financial/BAO/FinancialAccount.php index 02ff4d9de89d..c8f33573705b 100644 --- a/CRM/Financial/BAO/FinancialAccount.php +++ b/CRM/Financial/BAO/FinancialAccount.php @@ -379,7 +379,7 @@ public static function validateFinancialAccount($financialAccountId, $financialA * */ public static function checkFinancialTypeHasDeferred($params, $contributionID = NULL, $priceSetFields = NULL) { - if (!CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) { + if (!Civi::settings()->get('deferred_revenue_enabled')) { return FALSE; } $recognitionDate = CRM_Utils_Array::value('revenue_recognition_date', $params); diff --git a/CRM/Financial/BAO/Payment.php b/CRM/Financial/BAO/Payment.php index e743d2d79685..664c193e0cc4 100644 --- a/CRM/Financial/BAO/Payment.php +++ b/CRM/Financial/BAO/Payment.php @@ -51,6 +51,7 @@ class CRM_Financial_BAO_Payment { * * @throws \API_Exception * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public static function create($params) { $contribution = civicrm_api3('Contribution', 'getsingle', ['id' => $params['contribution_id']]); @@ -104,11 +105,24 @@ public static function create($params) { } if ($isPaymentCompletesContribution) { - civicrm_api3('Contribution', 'completetransaction', ['id' => $contribution['id']]); - // Get the trxn - $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution['id'], 'DESC'); - $ftParams = ['id' => $trxnId['financialTrxnId']]; - $trxn = CRM_Core_BAO_FinancialTrxn::retrieve($ftParams, CRM_Core_DAO::$_nullArray); + if ($contributionStatus == 'Pending refund') { + // Ideally we could still call completetransaction as non-payment related actions should + // be outside this class. However, for now we just update the contribution here. + // Unit test cover in CRM_Event_BAO_AdditionalPaymentTest::testTransactionInfo. + civicrm_api3('Contribution', 'create', + [ + 'id' => $contribution['id'], + 'contribution_status_id' => 'Completed', + ] + ); + } + else { + civicrm_api3('Contribution', 'completetransaction', ['id' => $contribution['id']]); + // Get the trxn + $trxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution['id'], 'DESC'); + $ftParams = ['id' => $trxnId['financialTrxnId']]; + $trxn = CRM_Core_BAO_FinancialTrxn::retrieve($ftParams, CRM_Core_DAO::$_nullArray); + } } elseif ($contributionStatus === 'Pending') { civicrm_api3('Contribution', 'create', diff --git a/CRM/Financial/DAO/Currency.php b/CRM/Financial/DAO/Currency.php index f20e3c203742..4192856b8681 100644 --- a/CRM/Financial/DAO/Currency.php +++ b/CRM/Financial/DAO/Currency.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/Currency.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:19729d25ea5ad98f3fc2551acab9fa7a) + * (GenCodeChecksum:5490d115dbd495ebb39ce46a4149cbc2) */ /** @@ -31,7 +31,7 @@ class CRM_Financial_DAO_Currency extends CRM_Core_DAO { /** * Currency Id * - * @var int unsigned + * @var int */ public $id; diff --git a/CRM/Financial/DAO/EntityFinancialAccount.php b/CRM/Financial/DAO/EntityFinancialAccount.php index 529a8d68a48d..13b31ce00c27 100644 --- a/CRM/Financial/DAO/EntityFinancialAccount.php +++ b/CRM/Financial/DAO/EntityFinancialAccount.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:f0a99b56fe094d649cc56eb930b4ae23) + * (GenCodeChecksum:3e195b6b8f9a99b338219723c2b509a7) */ /** @@ -31,7 +31,7 @@ class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO { /** * ID * - * @var int unsigned + * @var int */ public $id; @@ -45,21 +45,21 @@ class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO { /** * Links to an id in the entity_table, such as vid in civicrm_financial_type * - * @var int unsigned + * @var int */ public $entity_id; /** * FK to a new civicrm_option_value (account_relationship) * - * @var int unsigned + * @var int */ public $account_relationship; /** * FK to the financial_account_id * - * @var int unsigned + * @var int */ public $financial_account_id; @@ -152,7 +152,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'account_relationship', 'optionEditPath' => 'civicrm/admin/options/account_relationship', - ] + ], ], 'financial_account_id' => [ 'name' => 'financial_account_id', @@ -173,7 +173,7 @@ public static function &fields() { 'table' => 'civicrm_financial_account', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Financial/DAO/EntityFinancialTrxn.php b/CRM/Financial/DAO/EntityFinancialTrxn.php index ba7d38c47116..2b014faa6f80 100644 --- a/CRM/Financial/DAO/EntityFinancialTrxn.php +++ b/CRM/Financial/DAO/EntityFinancialTrxn.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:b7687297d632a4658b6686a5b540f974) + * (GenCodeChecksum:c2c6d4183954c62f7119e9cf1eaa451b) */ /** @@ -31,7 +31,7 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO { /** * ID * - * @var int unsigned + * @var int */ public $id; @@ -43,12 +43,12 @@ class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO { public $entity_table; /** - * @var int unsigned + * @var int */ public $entity_id; /** - * @var int unsigned + * @var int */ public $financial_trxn_id; diff --git a/CRM/Financial/DAO/FinancialAccount.php b/CRM/Financial/DAO/FinancialAccount.php index 99c784aa70e6..8251e66e2fa3 100644 --- a/CRM/Financial/DAO/FinancialAccount.php +++ b/CRM/Financial/DAO/FinancialAccount.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/FinancialAccount.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:99e6943d33c4b4081a8d74e611589dd7) + * (GenCodeChecksum:eb74c4e8ee5b44cb65080b2b15f7e9c2) */ /** @@ -31,7 +31,7 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO { /** * ID * - * @var int unsigned + * @var int */ public $id; @@ -45,14 +45,14 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO { /** * FK to Contact ID that is responsible for the funds in this account * - * @var int unsigned + * @var int */ public $contact_id; /** * pseudo FK into civicrm_option_value. * - * @var int unsigned + * @var int */ public $financial_account_type_id; @@ -80,28 +80,28 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO { /** * Parent ID in account hierarchy * - * @var int unsigned + * @var int */ public $parent_id; /** * Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts? * - * @var boolean + * @var bool */ public $is_header_account; /** * Is this account tax-deductible? * - * @var boolean + * @var bool */ public $is_deductible; /** * Is this account for taxes? * - * @var boolean + * @var bool */ public $is_tax; @@ -115,21 +115,21 @@ class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO { /** * Is this a predefined system object? * - * @var boolean + * @var bool */ public $is_reserved; /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this account the default one (or default tax one) for its financial_account_type? * - * @var boolean + * @var bool */ public $is_default; @@ -221,7 +221,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'financial_account_type', 'optionEditPath' => 'civicrm/admin/options/financial_account_type', - ] + ], ], 'accounting_code' => [ 'name' => 'accounting_code', diff --git a/CRM/Financial/DAO/FinancialItem.php b/CRM/Financial/DAO/FinancialItem.php index dcbc5b4d4f31..980651845d9a 100644 --- a/CRM/Financial/DAO/FinancialItem.php +++ b/CRM/Financial/DAO/FinancialItem.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/FinancialItem.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:8ebea76ed5ae2b3e7fe0ddafa55a4aed) + * (GenCodeChecksum:48ab3768197dff98c1af1e337059f085) */ /** @@ -29,7 +29,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; @@ -50,7 +50,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO { /** * FK to Contact ID of contact the item is from * - * @var int unsigned + * @var int */ public $contact_id; @@ -78,14 +78,14 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO { /** * FK to civicrm_financial_account * - * @var int unsigned + * @var int */ public $financial_account_id; /** * Payment status: test, paid, part_paid, unpaid (if empty assume unpaid) * - * @var int unsigned + * @var int */ public $status_id; @@ -99,7 +99,7 @@ class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO { /** * The specific source item that is responsible for the creation of this financial_item * - * @var int unsigned + * @var int */ public $entity_id; @@ -239,7 +239,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'financial_account_id' => [ 'name' => 'financial_account_id', @@ -259,7 +259,7 @@ public static function &fields() { 'table' => 'civicrm_financial_account', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'status_id' => [ 'name' => 'status_id', @@ -278,7 +278,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'financial_item_status', 'optionEditPath' => 'civicrm/admin/options/financial_item_status', - ] + ], ], 'entity_table' => [ 'name' => 'entity_table', diff --git a/CRM/Financial/DAO/FinancialTrxn.php b/CRM/Financial/DAO/FinancialTrxn.php index 1d262b411dcb..f18ca991b15d 100644 --- a/CRM/Financial/DAO/FinancialTrxn.php +++ b/CRM/Financial/DAO/FinancialTrxn.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/FinancialTrxn.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:d30cfdb7f54eac46852246cf30654a97) + * (GenCodeChecksum:11ae7954d4576a19382e63fffd31cdac) */ /** @@ -29,21 +29,21 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to financial_account table. * - * @var int unsigned + * @var int */ public $from_financial_account_id; /** * FK to financial_financial_account table. * - * @var int unsigned + * @var int */ public $to_financial_account_id; @@ -85,7 +85,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO { /** * Is this entry either a payment or a reversal of a payment? * - * @var boolean + * @var bool */ public $is_payment; @@ -106,28 +106,28 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO { /** * pseudo FK to civicrm_option_value of contribution_status_id option_group * - * @var int unsigned + * @var int */ public $status_id; /** * Payment Processor for this financial transaction * - * @var int unsigned + * @var int */ public $payment_processor_id; /** * FK to payment_instrument option group values * - * @var int unsigned + * @var int */ public $payment_instrument_id; /** * FK to accept_creditcard option group values * - * @var int unsigned + * @var int */ public $card_type_id; @@ -207,7 +207,7 @@ public static function &fields() { 'table' => 'civicrm_financial_account', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'to_financial_account_id' => [ 'name' => 'to_financial_account_id', @@ -227,7 +227,7 @@ public static function &fields() { 'table' => 'civicrm_financial_account', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'trxn_date' => [ 'name' => 'trxn_date', @@ -316,7 +316,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'is_payment' => [ 'name' => 'is_payment', @@ -377,7 +377,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'contribution_status', 'optionEditPath' => 'civicrm/admin/options/contribution_status', - ] + ], ], 'payment_processor_id' => [ 'name' => 'payment_processor_id', @@ -407,7 +407,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ] + ], ], 'financial_trxn_card_type_id' => [ 'name' => 'card_type_id', @@ -425,7 +425,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'accept_creditcard', 'optionEditPath' => 'civicrm/admin/options/accept_creditcard', - ] + ], ], 'financial_trxn_check_number' => [ 'name' => 'check_number', diff --git a/CRM/Financial/DAO/FinancialType.php b/CRM/Financial/DAO/FinancialType.php index 90a916f0750d..636069efbefb 100644 --- a/CRM/Financial/DAO/FinancialType.php +++ b/CRM/Financial/DAO/FinancialType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/FinancialType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:760550280aaa0da48232ebdfb11170f9) + * (GenCodeChecksum:9395c8fe3d749ad60136065301a5c44f) */ /** @@ -31,7 +31,7 @@ class CRM_Financial_DAO_FinancialType extends CRM_Core_DAO { /** * ID of original financial_type so you can search this table by the financial_type.id and then select the relevant version based on the timestamp * - * @var int unsigned + * @var int */ public $id; @@ -52,21 +52,21 @@ class CRM_Financial_DAO_FinancialType extends CRM_Core_DAO { /** * Is this financial type tax-deductible? If true, contributions of this type may be fully OR partially deductible - non-deductible amount is stored in the Contribution record. * - * @var boolean + * @var bool */ public $is_deductible; /** * Is this a predefined system object? * - * @var boolean + * @var bool */ public $is_reserved; /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; diff --git a/CRM/Financial/DAO/PaymentProcessor.php b/CRM/Financial/DAO/PaymentProcessor.php index f3aed4735247..4a09521775af 100644 --- a/CRM/Financial/DAO/PaymentProcessor.php +++ b/CRM/Financial/DAO/PaymentProcessor.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/PaymentProcessor.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:83f0467b531d70e84945e9c55a8824b6) + * (GenCodeChecksum:2d3189beedf083b35929eded03907d9f) */ /** @@ -31,14 +31,14 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { /** * Payment Processor ID * - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this match entry for * - * @var int unsigned + * @var int */ public $domain_id; @@ -64,28 +64,28 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { public $description; /** - * @var int unsigned + * @var int */ public $payment_processor_type_id; /** * Is this processor active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this processor the default? * - * @var boolean + * @var bool */ public $is_default; /** * Is this processor for a test site? * - * @var boolean + * @var bool */ public $is_test; @@ -137,28 +137,28 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { /** * Billing Mode (deprecated) * - * @var int unsigned + * @var int */ public $billing_mode; /** * Can process recurring contributions * - * @var boolean + * @var bool */ public $is_recur; /** * Payment Type: Credit or Debit (deprecated) * - * @var int unsigned + * @var int */ public $payment_type; /** * Payment Instrument ID * - * @var int unsigned + * @var int */ public $payment_instrument_id; @@ -229,7 +229,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'name' => [ 'name' => 'name', @@ -290,7 +290,7 @@ public static function &fields() { 'table' => 'civicrm_payment_processor_type', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'is_active' => [ 'name' => 'is_active', @@ -506,7 +506,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ] + ], ], 'accepted_credit_cards' => [ 'name' => 'accepted_credit_cards', diff --git a/CRM/Financial/DAO/PaymentProcessorType.php b/CRM/Financial/DAO/PaymentProcessorType.php index 5bad18359df9..3c3a7bb22732 100644 --- a/CRM/Financial/DAO/PaymentProcessorType.php +++ b/CRM/Financial/DAO/PaymentProcessorType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/PaymentProcessorType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:b8290611e8abcbd771b1006fd34e3ec5) + * (GenCodeChecksum:f412f0beac8a6387450f8fe19279d0ce) */ /** @@ -31,7 +31,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { /** * Payment Processor Type ID * - * @var int unsigned + * @var int */ public $id; @@ -59,14 +59,14 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { /** * Is this processor active? * - * @var boolean + * @var bool */ public $is_active; /** * Is this processor the default? * - * @var boolean + * @var bool */ public $is_default; @@ -138,28 +138,28 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { /** * Billing Mode (deprecated) * - * @var int unsigned + * @var int */ public $billing_mode; /** * Can process recurring contributions * - * @var boolean + * @var bool */ public $is_recur; /** * Payment Type: Credit or Debit (deprecated) * - * @var int unsigned + * @var int */ public $payment_type; /** * Payment Instrument ID * - * @var int unsigned + * @var int */ public $payment_instrument_id; @@ -424,7 +424,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::billingMode', - ] + ], ], 'is_recur' => [ 'name' => 'is_recur', @@ -463,7 +463,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'payment_instrument', 'optionEditPath' => 'civicrm/admin/options/payment_instrument', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Financial/DAO/PaymentToken.php b/CRM/Financial/DAO/PaymentToken.php index 88206dd264f7..17aa223d2c31 100644 --- a/CRM/Financial/DAO/PaymentToken.php +++ b/CRM/Financial/DAO/PaymentToken.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/PaymentToken.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:13e09ccc4d4ae2dade53c251d4345ed2) + * (GenCodeChecksum:9ef72f3d1fba1b5b89841d36382c3eb6) */ /** @@ -31,19 +31,19 @@ class CRM_Financial_DAO_PaymentToken extends CRM_Core_DAO { /** * Payment Token ID * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID for the owner of the token * - * @var int unsigned + * @var int */ public $contact_id; /** - * @var int unsigned + * @var int */ public $payment_processor_id; @@ -64,7 +64,7 @@ class CRM_Financial_DAO_PaymentToken extends CRM_Core_DAO { /** * Contact ID of token creator * - * @var int unsigned + * @var int */ public $created_id; diff --git a/CRM/Financial/Form/FinancialAccount.php b/CRM/Financial/Form/FinancialAccount.php index 6b38724a81c4..f304e7fcfa8d 100644 --- a/CRM/Financial/Form/FinancialAccount.php +++ b/CRM/Financial/Form/FinancialAccount.php @@ -39,7 +39,7 @@ class CRM_Financial_Form_FinancialAccount extends CRM_Contribute_Form { /** * Flag if its a AR account type. * - * @var boolean + * @var bool */ protected $_isARFlag = FALSE; diff --git a/CRM/Financial/Form/FinancialTypeAccount.php b/CRM/Financial/Form/FinancialTypeAccount.php index e0940a738af1..3ac1bd169660 100644 --- a/CRM/Financial/Form/FinancialTypeAccount.php +++ b/CRM/Financial/Form/FinancialTypeAccount.php @@ -60,7 +60,7 @@ class CRM_Financial_Form_FinancialTypeAccount extends CRM_Contribute_Form { /** * Flag if its a AR account type. * - * @var boolean + * @var bool */ protected $_isARFlag = FALSE; diff --git a/CRM/Friend/DAO/Friend.php b/CRM/Friend/DAO/Friend.php index 2d568215f02d..d072051971aa 100644 --- a/CRM/Friend/DAO/Friend.php +++ b/CRM/Friend/DAO/Friend.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Friend/Friend.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a0a82714195ed8bafcbb12ef6c829521) + * (GenCodeChecksum:a662628e986758095dcbfa2e56597acb) */ /** @@ -31,7 +31,7 @@ class CRM_Friend_DAO_Friend extends CRM_Core_DAO { /** * Friend ID * - * @var int unsigned + * @var int */ public $id; @@ -45,7 +45,7 @@ class CRM_Friend_DAO_Friend extends CRM_Core_DAO { /** * Foreign key to the referenced item. * - * @var int unsigned + * @var int */ public $entity_id; @@ -90,7 +90,7 @@ class CRM_Friend_DAO_Friend extends CRM_Core_DAO { public $thankyou_text; /** - * @var boolean + * @var bool */ public $is_active; diff --git a/CRM/Grant/DAO/Grant.php b/CRM/Grant/DAO/Grant.php index ce4dfe0d4c8e..6ced3f894522 100644 --- a/CRM/Grant/DAO/Grant.php +++ b/CRM/Grant/DAO/Grant.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Grant/Grant.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ea60d8cd875ca924d3cc34b4282c8a8a) + * (GenCodeChecksum:fd288094da473bd77ff23051ae826a72) */ /** @@ -31,14 +31,14 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO { /** * Unique Grant id * - * @var int unsigned + * @var int */ public $id; /** * Contact ID of contact record given grant belongs to. * - * @var int unsigned + * @var int */ public $contact_id; @@ -73,14 +73,14 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO { /** * Yes/No field stating whether grant report was received by donor. * - * @var boolean + * @var bool */ public $grant_report_received; /** * Type of grant. Implicit FK to civicrm_option_value in grant_type option_group. * - * @var int unsigned + * @var int */ public $grant_type_id; @@ -122,14 +122,14 @@ class CRM_Grant_DAO_Grant extends CRM_Core_DAO { /** * Id of Grant status. * - * @var int unsigned + * @var int */ public $status_id; /** * FK to Financial Type. * - * @var int unsigned + * @var int */ public $financial_type_id; @@ -298,7 +298,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'grant_type', 'optionEditPath' => 'civicrm/admin/options/grant_type', - ] + ], ], 'amount_total' => [ 'name' => 'amount_total', @@ -383,7 +383,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'rationale' => [ 'name' => 'rationale', @@ -422,7 +422,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'grant_status', 'optionEditPath' => 'civicrm/admin/options/grant_status', - ] + ], ], 'financial_type_id' => [ 'name' => 'financial_type_id', @@ -440,7 +440,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Grant/Form/Search.php b/CRM/Grant/Form/Search.php index 9cb7c8e397cc..588fcceda823 100644 --- a/CRM/Grant/Form/Search.php +++ b/CRM/Grant/Form/Search.php @@ -46,7 +46,7 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Grant/Form/Task/Delete.php b/CRM/Grant/Form/Task/Delete.php index 925da7565f62..59e8d822f7af 100644 --- a/CRM/Grant/Form/Task/Delete.php +++ b/CRM/Grant/Form/Task/Delete.php @@ -44,7 +44,7 @@ class CRM_Grant_Form_Task_Delete extends CRM_Grant_Form_Task { * Are we operating in "single mode", i.e. deleting one * specific participation? * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Grant/Selector/Search.php b/CRM/Grant/Selector/Search.php index 19ff51cd4fa6..1eebd8d32b6f 100644 --- a/CRM/Grant/Selector/Search.php +++ b/CRM/Grant/Selector/Search.php @@ -79,14 +79,14 @@ class CRM_Grant_Selector_Search extends CRM_Core_Selector_Base implements CRM_Co /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Mailing/BAO/MailingJob.php b/CRM/Mailing/BAO/MailingJob.php index 8f3dff95e2d4..1374f0d1cdb0 100644 --- a/CRM/Mailing/BAO/MailingJob.php +++ b/CRM/Mailing/BAO/MailingJob.php @@ -509,7 +509,7 @@ public function deliver(&$mailer, $testParams = NULL) { $config = CRM_Core_Config::singleton(); } - if (property_exists($mailing, 'language') && $mailing->language && $mailing->language != 'en_US') { + if (property_exists($mailing, 'language') && $mailing->language && $mailing->language != CRM_Core_I18n::getLocale()) { $swapLang = CRM_Utils_AutoClean::swap('global://dbLocale?getter', 'call://i18n/setLocale', $mailing->language); } diff --git a/CRM/Mailing/DAO/BouncePattern.php b/CRM/Mailing/DAO/BouncePattern.php index efdaf7d04e58..e54fa43aa304 100644 --- a/CRM/Mailing/DAO/BouncePattern.php +++ b/CRM/Mailing/DAO/BouncePattern.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/BouncePattern.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:4c704cc977e01082612050ebc367ce1a) + * (GenCodeChecksum:767f24673857e91d2b76de45fce55649) */ /** @@ -29,14 +29,14 @@ class CRM_Mailing_DAO_BouncePattern extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * Type of bounce * - * @var int unsigned + * @var int */ public $bounce_type_id; diff --git a/CRM/Mailing/DAO/BounceType.php b/CRM/Mailing/DAO/BounceType.php index 6819e18c518a..db710ffeb948 100644 --- a/CRM/Mailing/DAO/BounceType.php +++ b/CRM/Mailing/DAO/BounceType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/BounceType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:317021d6e37d4d4d6fd91e15aaef8f93) + * (GenCodeChecksum:32b467be869aa9e4539fe7f0824f96b3) */ /** @@ -29,7 +29,7 @@ class CRM_Mailing_DAO_BounceType extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; @@ -50,7 +50,7 @@ class CRM_Mailing_DAO_BounceType extends CRM_Core_DAO { /** * Number of bounces of this type required before the email address is put on bounce hold * - * @var int unsigned + * @var int */ public $hold_threshold; diff --git a/CRM/Mailing/DAO/Mailing.php b/CRM/Mailing/DAO/Mailing.php index 4296e1ea7d77..d6aef45f9eb8 100644 --- a/CRM/Mailing/DAO/Mailing.php +++ b/CRM/Mailing/DAO/Mailing.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Mailing.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:5a53b90adc8124a3af37701d7a50b822) + * (GenCodeChecksum:c6f26fcb49da86f49a4a1ac885070ed6) */ /** @@ -29,54 +29,54 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * Which site is this mailing for * - * @var int unsigned + * @var int */ public $domain_id; /** * FK to the header component. * - * @var int unsigned + * @var int */ public $header_id; /** * FK to the footer component. * - * @var int unsigned + * @var int */ public $footer_id; /** * FK to the auto-responder component. * - * @var int unsigned + * @var int */ public $reply_id; /** * FK to the unsubscribe component. * - * @var int unsigned + * @var int */ public $unsubscribe_id; /** - * @var int unsigned + * @var int */ public $resubscribe_id; /** * FK to the opt-out component. * - * @var int unsigned + * @var int */ public $optout_id; @@ -153,56 +153,56 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Should we track URL click-throughs for this mailing? * - * @var boolean + * @var bool */ public $url_tracking; /** * Should we forward replies back to the author? * - * @var boolean + * @var bool */ public $forward_replies; /** * Should we enable the auto-responder? * - * @var boolean + * @var bool */ public $auto_responder; /** * Should we track when recipients open/read this mailing? * - * @var boolean + * @var bool */ public $open_tracking; /** * Has at least one job associated with this mailing finished? * - * @var boolean + * @var bool */ public $is_completed; /** * FK to the message template. * - * @var int unsigned + * @var int */ public $msg_template_id; /** * Should we overrite VERP address in Reply-To * - * @var boolean + * @var bool */ public $override_verp; /** * FK to Contact ID who first created this mailing * - * @var int unsigned + * @var int */ public $created_id; @@ -223,7 +223,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * FK to Contact ID who scheduled this mailing * - * @var int unsigned + * @var int */ public $scheduled_id; @@ -237,7 +237,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * FK to Contact ID who approved this mailing * - * @var int unsigned + * @var int */ public $approver_id; @@ -251,7 +251,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * The status of this mailing. Values: none, approved, rejected * - * @var int unsigned + * @var int */ public $approval_status_id; @@ -265,7 +265,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * Is this mailing archived? * - * @var boolean + * @var bool */ public $is_archived; @@ -279,19 +279,19 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * The campaign for which this mailing has been initiated. * - * @var int unsigned + * @var int */ public $campaign_id; /** * Remove duplicate emails? * - * @var boolean + * @var bool */ public $dedupe_email; /** - * @var int unsigned + * @var int */ public $sms_provider_id; @@ -305,7 +305,7 @@ class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO { /** * With email_selection_method, determines which email address to use * - * @var int unsigned + * @var int */ public $location_type_id; @@ -392,7 +392,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'header_id' => [ 'name' => 'header_id', @@ -497,7 +497,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_PseudoConstant::mailingTypes', - ] + ], ], 'from_name' => [ 'name' => 'from_name', @@ -563,7 +563,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_BAO_Mailing::getTemplateTypeNames', - ] + ], ], 'template_options' => [ 'name' => 'template_options', @@ -825,7 +825,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'mail_approval_status', 'optionEditPath' => 'civicrm/admin/options/mail_approval_status', - ] + ], ], 'approval_note' => [ 'name' => 'approval_note', @@ -874,7 +874,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::groupVisibility', - ] + ], ], 'campaign_id' => [ 'name' => 'campaign_id', @@ -894,7 +894,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'dedupe_email' => [ 'name' => 'dedupe_email', @@ -953,7 +953,7 @@ public static function &fields() { 'table' => 'civicrm_location_type', 'keyColumn' => 'id', 'labelColumn' => 'display_name', - ] + ], ], 'email_selection_method' => [ 'name' => 'email_selection_method', @@ -970,7 +970,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::emailSelectMethods', - ] + ], ], 'language' => [ 'name' => 'language', @@ -991,7 +991,7 @@ public static function &fields() { 'optionGroupName' => 'languages', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/languages', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Mailing/DAO/MailingAB.php b/CRM/Mailing/DAO/MailingAB.php index 3e42d261d0e9..9fb96960e1bc 100644 --- a/CRM/Mailing/DAO/MailingAB.php +++ b/CRM/Mailing/DAO/MailingAB.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/MailingAB.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:507182363032ab7340b7d1e7383ce1dd) + * (GenCodeChecksum:a45895256f23784bb86ae1b4659abbe6) */ /** @@ -29,7 +29,7 @@ class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; @@ -50,28 +50,28 @@ class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO { /** * The first experimental mailing ("A" condition) * - * @var int unsigned + * @var int */ public $mailing_id_a; /** * The second experimental mailing ("B" condition) * - * @var int unsigned + * @var int */ public $mailing_id_b; /** * The final, general mailing (derived from A or B) * - * @var int unsigned + * @var int */ public $mailing_id_c; /** * Which site is this mailing for * - * @var int unsigned + * @var int */ public $domain_id; @@ -100,14 +100,14 @@ class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO { public $declare_winning_time; /** - * @var int unsigned + * @var int */ public $group_percentage; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $created_id; @@ -187,7 +187,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_PseudoConstant::abStatus', - ] + ], ], 'mailing_id_a' => [ 'name' => 'mailing_id_a', @@ -246,7 +246,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_PseudoConstant::abTestCriteria', - ] + ], ], 'winner_criteria' => [ 'name' => 'winner_criteria', @@ -261,7 +261,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_PseudoConstant::abWinnerCriteria', - ] + ], ], 'specific_url' => [ 'name' => 'specific_url', diff --git a/CRM/Mailing/DAO/MailingComponent.php b/CRM/Mailing/DAO/MailingComponent.php index f4e6b01ac4f7..8a5e52eb204b 100644 --- a/CRM/Mailing/DAO/MailingComponent.php +++ b/CRM/Mailing/DAO/MailingComponent.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/MailingComponent.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:955923daf1ea29949123b9b76bab36da) + * (GenCodeChecksum:e3b5498354f50a2badfa4425958511af) */ /** @@ -29,7 +29,7 @@ class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; @@ -69,14 +69,14 @@ class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO { /** * Is this the default component for this component_type? * - * @var boolean + * @var bool */ public $is_default; /** * Is this property active? * - * @var boolean + * @var bool */ public $is_active; @@ -137,7 +137,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::mailingComponents', - ] + ], ], 'subject' => [ 'name' => 'subject', diff --git a/CRM/Mailing/DAO/MailingGroup.php b/CRM/Mailing/DAO/MailingGroup.php index dc3dec5d07aa..75bdc7f2b3fd 100644 --- a/CRM/Mailing/DAO/MailingGroup.php +++ b/CRM/Mailing/DAO/MailingGroup.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/MailingGroup.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:f39d14e245f10652e2fcea603ebc7610) + * (GenCodeChecksum:22f18bdbfea712ba8a6e1f0220ffb016) */ /** @@ -29,14 +29,14 @@ class CRM_Mailing_DAO_MailingGroup extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * The ID of a previous mailing to include/exclude recipients. * - * @var int unsigned + * @var int */ public $mailing_id; @@ -57,7 +57,7 @@ class CRM_Mailing_DAO_MailingGroup extends CRM_Core_DAO { /** * Foreign key to the referenced item. * - * @var int unsigned + * @var int */ public $entity_id; @@ -148,7 +148,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getMailingGroupTypes', - ] + ], ], 'entity_table' => [ 'name' => 'entity_table', @@ -165,7 +165,7 @@ public static function &fields() { 'localizable' => 0, 'pseudoconstant' => [ 'callback' => 'CRM_Mailing_BAO_Mailing::mailingGroupEntityTables', - ] + ], ], 'entity_id' => [ 'name' => 'entity_id', diff --git a/CRM/Mailing/DAO/MailingJob.php b/CRM/Mailing/DAO/MailingJob.php index cbbce73c406f..ebec9368ab07 100644 --- a/CRM/Mailing/DAO/MailingJob.php +++ b/CRM/Mailing/DAO/MailingJob.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/MailingJob.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:e362d1178fb0ca6293b31660e24ea375) + * (GenCodeChecksum:e7dbe1ca234cec93cb54192911b87297) */ /** @@ -29,14 +29,14 @@ class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * The ID of the mailing this Job will send. * - * @var int unsigned + * @var int */ public $mailing_id; @@ -71,7 +71,7 @@ class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO { /** * Is this job for a test mail? * - * @var boolean + * @var bool */ public $is_test; @@ -85,7 +85,7 @@ class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO { /** * Parent job id * - * @var int unsigned + * @var int */ public $parent_id; @@ -215,7 +215,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::getMailingJobStatus', - ] + ], ], 'is_test' => [ 'name' => 'is_test', diff --git a/CRM/Mailing/DAO/Recipients.php b/CRM/Mailing/DAO/Recipients.php index 4f1375686157..8ca9fe6ec0b2 100644 --- a/CRM/Mailing/DAO/Recipients.php +++ b/CRM/Mailing/DAO/Recipients.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Recipients.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:321767aa3e7c0ea7aac652b973d9603d) + * (GenCodeChecksum:006015b0e117746e7c97d656150badc3) */ /** @@ -29,35 +29,35 @@ class CRM_Mailing_DAO_Recipients extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * The ID of the mailing this Job will send. * - * @var int unsigned + * @var int */ public $mailing_id; /** * FK to Contact * - * @var int unsigned + * @var int */ public $contact_id; /** * FK to Email * - * @var int unsigned + * @var int */ public $email_id; /** * FK to Phone * - * @var int unsigned + * @var int */ public $phone_id; diff --git a/CRM/Mailing/DAO/Spool.php b/CRM/Mailing/DAO/Spool.php index ffde488e2696..20053007af3d 100644 --- a/CRM/Mailing/DAO/Spool.php +++ b/CRM/Mailing/DAO/Spool.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Spool.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:db7871e2d5313c106f01f1516beaf898) + * (GenCodeChecksum:55c696d855ff602c9e097bd9ccff0971) */ /** @@ -29,14 +29,14 @@ class CRM_Mailing_DAO_Spool extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * The ID of the Job . * - * @var int unsigned + * @var int */ public $job_id; diff --git a/CRM/Mailing/DAO/TrackableURL.php b/CRM/Mailing/DAO/TrackableURL.php index f87f00a386e7..751d21e744a3 100644 --- a/CRM/Mailing/DAO/TrackableURL.php +++ b/CRM/Mailing/DAO/TrackableURL.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/TrackableURL.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:e0280e1322178bb6d56a8104589c1415) + * (GenCodeChecksum:36f444ad863c1eae8db4e8e1c768eb27) */ /** @@ -29,7 +29,7 @@ class CRM_Mailing_DAO_TrackableURL extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; @@ -43,7 +43,7 @@ class CRM_Mailing_DAO_TrackableURL extends CRM_Core_DAO { /** * FK to the mailing * - * @var int unsigned + * @var int */ public $mailing_id; diff --git a/CRM/Mailing/Event/DAO/Bounce.php b/CRM/Mailing/Event/DAO/Bounce.php index d60eb55715df..8efd8fddb357 100644 --- a/CRM/Mailing/Event/DAO/Bounce.php +++ b/CRM/Mailing/Event/DAO/Bounce.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/Bounce.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:5243c65d5b727e60e1fdedb9fa3e84e2) + * (GenCodeChecksum:0b39ada8498cdc95e5eab7a4f060686a) */ /** @@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_Bounce extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to EventQueue * - * @var int unsigned + * @var int */ public $event_queue_id; /** * What type of bounce was it? * - * @var int unsigned + * @var int */ public $bounce_type_id; @@ -133,7 +133,7 @@ public static function &fields() { 'table' => 'civicrm_mailing_bounce_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'bounce_reason' => [ 'name' => 'bounce_reason', diff --git a/CRM/Mailing/Event/DAO/Confirm.php b/CRM/Mailing/Event/DAO/Confirm.php index 61373315e4e6..b80f8fc3198a 100644 --- a/CRM/Mailing/Event/DAO/Confirm.php +++ b/CRM/Mailing/Event/DAO/Confirm.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/Confirm.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:627a4d86b1b115a52592e04270eadc78) + * (GenCodeChecksum:dd5f6d9d5ca3115b92e9f87a1d5bf503) */ /** @@ -29,14 +29,14 @@ class CRM_Mailing_Event_DAO_Confirm extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to civicrm_mailing_event_subscribe * - * @var int unsigned + * @var int */ public $event_subscribe_id; diff --git a/CRM/Mailing/Event/DAO/Delivered.php b/CRM/Mailing/Event/DAO/Delivered.php index fed90da898dd..5a3008d751f9 100644 --- a/CRM/Mailing/Event/DAO/Delivered.php +++ b/CRM/Mailing/Event/DAO/Delivered.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/Delivered.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:0bdd626b315c4ad541239662d6c52a82) + * (GenCodeChecksum:6327ad9e20e94a06bd9609fd3f56a3b4) */ /** @@ -29,14 +29,14 @@ class CRM_Mailing_Event_DAO_Delivered extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to EventQueue * - * @var int unsigned + * @var int */ public $event_queue_id; diff --git a/CRM/Mailing/Event/DAO/Forward.php b/CRM/Mailing/Event/DAO/Forward.php index 7f9e189d4861..059c6b3a4a1c 100644 --- a/CRM/Mailing/Event/DAO/Forward.php +++ b/CRM/Mailing/Event/DAO/Forward.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/Forward.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:73d4b00ff9ea00d604d5e83963ba5597) + * (GenCodeChecksum:b178f318b31d833f478b236f268cbcec) */ /** @@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_Forward extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to EventQueue * - * @var int unsigned + * @var int */ public $event_queue_id; /** * FK to EventQueue for destination * - * @var int unsigned + * @var int */ public $dest_queue_id; diff --git a/CRM/Mailing/Event/DAO/Opened.php b/CRM/Mailing/Event/DAO/Opened.php index 6147a770ab39..69fb72573103 100644 --- a/CRM/Mailing/Event/DAO/Opened.php +++ b/CRM/Mailing/Event/DAO/Opened.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/Opened.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:226ec9ccc51c88320e1b4108d5a85bf3) + * (GenCodeChecksum:77cca50f0bb75aecfc26f8e62037b93d) */ /** @@ -29,14 +29,14 @@ class CRM_Mailing_Event_DAO_Opened extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to EventQueue * - * @var int unsigned + * @var int */ public $event_queue_id; diff --git a/CRM/Mailing/Event/DAO/Queue.php b/CRM/Mailing/Event/DAO/Queue.php index c229b074ec5f..efe1d0867d8f 100644 --- a/CRM/Mailing/Event/DAO/Queue.php +++ b/CRM/Mailing/Event/DAO/Queue.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/Queue.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:2b873b4e3dae5279b8b63b6e4de5adc0) + * (GenCodeChecksum:6ce46b44932d8dcdbf39af7d91a57a03) */ /** @@ -29,28 +29,28 @@ class CRM_Mailing_Event_DAO_Queue extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to Job * - * @var int unsigned + * @var int */ public $job_id; /** * FK to Email * - * @var int unsigned + * @var int */ public $email_id; /** * FK to Contact * - * @var int unsigned + * @var int */ public $contact_id; @@ -64,7 +64,7 @@ class CRM_Mailing_Event_DAO_Queue extends CRM_Core_DAO { /** * FK to Phone * - * @var int unsigned + * @var int */ public $phone_id; diff --git a/CRM/Mailing/Event/DAO/Reply.php b/CRM/Mailing/Event/DAO/Reply.php index 8ca919a823fe..27ec175e906a 100644 --- a/CRM/Mailing/Event/DAO/Reply.php +++ b/CRM/Mailing/Event/DAO/Reply.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/Reply.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:651380df4cde36fdfc999b5570cac1f9) + * (GenCodeChecksum:0ddff564744f8da4c3d5030ceb692b9c) */ /** @@ -29,14 +29,14 @@ class CRM_Mailing_Event_DAO_Reply extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to EventQueue * - * @var int unsigned + * @var int */ public $event_queue_id; diff --git a/CRM/Mailing/Event/DAO/Subscribe.php b/CRM/Mailing/Event/DAO/Subscribe.php index ad711c9d26d5..3162104cfc4b 100644 --- a/CRM/Mailing/Event/DAO/Subscribe.php +++ b/CRM/Mailing/Event/DAO/Subscribe.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/Subscribe.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a18362fb8ab1b7cd9b6f5450fcf367f5) + * (GenCodeChecksum:3f9398df2e81f38e0a24330928f85b47) */ /** @@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_Subscribe extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to Group * - * @var int unsigned + * @var int */ public $group_id; /** * FK to Contact * - * @var int unsigned + * @var int */ public $contact_id; @@ -123,7 +123,7 @@ public static function &fields() { 'table' => 'civicrm_group', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], 'contact_id' => [ 'name' => 'contact_id', diff --git a/CRM/Mailing/Event/DAO/TrackableURLOpen.php b/CRM/Mailing/Event/DAO/TrackableURLOpen.php index 39c7646d10e8..cce8241d1a3b 100644 --- a/CRM/Mailing/Event/DAO/TrackableURLOpen.php +++ b/CRM/Mailing/Event/DAO/TrackableURLOpen.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/TrackableURLOpen.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:1dd0644af19360b30531b6f23dde78c1) + * (GenCodeChecksum:ed0344e6d9483abfca366a5ba9735e56) */ /** @@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_TrackableURLOpen extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to EventQueue * - * @var int unsigned + * @var int */ public $event_queue_id; /** * FK to TrackableURL * - * @var int unsigned + * @var int */ public $trackable_url_id; diff --git a/CRM/Mailing/Event/DAO/Unsubscribe.php b/CRM/Mailing/Event/DAO/Unsubscribe.php index 7cd86585117c..8e7d40ddd7e3 100644 --- a/CRM/Mailing/Event/DAO/Unsubscribe.php +++ b/CRM/Mailing/Event/DAO/Unsubscribe.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Mailing/Event/Unsubscribe.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:e2a14fa1a63bd3f7b4e4fb4864a8560e) + * (GenCodeChecksum:f3f2e48cc72b5cacff2aad1e146e70f8) */ /** @@ -29,21 +29,21 @@ class CRM_Mailing_Event_DAO_Unsubscribe extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to EventQueue * - * @var int unsigned + * @var int */ public $event_queue_id; /** * Unsubscribe at org- or group-level * - * @var boolean + * @var bool */ public $org_unsubscribe; diff --git a/CRM/Mailing/Page/Browse.php b/CRM/Mailing/Page/Browse.php index 65bf2de542df..abb1428e2aae 100644 --- a/CRM/Mailing/Page/Browse.php +++ b/CRM/Mailing/Page/Browse.php @@ -67,7 +67,7 @@ class CRM_Mailing_Page_Browse extends CRM_Core_Page { /** * Scheduled mailing. * - * @var boolean + * @var bool */ public $_scheduled; diff --git a/CRM/Mailing/Selector/Search.php b/CRM/Mailing/Selector/Search.php index 65ad8038ce66..92f19eaffd22 100644 --- a/CRM/Mailing/Selector/Search.php +++ b/CRM/Mailing/Selector/Search.php @@ -73,14 +73,14 @@ class CRM_Mailing_Selector_Search extends CRM_Core_Selector_Base implements CRM_ /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Member/DAO/Membership.php b/CRM/Member/DAO/Membership.php index 43b1b5aa60a4..696e8ad635db 100644 --- a/CRM/Member/DAO/Membership.php +++ b/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:f292ac185330c17ffa8c647359ab07b4) + * (GenCodeChecksum:458e89b098dbf4f91369a293406c38ba) */ /** @@ -31,21 +31,21 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { /** * Membership Id * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** * FK to Membership Type * - * @var int unsigned + * @var int */ public $membership_type_id; @@ -78,14 +78,14 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { /** * FK to Membership Status * - * @var int unsigned + * @var int */ public $status_id; /** * 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. * - * @var boolean + * @var bool */ public $is_override; @@ -99,7 +99,7 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { /** * Optional FK to Parent Membership. * - * @var int unsigned + * @var int */ public $owner_membership_id; @@ -111,26 +111,26 @@ class CRM_Member_DAO_Membership extends CRM_Core_DAO { public $max_related; /** - * @var boolean + * @var bool */ public $is_test; /** - * @var boolean + * @var bool */ public $is_pay_later; /** * 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. * - * @var int unsigned + * @var int */ public $contribution_recur_id; /** * The campaign for which this membership is attached. * - * @var int unsigned + * @var int */ public $campaign_id; @@ -227,7 +227,7 @@ public static function &fields() { 'table' => 'civicrm_membership_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'join_date' => [ 'name' => 'join_date', @@ -326,7 +326,7 @@ public static function &fields() { 'table' => 'civicrm_membership_status', 'keyColumn' => 'id', 'labelColumn' => 'label', - ] + ], ], 'is_override' => [ 'name' => 'is_override', @@ -455,7 +455,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Member/DAO/MembershipBlock.php b/CRM/Member/DAO/MembershipBlock.php index 275fce3e7a38..117d8a7cc7c4 100644 --- a/CRM/Member/DAO/MembershipBlock.php +++ b/CRM/Member/DAO/MembershipBlock.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Member/MembershipBlock.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:00a04451a5cee7da1ae6a4c255f40481) + * (GenCodeChecksum:0e7f3965fe1382ec1f850a9489b3f236) */ /** @@ -31,7 +31,7 @@ class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO { /** * Membership Id * - * @var int unsigned + * @var int */ public $id; @@ -45,7 +45,7 @@ class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO { /** * FK to civicrm_contribution_page.id * - * @var int unsigned + * @var int */ public $entity_id; @@ -59,21 +59,21 @@ class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO { /** * Optional foreign key to membership_type * - * @var int unsigned + * @var int */ public $membership_type_default; /** * Display minimum membership fee * - * @var boolean + * @var bool */ public $display_min_fee; /** * Should membership transactions be processed separately * - * @var boolean + * @var bool */ public $is_separate_payment; @@ -108,14 +108,14 @@ class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO { /** * Is membership sign up optional * - * @var boolean + * @var bool */ public $is_required; /** * Is this membership_block enabled * - * @var boolean + * @var bool */ public $is_active; diff --git a/CRM/Member/DAO/MembershipLog.php b/CRM/Member/DAO/MembershipLog.php index 30b1e0bf4768..ef491cc13595 100644 --- a/CRM/Member/DAO/MembershipLog.php +++ b/CRM/Member/DAO/MembershipLog.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Member/MembershipLog.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:2ae50fe99b0c911fbe971e12e2bed7ce) + * (GenCodeChecksum:82b26091e0c62f81060ae15de5a4a010) */ /** @@ -29,21 +29,21 @@ class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to Membership table * - * @var int unsigned + * @var int */ public $membership_id; /** * New status assigned to membership by this action. FK to Membership Status * - * @var int unsigned + * @var int */ public $status_id; @@ -64,7 +64,7 @@ class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO { /** * FK to Contact ID of person under whose credentials this data modification was made. * - * @var int unsigned + * @var int */ public $modified_id; @@ -78,7 +78,7 @@ class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO { /** * FK to Membership Type. * - * @var int unsigned + * @var int */ public $membership_type_id; diff --git a/CRM/Member/DAO/MembershipPayment.php b/CRM/Member/DAO/MembershipPayment.php index 82a01b13e695..d6369491b9d6 100644 --- a/CRM/Member/DAO/MembershipPayment.php +++ b/CRM/Member/DAO/MembershipPayment.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Member/MembershipPayment.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:1296687b8bc4acb0b1db07fdd131d7ea) + * (GenCodeChecksum:63aaccfeac39fe31a88f69693e8b4302) */ /** @@ -29,21 +29,21 @@ class CRM_Member_DAO_MembershipPayment extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to Membership table * - * @var int unsigned + * @var int */ public $membership_id; /** * FK to contribution table. * - * @var int unsigned + * @var int */ public $contribution_id; diff --git a/CRM/Member/DAO/MembershipStatus.php b/CRM/Member/DAO/MembershipStatus.php index 701759ffc036..d238e87ac178 100644 --- a/CRM/Member/DAO/MembershipStatus.php +++ b/CRM/Member/DAO/MembershipStatus.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Member/MembershipStatus.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:125e59b6c34bc9ea478a12c18a66af01) + * (GenCodeChecksum:0cb23348cde6fff261da37c8cb309da1) */ /** @@ -31,7 +31,7 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO { /** * Membership Id * - * @var int unsigned + * @var int */ public $id; @@ -94,14 +94,14 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO { /** * Does this status aggregate to current members (e.g. New, Renewed, Grace might all be TRUE... while Unrenewed, Lapsed, Inactive would be FALSE). * - * @var boolean + * @var bool */ public $is_current_member; /** * Is this status for admin/manual assignment only. * - * @var boolean + * @var bool */ public $is_admin; @@ -113,21 +113,21 @@ class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO { /** * Assign this status to a membership record if no other status match is found. * - * @var boolean + * @var bool */ public $is_default; /** * Is this membership_status enabled. * - * @var boolean + * @var bool */ public $is_active; /** * Is this membership_status reserved. * - * @var boolean + * @var bool */ public $is_reserved; @@ -207,7 +207,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::eventDate', - ] + ], ], 'start_event_adjust_unit' => [ 'name' => 'start_event_adjust_unit', @@ -226,7 +226,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::unitList', - ] + ], ], 'start_event_adjust_interval' => [ 'name' => 'start_event_adjust_interval', @@ -256,7 +256,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::eventDate', - ] + ], ], 'end_event_adjust_unit' => [ 'name' => 'end_event_adjust_unit', @@ -275,7 +275,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::unitList', - ] + ], ], 'end_event_adjust_interval' => [ 'name' => 'end_event_adjust_interval', diff --git a/CRM/Member/DAO/MembershipType.php b/CRM/Member/DAO/MembershipType.php index c777c9a2e37e..8a30d029e05c 100644 --- a/CRM/Member/DAO/MembershipType.php +++ b/CRM/Member/DAO/MembershipType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Member/MembershipType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:6652513077f7dc2a13004ef30408a051) + * (GenCodeChecksum:fae17cb0df3f214ff3b3c1412771d53e) */ /** @@ -31,14 +31,14 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO { /** * Membership Id * - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this match entry for * - * @var int unsigned + * @var int */ public $domain_id; @@ -59,14 +59,14 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO { /** * Owner organization for this membership type. FK to Contact ID * - * @var int unsigned + * @var int */ public $member_of_contact_id; /** * If membership is paid by a contribution - what financial type should be used. FK to civicrm_financial_type.id * - * @var int unsigned + * @var int */ public $financial_type_id; @@ -158,14 +158,14 @@ class CRM_Member_DAO_MembershipType extends CRM_Core_DAO { /** * 0 = No auto-renew option; 1 = Give option, but not required; 2 = Auto-renew required; * - * @var boolean + * @var bool */ public $auto_renew; /** * Is this membership_type enabled * - * @var boolean + * @var bool */ public $is_active; @@ -230,7 +230,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'membership_type' => [ 'name' => 'name', @@ -297,7 +297,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'minimum_fee' => [ 'name' => 'minimum_fee', @@ -336,7 +336,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::membershipTypeUnitList', - ] + ], ], 'duration_interval' => [ 'name' => 'duration_interval', @@ -369,7 +369,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::periodType', - ] + ], ], 'fixed_period_start_day' => [ 'name' => 'fixed_period_start_day', @@ -449,7 +449,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::memberVisibility', - ] + ], ], 'weight' => [ 'name' => 'weight', @@ -512,7 +512,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Core_SelectValues::memberAutoRenew', - ] + ], ], 'is_active' => [ 'name' => 'is_active', diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index 3e1c01588ee3..1ffafe2a3324 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -312,7 +312,7 @@ public function buildQuickForm() { $this->assign('membershipTypeId', $this->_id); - if (CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled')) { + if (Civi::settings()->get('deferred_revenue_enabled')) { $deferredFinancialType = CRM_Financial_BAO_FinancialAccount::getDeferredFinancialType(); $this->assign('deferredFinancialType', array_keys($deferredFinancialType)); } diff --git a/CRM/Member/Form/Task/Delete.php b/CRM/Member/Form/Task/Delete.php index a6cbf2235b9b..a53b2bd34b9c 100644 --- a/CRM/Member/Form/Task/Delete.php +++ b/CRM/Member/Form/Task/Delete.php @@ -44,7 +44,7 @@ class CRM_Member_Form_Task_Delete extends CRM_Member_Form_Task { * Are we operating in "single mode", i.e. deleting one * specific membership? * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Member/Form/Task/Email.php b/CRM/Member/Form/Task/Email.php index be38db71a038..d58985192307 100644 --- a/CRM/Member/Form/Task/Email.php +++ b/CRM/Member/Form/Task/Email.php @@ -43,7 +43,7 @@ class CRM_Member_Form_Task_Email extends CRM_Member_Form_Task { * Are we operating in "single mode", i.e. sending email to one * specific contact? * - * @var boolean + * @var bool */ public $_single = FALSE; @@ -51,7 +51,7 @@ class CRM_Member_Form_Task_Email extends CRM_Member_Form_Task { * Are we operating in "single mode", i.e. sending email to one * specific contact? * - * @var boolean + * @var bool */ public $_noEmails = FALSE; diff --git a/CRM/Member/Import/Field.php b/CRM/Member/Import/Field.php index 93bb374bc825..68720b2be78c 100644 --- a/CRM/Member/Import/Field.php +++ b/CRM/Member/Import/Field.php @@ -59,7 +59,7 @@ class CRM_Member_Import_Field { /** * Is this field required - * @var boolean + * @var bool */ public $_required; diff --git a/CRM/Member/Import/Parser.php b/CRM/Member/Import/Parser.php index cf7367687609..bf1cffec4dff 100644 --- a/CRM/Member/Import/Parser.php +++ b/CRM/Member/Import/Parser.php @@ -62,7 +62,7 @@ abstract class CRM_Member_Import_Parser extends CRM_Import_Parser { /** * Whether the file has a column header or not * - * @var boolean + * @var bool */ protected $_haveColumnHeader; diff --git a/CRM/Member/Selector/Search.php b/CRM/Member/Selector/Search.php index 850046d86574..7c94dafc070e 100644 --- a/CRM/Member/Selector/Search.php +++ b/CRM/Member/Selector/Search.php @@ -76,14 +76,14 @@ class CRM_Member_Selector_Search extends CRM_Core_Selector_Base implements CRM_C /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/PCP/DAO/PCP.php b/CRM/PCP/DAO/PCP.php index b33921cf73ee..6229747297fe 100644 --- a/CRM/PCP/DAO/PCP.php +++ b/CRM/PCP/DAO/PCP.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/PCP/PCP.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:4585e6f51f50242cba89fe9325c44c44) + * (GenCodeChecksum:1e559645205e2e345feb591b14f7693c) */ /** @@ -31,19 +31,19 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO { /** * Personal Campaign Page ID * - * @var int unsigned + * @var int */ public $id; /** * FK to Contact ID * - * @var int unsigned + * @var int */ public $contact_id; /** - * @var int unsigned + * @var int */ public $status_id; @@ -70,7 +70,7 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO { /** * The Contribution or Event Page which triggered this pcp * - * @var int unsigned + * @var int */ public $page_id; @@ -84,17 +84,17 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO { /** * The pcp block that this pcp page was created from * - * @var int unsigned + * @var int */ public $pcp_block_id; /** - * @var int unsigned + * @var int */ public $is_thermometer; /** - * @var int unsigned + * @var int */ public $is_honor_roll; @@ -115,14 +115,14 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO { /** * Is Personal Campaign Page enabled/active? * - * @var boolean + * @var bool */ public $is_active; /** * Notify owner via email when someone donates to page? * - * @var boolean + * @var bool */ public $is_notify; @@ -201,7 +201,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'pcp_status', 'optionEditPath' => 'civicrm/admin/options/pcp_status', - ] + ], ], 'title' => [ 'name' => 'title', @@ -371,7 +371,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'is_active' => [ 'name' => 'is_active', diff --git a/CRM/PCP/DAO/PCPBlock.php b/CRM/PCP/DAO/PCPBlock.php index 2d93ff55c85f..14e478a5b5f5 100644 --- a/CRM/PCP/DAO/PCPBlock.php +++ b/CRM/PCP/DAO/PCPBlock.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/PCP/PCPBlock.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:7cd542a1105ef4cf3ca8596869042754) + * (GenCodeChecksum:deacae800c52be5e0de763f8bccf4578) */ /** @@ -31,7 +31,7 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO { /** * PCP block Id * - * @var int unsigned + * @var int */ public $id; @@ -43,7 +43,7 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO { /** * FK to civicrm_contribution_page.id OR civicrm_event.id * - * @var int unsigned + * @var int */ public $entity_id; @@ -57,42 +57,42 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO { /** * The entity that this pcp targets * - * @var int unsigned + * @var int */ public $target_entity_id; /** * FK to civicrm_uf_group.id. Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)? * - * @var int unsigned + * @var int */ public $supporter_profile_id; /** * FK to civicrm_option_group with name = PCP owner notifications * - * @var int unsigned + * @var int */ public $owner_notify_id; /** * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)? * - * @var boolean + * @var bool */ public $is_approval_needed; /** * Does Personal Campaign Page allow using tell a friend? * - * @var boolean + * @var bool */ public $is_tellfriend_enabled; /** * Maximum recipient fields allowed in tell a friend * - * @var int unsigned + * @var int */ public $tellfriend_limit; @@ -106,7 +106,7 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO { /** * Is Personal Campaign Page Block enabled/active? * - * @var boolean + * @var bool */ public $is_active; @@ -243,7 +243,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'pcp_owner_notify', 'optionEditPath' => 'civicrm/admin/options/pcp_owner_notify', - ] + ], ], 'is_approval_needed' => [ 'name' => 'is_approval_needed', diff --git a/CRM/PCP/Form/PCPAccount.php b/CRM/PCP/Form/PCPAccount.php index ccac09cf5496..624b873b4ce5 100644 --- a/CRM/PCP/Form/PCPAccount.php +++ b/CRM/PCP/Form/PCPAccount.php @@ -49,7 +49,7 @@ class CRM_PCP_Form_PCPAccount extends CRM_Core_Form { /** * Are we in single form mode or wizard mode? * - * @var boolean + * @var bool */ public $_single; diff --git a/CRM/Pledge/DAO/Pledge.php b/CRM/Pledge/DAO/Pledge.php index 76e796bfc9a3..db8f334b16e2 100644 --- a/CRM/Pledge/DAO/Pledge.php +++ b/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:4c4aab1d03d146815017589777121bbb) + * (GenCodeChecksum:8abf6ce03bebecdbd175b48fd6177b54) */ /** @@ -31,28 +31,28 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO { /** * Pledge ID * - * @var int unsigned + * @var int */ public $id; /** * Foreign key to civicrm_contact.id . * - * @var int unsigned + * @var int */ public $contact_id; /** * FK to Financial Type * - * @var int unsigned + * @var int */ public $financial_type_id; /** * The Contribution Page which triggered this contribution * - * @var int unsigned + * @var int */ public $contribution_page_id; @@ -87,21 +87,21 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO { /** * Number of time units for recurrence of pledge payments. * - * @var int unsigned + * @var int */ public $frequency_interval; /** * Day in the period when the pledge payment is due e.g. 1st of month, 15th etc. Use this to set the scheduled dates for pledge payments. * - * @var int unsigned + * @var int */ public $frequency_day; /** * Total number of payments to be made. * - * @var int unsigned + * @var int */ public $installments; @@ -150,40 +150,40 @@ class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO { /** * The maximum number of payment reminders to send for any given payment. * - * @var int unsigned + * @var int */ public $max_reminders; /** * Send initial reminder this many days prior to the payment due date. * - * @var int unsigned + * @var int */ public $initial_reminder_day; /** * Send additional reminder this many days after last one sent, up to maximum number of reminders. * - * @var int unsigned + * @var int */ public $additional_reminder_day; /** * Implicit foreign key to civicrm_option_values in the pledge_status option group. * - * @var int unsigned + * @var int */ public $status_id; /** - * @var boolean + * @var bool */ public $is_test; /** * The campaign for which this pledge has been initiated. * - * @var int unsigned + * @var int */ public $campaign_id; @@ -271,7 +271,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'pledge_contribution_page_id' => [ 'name' => 'contribution_page_id', @@ -347,7 +347,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'pledge_frequency_unit' => [ 'name' => 'frequency_unit', @@ -369,7 +369,7 @@ public static function &fields() { 'optionGroupName' => 'recur_frequency_units', 'keyColumn' => 'name', 'optionEditPath' => 'civicrm/admin/options/recur_frequency_units', - ] + ], ], 'pledge_frequency_interval' => [ 'name' => 'frequency_interval', @@ -564,7 +564,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'pledge_status', 'optionEditPath' => 'civicrm/admin/options/pledge_status', - ] + ], ], 'pledge_is_test' => [ 'name' => 'is_test', @@ -602,7 +602,7 @@ public static function &fields() { 'table' => 'civicrm_campaign', 'keyColumn' => 'id', 'labelColumn' => 'title', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Pledge/DAO/PledgeBlock.php b/CRM/Pledge/DAO/PledgeBlock.php index e319da634e73..77e6525ca7e9 100644 --- a/CRM/Pledge/DAO/PledgeBlock.php +++ b/CRM/Pledge/DAO/PledgeBlock.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Pledge/PledgeBlock.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:cdc529b617a76a84e18455737f4e7a03) + * (GenCodeChecksum:0ba3eca2bf0f4b6ebd0f9b3617d5bef0) */ /** @@ -31,7 +31,7 @@ class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO { /** * Pledge ID * - * @var int unsigned + * @var int */ public $id; @@ -45,7 +45,7 @@ class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO { /** * FK to entity table specified in entity_table column. * - * @var int unsigned + * @var int */ public $entity_id; @@ -59,28 +59,28 @@ class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO { /** * Is frequency interval exposed on the contribution form. * - * @var boolean + * @var bool */ public $is_pledge_interval; /** * The maximum number of payment reminders to send for any given payment. * - * @var int unsigned + * @var int */ public $max_reminders; /** * Send initial reminder this many days prior to the payment due date. * - * @var int unsigned + * @var int */ public $initial_reminder_day; /** * Send additional reminder this many days after last one sent, up to maximum number of reminders. * - * @var int unsigned + * @var int */ public $additional_reminder_day; @@ -94,14 +94,14 @@ class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO { /** * If true - recurring start date is shown. * - * @var boolean + * @var bool */ public $is_pledge_start_date_visible; /** * If true - recurring start date is editable. * - * @var boolean + * @var bool */ public $is_pledge_start_date_editable; diff --git a/CRM/Pledge/DAO/PledgePayment.php b/CRM/Pledge/DAO/PledgePayment.php index f3d80a9327e7..3beaeb072609 100644 --- a/CRM/Pledge/DAO/PledgePayment.php +++ b/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:79875dd118415179172c3ac425758b29) + * (GenCodeChecksum:549f97b304511abaf03fd8f4378dd123) */ /** @@ -29,21 +29,21 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO { public static $_log = TRUE; /** - * @var int unsigned + * @var int */ public $id; /** * FK to Pledge table * - * @var int unsigned + * @var int */ public $pledge_id; /** * FK to contribution table. * - * @var int unsigned + * @var int */ public $contribution_id; @@ -85,12 +85,12 @@ class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO { /** * The number of payment reminders sent. * - * @var int unsigned + * @var int */ public $reminder_count; /** - * @var int unsigned + * @var int */ public $status_id; @@ -220,7 +220,7 @@ public static function &fields() { 'keyColumn' => 'name', 'labelColumn' => 'full_name', 'nameColumn' => 'name', - ] + ], ], 'pledge_payment_scheduled_date' => [ 'name' => 'scheduled_date', @@ -281,7 +281,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'contribution_status', 'optionEditPath' => 'civicrm/admin/options/contribution_status', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Pledge/Form/Search.php b/CRM/Pledge/Form/Search.php index e4a0354e0147..c101d33a6d9a 100644 --- a/CRM/Pledge/Form/Search.php +++ b/CRM/Pledge/Form/Search.php @@ -46,14 +46,14 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact. * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Pledge/Form/Task/Delete.php b/CRM/Pledge/Form/Task/Delete.php index deb28e3e3911..ace7d9471736 100644 --- a/CRM/Pledge/Form/Task/Delete.php +++ b/CRM/Pledge/Form/Task/Delete.php @@ -42,7 +42,7 @@ class CRM_Pledge_Form_Task_Delete extends CRM_Pledge_Form_Task { * Are we operating in "single mode", i.e. deleting one * specific pledge? * - * @var boolean + * @var bool */ protected $_single = FALSE; diff --git a/CRM/Pledge/Selector/Search.php b/CRM/Pledge/Selector/Search.php index 94551d9544ae..b2d39ad3b71b 100644 --- a/CRM/Pledge/Selector/Search.php +++ b/CRM/Pledge/Selector/Search.php @@ -80,14 +80,14 @@ class CRM_Pledge_Selector_Search extends CRM_Core_Selector_Base { /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_single = FALSE; /** * Are we restricting ourselves to a single contact * - * @var boolean + * @var bool */ protected $_limit = NULL; diff --git a/CRM/Price/DAO/LineItem.php b/CRM/Price/DAO/LineItem.php index 8d7ae16d2961..0308c354b4e9 100644 --- a/CRM/Price/DAO/LineItem.php +++ b/CRM/Price/DAO/LineItem.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/LineItem.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:efca4ce3a24803ffca3180f7a81ea6f2) + * (GenCodeChecksum:4d5b3e1656a90fd394f80dad0da0f57b) */ /** @@ -31,7 +31,7 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO { /** * Line Item * - * @var int unsigned + * @var int */ public $id; @@ -45,21 +45,21 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO { /** * entry in table * - * @var int unsigned + * @var int */ public $entity_id; /** * FK to civicrm_contribution * - * @var int unsigned + * @var int */ public $contribution_id; /** * FK to civicrm_price_field * - * @var int unsigned + * @var int */ public $price_field_id; @@ -94,21 +94,21 @@ class CRM_Price_DAO_LineItem extends CRM_Core_DAO { /** * Participant count for field * - * @var int unsigned + * @var int */ public $participant_count; /** * FK to civicrm_price_field_value * - * @var int unsigned + * @var int */ public $price_field_value_id; /** * FK to Financial Type. * - * @var int unsigned + * @var int */ public $financial_type_id; @@ -341,7 +341,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'non_deductible_amount' => [ 'name' => 'non_deductible_amount', diff --git a/CRM/Price/DAO/PriceField.php b/CRM/Price/DAO/PriceField.php index 8f825a193812..e823c87c3960 100644 --- a/CRM/Price/DAO/PriceField.php +++ b/CRM/Price/DAO/PriceField.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/PriceField.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:e9ff5a22489167a421efd2f415ba4f58) + * (GenCodeChecksum:ccea318a7e83c8fd6d03734e20798b15) */ /** @@ -31,14 +31,14 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { /** * Price Field * - * @var int unsigned + * @var int */ public $id; /** * FK to civicrm_price_set * - * @var int unsigned + * @var int */ public $price_set_id; @@ -64,7 +64,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { /** * Enter a quantity for this field? * - * @var boolean + * @var bool */ public $is_enter_qty; @@ -92,28 +92,28 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { /** * Should the price be displayed next to the label for each option? * - * @var boolean + * @var bool */ public $is_display_amounts; /** * number of options per line for checkbox and radio * - * @var int unsigned + * @var int */ public $options_per_line; /** * Is this price field active * - * @var boolean + * @var bool */ public $is_active; /** * Is this price field required (value must be > 1) * - * @var boolean + * @var bool */ public $is_required; @@ -141,7 +141,7 @@ class CRM_Price_DAO_PriceField extends CRM_Core_DAO { /** * Implicit FK to civicrm_option_group with name = 'visibility' * - * @var int unsigned + * @var int */ public $visibility_id; @@ -252,7 +252,7 @@ public static function &fields() { ], 'pseudoconstant' => [ 'callback' => 'CRM_Price_BAO_PriceField::htmlTypes', - ] + ], ], 'is_enter_qty' => [ 'name' => 'is_enter_qty', @@ -441,7 +441,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'visibility', 'optionEditPath' => 'civicrm/admin/options/visibility', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Price/DAO/PriceFieldValue.php b/CRM/Price/DAO/PriceFieldValue.php index bd6f7daa2001..98776cb511f7 100644 --- a/CRM/Price/DAO/PriceFieldValue.php +++ b/CRM/Price/DAO/PriceFieldValue.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/PriceFieldValue.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a3de204f039daa85984316fae2c60975) + * (GenCodeChecksum:fe5a14d18ba9a89882e7bc8008f7be54) */ /** @@ -31,14 +31,14 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { /** * Price Field Value * - * @var int unsigned + * @var int */ public $id; /** * FK to civicrm_price_field * - * @var int unsigned + * @var int */ public $price_field_id; @@ -87,14 +87,14 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { /** * Number of participants per field option * - * @var int unsigned + * @var int */ public $count; /** * Max number of participants per field options * - * @var int unsigned + * @var int */ public $max_value; @@ -108,35 +108,35 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { /** * FK to Membership Type * - * @var int unsigned + * @var int */ public $membership_type_id; /** * Number of terms for this membership * - * @var int unsigned + * @var int */ public $membership_num_terms; /** * Is this default price field option * - * @var boolean + * @var bool */ public $is_default; /** * Is this price field value active * - * @var boolean + * @var bool */ public $is_active; /** * FK to Financial Type. * - * @var int unsigned + * @var int */ public $financial_type_id; @@ -150,7 +150,7 @@ class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO { /** * Implicit FK to civicrm_option_group with name = 'visibility' * - * @var int unsigned + * @var int */ public $visibility_id; @@ -436,7 +436,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'non_deductible_amount' => [ 'name' => 'non_deductible_amount', @@ -477,7 +477,7 @@ public static function &fields() { 'pseudoconstant' => [ 'optionGroupName' => 'visibility', 'optionEditPath' => 'civicrm/admin/options/visibility', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/Price/DAO/PriceSet.php b/CRM/Price/DAO/PriceSet.php index ae2e04ef8ea4..1593408b04ee 100644 --- a/CRM/Price/DAO/PriceSet.php +++ b/CRM/Price/DAO/PriceSet.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/PriceSet.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a66d639b335e9df4c3133ade2aa16a9b) + * (GenCodeChecksum:5dcf30888df8309f20fa347780f16f4d) */ /** @@ -31,14 +31,14 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { /** * Price Set * - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this price-set for * - * @var int unsigned + * @var int */ public $domain_id; @@ -59,7 +59,7 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { /** * Is this price set active * - * @var boolean + * @var bool */ public $is_active; @@ -94,28 +94,28 @@ class CRM_Price_DAO_PriceSet extends CRM_Core_DAO { /** * FK to Financial Type(for membership price sets only). * - * @var int unsigned + * @var int */ public $financial_type_id; /** * Is set if edited on Contribution or Event Page rather than through Manage Price Sets * - * @var boolean + * @var bool */ public $is_quick_config; /** * Is this a predefined system price set (i.e. it can not be deleted, edited)? * - * @var boolean + * @var bool */ public $is_reserved; /** * Minimum Amount required for this set. * - * @var int unsigned + * @var int */ public $min_amount; @@ -181,7 +181,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'name' => [ 'name' => 'name', @@ -300,7 +300,7 @@ public static function &fields() { 'table' => 'civicrm_component', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'financial_type_id' => [ 'name' => 'financial_type_id', @@ -321,7 +321,7 @@ public static function &fields() { 'table' => 'civicrm_financial_type', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'is_quick_config' => [ 'name' => 'is_quick_config', diff --git a/CRM/Price/DAO/PriceSetEntity.php b/CRM/Price/DAO/PriceSetEntity.php index c665acc98a64..0e6750dc84a7 100644 --- a/CRM/Price/DAO/PriceSetEntity.php +++ b/CRM/Price/DAO/PriceSetEntity.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Price/PriceSetEntity.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ba2a78bcd5c6c34e2a81d1bcef776ca3) + * (GenCodeChecksum:8bd26effd43fe4ee752addf11e6a4769) */ /** @@ -31,7 +31,7 @@ class CRM_Price_DAO_PriceSetEntity extends CRM_Core_DAO { /** * Price Set Entity * - * @var int unsigned + * @var int */ public $id; @@ -45,14 +45,14 @@ class CRM_Price_DAO_PriceSetEntity extends CRM_Core_DAO { /** * Item in table * - * @var int unsigned + * @var int */ public $entity_id; /** * price set being used * - * @var int unsigned + * @var int */ public $price_set_id; diff --git a/CRM/Price/Page/Field.php b/CRM/Price/Page/Field.php index 47e1cb1c93dc..d32d22d2e4d0 100644 --- a/CRM/Price/Page/Field.php +++ b/CRM/Price/Page/Field.php @@ -62,7 +62,7 @@ class CRM_Price_Page_Field extends CRM_Core_Page { /** * The price set is reserved or not. * - * @var boolean + * @var bool */ protected $_isSetReserved = FALSE; diff --git a/CRM/Price/Page/Option.php b/CRM/Price/Page/Option.php index bdf06ffc3631..fd610f35c9e7 100644 --- a/CRM/Price/Page/Option.php +++ b/CRM/Price/Page/Option.php @@ -62,7 +62,7 @@ class CRM_Price_Page_Option extends CRM_Core_Page { /** * The price set is reserved or not. * - * @var boolean + * @var bool */ protected $_isSetReserved = FALSE; diff --git a/CRM/Profile/Page/Dynamic.php b/CRM/Profile/Page/Dynamic.php index 8f9d42e64cfb..0ea100a3378c 100644 --- a/CRM/Profile/Page/Dynamic.php +++ b/CRM/Profile/Page/Dynamic.php @@ -65,7 +65,7 @@ class CRM_Profile_Page_Dynamic extends CRM_Core_Page { /** * Should we bypass permissions. * - * @var boolean + * @var bool */ protected $_skipPermission; diff --git a/CRM/Profile/Selector/Listings.php b/CRM/Profile/Selector/Listings.php index ac36108f2a2b..e92eb6641fe4 100644 --- a/CRM/Profile/Selector/Listings.php +++ b/CRM/Profile/Selector/Listings.php @@ -98,21 +98,21 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR /** * Do we enable mapping of users. * - * @var boolean + * @var bool */ protected $_map; /** * Do we enable edit link. * - * @var boolean + * @var bool */ protected $_editLink; /** * Should we link to the UF Profile. * - * @var boolean + * @var bool */ protected $_linkToUF; diff --git a/CRM/Queue/DAO/QueueItem.php b/CRM/Queue/DAO/QueueItem.php index de2e97635b08..f866a92be52d 100644 --- a/CRM/Queue/DAO/QueueItem.php +++ b/CRM/Queue/DAO/QueueItem.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Queue/QueueItem.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:c9e273e55020d73d90150ef7d6e04312) + * (GenCodeChecksum:375c90f10f805de0cc712cad771cf15e) */ /** @@ -29,7 +29,7 @@ class CRM_Queue_DAO_QueueItem extends CRM_Core_DAO { public static $_log = FALSE; /** - * @var int unsigned + * @var int */ public $id; diff --git a/CRM/Report/DAO/ReportInstance.php b/CRM/Report/DAO/ReportInstance.php index 1d5eae4979ed..45199eff7825 100644 --- a/CRM/Report/DAO/ReportInstance.php +++ b/CRM/Report/DAO/ReportInstance.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Report/ReportInstance.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:08099952886e51709d4f1ecbd9feefaf) + * (GenCodeChecksum:22eeac140cc540874af36a422c548078) */ /** @@ -31,14 +31,14 @@ class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO { /** * Report Instance ID * - * @var int unsigned + * @var int */ public $id; /** * Which Domain is this instance for * - * @var int unsigned + * @var int */ public $domain_id; @@ -101,21 +101,21 @@ class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO { /** * Is this entry active? * - * @var boolean + * @var bool */ public $is_active; /** * FK to contact table. * - * @var int unsigned + * @var int */ public $created_id; /** * FK to contact table. * - * @var int unsigned + * @var int */ public $owner_id; @@ -157,19 +157,19 @@ class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO { /** * FK to navigation ID * - * @var int unsigned + * @var int */ public $navigation_id; /** * FK to instance ID drilldown to * - * @var int unsigned + * @var int */ public $drilldown_id; /** - * @var boolean + * @var bool */ public $is_reserved; @@ -236,7 +236,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], 'title' => [ 'name' => 'title', diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index 76ade8a72987..532bd0e022c6 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -300,14 +300,14 @@ class CRM_Report_Form extends CRM_Core_Form { /** * Flag to indicate if result-set is to be stored in a class variable which could be retrieved using getResultSet() method. * - * @var boolean + * @var bool */ protected $_storeResultSet = FALSE; /** * When _storeResultSet Flag is set use this var to store result set in form of array * - * @var boolean + * @var bool */ protected $_resultSet = []; @@ -325,7 +325,7 @@ class CRM_Report_Form extends CRM_Core_Form { /** * Variables to hold the acl inner join and where clause - * @var string|NULL + * @var string|null */ protected $_aclFrom = NULL; protected $_aclWhere = NULL; @@ -358,7 +358,7 @@ class CRM_Report_Form extends CRM_Core_Form { * * (it's unclear if this could be merged with outputMode at this stage) * - * @var string|NULL + * @var string|null */ protected $_format; @@ -380,21 +380,24 @@ class CRM_Report_Form extends CRM_Core_Form { public $_havingClauses = []; /** - * DashBoardRowCount Dashboard row count - * @var Integer + * DashBoardRowCount Dashboard row count. + * + * @var int */ public $_dashBoardRowCount; /** * Is this being called without a form controller (ie. the report is being render outside the normal form - * - e.g the api is retrieving the rows - * @var boolean + * - e.g the api is retrieving the rows. + * + * @var bool */ public $noController = FALSE; /** - * Variable to hold the currency alias - * @var string|NULL + * Variable to hold the currency alias. + * + * @var string|null */ protected $_currencyColumn = NULL; diff --git a/CRM/Report/Form/Contribute/Summary.php b/CRM/Report/Form/Contribute/Summary.php index 05d72b807f19..81a692cae57c 100644 --- a/CRM/Report/Form/Contribute/Summary.php +++ b/CRM/Report/Form/Contribute/Summary.php @@ -631,7 +631,7 @@ public function statistics(&$rows) { $contriSQL = "SELECT {$contriQuery} {$group} {$this->_having}"; $contriDAO = CRM_Core_DAO::executeQuery($contriSQL); - + $this->addToDeveloperTab($contriSQL); $totalAmount = $average = $mode = $median = $softTotalAmount = $softAverage = array(); $count = $softCount = 0; while ($contriDAO->fetch()) { @@ -655,6 +655,7 @@ public function statistics(&$rows) { if ($softCredit) { $softDAO = CRM_Core_DAO::executeQuery($softSQL); + $this->addToDeveloperTab($softSQL); while ($softDAO->fetch()) { $softTotalAmount[] = CRM_Utils_Money::format($softDAO->civicrm_contribution_soft_soft_amount_sum, $softDAO->currency) . @@ -725,6 +726,7 @@ public function postProcess() { */ public function buildRows($sql, &$rows) { $dao = CRM_Core_DAO::executeQuery($sql); + $this->addToDeveloperTab($sql); if (!is_array($rows)) { $rows = array(); } @@ -742,6 +744,7 @@ public function buildRows($sql, &$rows) { $this->customDataFrom(); $contriSQL = "{$this->_select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy} {$this->_limit}"; $contriDAO = CRM_Core_DAO::executeQuery($contriSQL); + $this->addToDeveloperTab($contriSQL); $contriFields = array( 'civicrm_contribution_total_amount_sum', 'civicrm_contribution_total_amount_avg', diff --git a/CRM/SMS/DAO/Provider.php b/CRM/SMS/DAO/Provider.php index 36da579b4f1c..81a2b07603b8 100644 --- a/CRM/SMS/DAO/Provider.php +++ b/CRM/SMS/DAO/Provider.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/SMS/Provider.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a24ea48b652eba8827a5275a127df61e) + * (GenCodeChecksum:73f7f33374bc59a6251529cd2ba704cf) */ /** @@ -31,7 +31,7 @@ class CRM_SMS_DAO_Provider extends CRM_Core_DAO { /** * SMS Provider ID * - * @var int unsigned + * @var int */ public $id; @@ -62,7 +62,7 @@ class CRM_SMS_DAO_Provider extends CRM_Core_DAO { /** * points to value in civicrm_option_value for group sms_api_type * - * @var int unsigned + * @var int */ public $api_type; @@ -79,19 +79,19 @@ class CRM_SMS_DAO_Provider extends CRM_Core_DAO { public $api_params; /** - * @var boolean + * @var bool */ public $is_default; /** - * @var boolean + * @var bool */ public $is_active; /** * Which Domain is this sms provider for * - * @var int unsigned + * @var int */ public $domain_id; @@ -284,7 +284,7 @@ public static function &fields() { 'table' => 'civicrm_domain', 'keyColumn' => 'id', 'labelColumn' => 'name', - ] + ], ], ]; CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']); diff --git a/CRM/UF/Form/Field.php b/CRM/UF/Form/Field.php index 8640d593f07e..d8bd4c92324b 100644 --- a/CRM/UF/Form/Field.php +++ b/CRM/UF/Form/Field.php @@ -82,7 +82,7 @@ class CRM_UF_Form_Field extends CRM_Core_Form { * Is this profile has searchable field. * or is any field having in selector true. * - * @var boolean. + * @var bool. */ protected $_hasSearchableORInSelector; diff --git a/CRM/Upgrade/Form.php b/CRM/Upgrade/Form.php index 483125451f1d..a8f62440b39b 100644 --- a/CRM/Upgrade/Form.php +++ b/CRM/Upgrade/Form.php @@ -60,7 +60,7 @@ class CRM_Upgrade_Form extends CRM_Core_Form { /** * Upgrade for multilingual. * - * @var boolean + * @var bool */ public $multilingual = FALSE; diff --git a/CRM/Upgrade/Incremental/Base.php b/CRM/Upgrade/Incremental/Base.php index c787ca4ac2cd..5145be107211 100644 --- a/CRM/Upgrade/Incremental/Base.php +++ b/CRM/Upgrade/Incremental/Base.php @@ -196,6 +196,29 @@ public static function updateMessageTemplates($ctx, $version) { } + /** + * Re-save any valid values from contribute settings into the normal setting + * format. + * + * We render the array of contribution_invoice_settings and any that have + * metadata defined we add to the correct key. This is safe to run even if no + * settings are to be converted, per the test in + * testConvertUpgradeContributeSettings. + * + * @param $ctx + * + * @return bool + */ + public static function updateContributeSettings($ctx) { + $settings = Civi::settings()->get('contribution_invoice_settings'); + $metadata = \Civi\Core\SettingsMetadata::getMetadata(); + $conversions = array_intersect_key((array) $settings, $metadata); + foreach ($conversions as $key => $conversion) { + Civi::settings()->set($key, $conversion); + } + return TRUE; + } + /** * Do any relevant smart group updates. * diff --git a/CRM/Upgrade/Incremental/php/FiveFifteen.php b/CRM/Upgrade/Incremental/php/FiveFifteen.php index 39f1b1bd7c9c..2cfb6a2d3396 100644 --- a/CRM/Upgrade/Incremental/php/FiveFifteen.php +++ b/CRM/Upgrade/Incremental/php/FiveFifteen.php @@ -67,21 +67,14 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) { * (change the x in the function name): */ - // /** - // * Upgrade function. - // * - // * @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('Do the foo change', 'taskFoo', ...); - // // Additional tasks here... - // // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex. - // // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable. - // } - - // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) { - // return TRUE; - // } + /** + * Upgrade function. + * + * @param string $rev + */ + public function upgrade_5_15_alpha1($rev) { + $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev); + $this->addTask('Fix errant deferred revenue settings', 'updateContributeSettings'); + } } diff --git a/CRM/Utils/AutoClean.php b/CRM/Utils/AutoClean.php index 558ca34adb7f..c2c21dc1849a 100644 --- a/CRM/Utils/AutoClean.php +++ b/CRM/Utils/AutoClean.php @@ -102,4 +102,24 @@ public function __destruct() { \Civi\Core\Resolver::singleton()->call($this->callback, $this->args); } + /** + * Prohibit (de)serialization of CRM_Utils_AutoClean. + * + * The generic nature of AutoClean makes it a potential target for escalating + * serialization vulnerabilities, and there's no good reason for serializing it. + */ + public function __sleep() { + throw new \RuntimeException("CRM_Utils_AutoClean is a runtime helper. It is not intended for serialization."); + } + + /** + * Prohibit (de)serialization of CRM_Utils_AutoClean. + * + * The generic nature of AutoClean makes it a potential target for escalating + * serialization vulnerabilities, and there's no good reason for deserializing it. + */ + public function __wakeup() { + throw new \RuntimeException("CRM_Utils_AutoClean is a runtime helper. It is not intended for deserialization."); + } + } diff --git a/CRM/Utils/File.php b/CRM/Utils/File.php index b51905f71496..efd0b79c6141 100644 --- a/CRM/Utils/File.php +++ b/CRM/Utils/File.php @@ -1066,4 +1066,29 @@ public static function isValidFileName($fileName = NULL) { return FALSE; } + /** + * Get the extensions that this MimeTpe is for + * @param string $mimeType the mime-type we want extensions for + * @return array + */ + public static function getAcceptableExtensionsForMimeType($mimeType = NULL) { + $mapping = \MimeType\Mapping::$types; + $extensions = []; + foreach ($mapping as $extension => $type) { + if ($mimeType == $type) { + $extensions[] = $extension; + } + } + return $extensions; + } + + /** + * Get the extension of a file based on its path + * @param string $path path of the file to query + * @return string + */ + public static function getExtensionFromPath($path) { + return pathinfo($path, PATHINFO_EXTENSION); + } + } diff --git a/CRM/Utils/Rule.php b/CRM/Utils/Rule.php index 50d72d38352e..940128d7156c 100644 --- a/CRM/Utils/Rule.php +++ b/CRM/Utils/Rule.php @@ -488,6 +488,8 @@ public static function positiveInteger($value) { */ public static function commaSeparatedIntegers($value) { foreach (explode(',', $value) as $val) { + // Remove any Whitespace around the key. + $val = trim($val); if (!self::positiveInteger($val)) { return FALSE; } diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php index e280a40ba76f..f1df28970aee 100644 --- a/CRM/Utils/System/Drupal8.php +++ b/CRM/Utils/System/Drupal8.php @@ -300,19 +300,21 @@ public function url( ) { $query = html_entity_decode($query); + $config = CRM_Core_Config::singleton(); + $base = $absolute ? $config->userFrameworkBaseURL : 'internal:/'; + $url = \Drupal\civicrm\CivicrmHelper::parseURL("{$path}?{$query}"); // Not all links that CiviCRM generates are Drupal routes, so we use the weaker ::fromUri method. try { - $url = \Drupal\Core\Url::fromUri("base:{$url['path']}", [ + $url = \Drupal\Core\Url::fromUri("{$base}{$url['path']}", array( 'query' => $url['query'], 'fragment' => $fragment, 'absolute' => $absolute, - ])->toString(); + ))->toString(); } catch (Exception $e) { - // @Todo: log to watchdog - $url = ''; + \Drupal::logger('civicrm')->error($e->getMessage()); } // Special case: CiviCRM passes us "*path*?*query*" as a skeleton, but asterisks @@ -673,4 +675,88 @@ public function appendCoreResources(\Civi\Core\Event\GenericHookEvent $e) { $e->list[] = 'js/crm.drupal8.js'; } + /** + * @inheritDoc + */ + public function setUFLocale($civicrm_language) { + $langcode = substr(str_replace('_', '', $civicrm_language), 0, 2); + $languageManager = \Drupal::languageManager(); + $languages = $languageManager->getLanguages(); + + if (isset($languages[$langcode])) { + $languageManager->setConfigOverrideLanguage($languages[$langcode]); + + // Config must be re-initialized to reset the base URL + // otherwise links will have the wrong language prefix/domain. + $config = CRM_Core_Config::singleton(); + $config->free(); + + return TRUE; + } + + return FALSE; + } + + /** + * @inheritDoc + */ + public function languageNegotiationURL($url, $addLanguagePart = TRUE, $removeLanguagePart = FALSE) { + if (empty($url)) { + return $url; + } + + // Drupal might not be bootstrapped if being called by the REST API. + if (!class_exists('Drupal')) { + return NULL; + } + + $language = $this->getCurrentLanguage(); + if (\Drupal::service('module_handler')->moduleExists('language')) { + $config = \Drupal::config('language.negotiation')->get('url'); + + //does user configuration allow language + //support from the URL (Path prefix or domain) + $enabledLanguageMethods = \Drupal::config('language.types')->get('negotiation.language_interface.enabled') ?: []; + if (array_key_exists(\Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::METHOD_ID, $enabledLanguageMethods)) { + $urlType = $config['source']; + + //url prefix + if ($urlType == \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::CONFIG_PATH_PREFIX) { + if (!empty($language)) { + if ($addLanguagePart && !empty($config['prefixes'][$language])) { + $url .= $config['prefixes'][$language] . '/'; + } + if ($removeLanguagePart) { + $url = str_replace("/" . $config['prefixes'][$language] . "/", '/', $url); + } + } + } + //domain + if ($urlType == \Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl::CONFIG_DOMAIN) { + if (isset($language->domain) && $language->domain) { + if ($addLanguagePart) { + $url = (CRM_Utils_System::isSSL() ? 'https' : 'http') . '://' . $config['domains'][$language] . base_path(); + } + if ($removeLanguagePart && defined('CIVICRM_UF_BASEURL')) { + $url = str_replace('\\', '/', $url); + $parseUrl = parse_url($url); + + //kinda hackish but not sure how to do it right + //hope http_build_url() will help at some point. + if (is_array($parseUrl) && !empty($parseUrl)) { + $urlParts = explode('/', $url); + $hostKey = array_search($parseUrl['host'], $urlParts); + $ufUrlParts = parse_url(CIVICRM_UF_BASEURL); + $urlParts[$hostKey] = $ufUrlParts['host']; + $url = implode('/', $urlParts); + } + } + } + } + } + } + + return $url; + } + } diff --git a/Civi/API/Request.php b/Civi/API/Request.php index b40ece71e73d..9a101002a50f 100644 --- a/Civi/API/Request.php +++ b/Civi/API/Request.php @@ -115,4 +115,8 @@ public static function normalizeActionName($action, $version) { return strtolower(\CRM_Utils_String::munge($action)); } + public static function getNextId() { + return self::$nextId++; + } + } diff --git a/Civi/ActionSchedule/Mapping.php b/Civi/ActionSchedule/Mapping.php index 9e6dcbf91972..b0666b03ba79 100644 --- a/Civi/ActionSchedule/Mapping.php +++ b/Civi/ActionSchedule/Mapping.php @@ -149,14 +149,14 @@ public function __construct($params) { /** * Date filter -- the field name. - * @var string|NULL + * @var string|null * Ex: 'event_start_date' */ private $entity_date_start; /** * Date filter -- the field name. - * @var string|NULL + * @var string|null * Ex: 'event_end_date'. */ private $entity_date_end; diff --git a/Civi/Angular/AngularLoader.php b/Civi/Angular/AngularLoader.php index 181c8d2c9347..f74479fb4685 100644 --- a/Civi/Angular/AngularLoader.php +++ b/Civi/Angular/AngularLoader.php @@ -62,7 +62,7 @@ class AngularLoader { protected $modules; /** - * @var array|NULL + * @var array|null */ protected $crmApp = NULL; diff --git a/Civi/Angular/Manager.php b/Civi/Angular/Manager.php index f822d481d5c6..5d019a0318e4 100644 --- a/Civi/Angular/Manager.php +++ b/Civi/Angular/Manager.php @@ -14,7 +14,9 @@ class Manager { protected $res = NULL; /** - * @var array|NULL + * Modules. + * + * @var array|null * Each item has some combination of these keys: * - ext: string * The Civi extension which defines the Angular module. diff --git a/Civi/Core/SettingsBag.php b/Civi/Core/SettingsBag.php index 86d48bbb791e..d2f742ad4053 100644 --- a/Civi/Core/SettingsBag.php +++ b/Civi/Core/SettingsBag.php @@ -70,7 +70,7 @@ class SettingsBag { * The result of combining default values, mandatory * values, and user values. * - * @var array|NULL + * @var array|null * Array(string $settingName => mixed $value). */ protected $combined; diff --git a/Civi/Core/SettingsManager.php b/Civi/Core/SettingsManager.php index 1954404ca381..f88731746797 100644 --- a/Civi/Core/SettingsManager.php +++ b/Civi/Core/SettingsManager.php @@ -80,7 +80,7 @@ class SettingsManager { protected $bagsByContact = []; /** - * @var array|NULL + * @var array|null * Array(string $entity => array(string $settingName => mixed $value)). * Ex: $mandatory['domain']['uploadDir']. * NULL means "autoload from $civicrm_setting". diff --git a/Civi/Core/SettingsMetadata.php b/Civi/Core/SettingsMetadata.php index 00d04d34215c..5ff1bf3bf827 100644 --- a/Civi/Core/SettingsMetadata.php +++ b/Civi/Core/SettingsMetadata.php @@ -33,8 +33,6 @@ */ class SettingsMetadata { - const ALL = 'all'; - /** * WARNING: This interface may change. * @@ -53,6 +51,7 @@ class SettingsMetadata { * * @param array $filters * @param int $domainID + * @param bool $loadOptions * * @return array * the following information as appropriate for each setting @@ -64,37 +63,31 @@ class SettingsMetadata { * - is_contact * - description * - help_text + * - options + * - pseudoconstant */ - public static function getMetadata($filters = [], $domainID = NULL) { + public static function getMetadata($filters = [], $domainID = NULL, $loadOptions = FALSE) { if ($domainID === NULL) { $domainID = \CRM_Core_Config::domainID(); } $cache = \Civi::cache('settings'); $cacheString = 'settingsMetadata_' . $domainID . '_'; - // the caching into 'All' seems to be a duplicate of caching to - // settingsMetadata__ - I think the reason was to cache all settings as defined & then those altered by a hook $settingsMetadata = $cache->get($cacheString); - $cached = is_array($settingsMetadata); - - if (!$cached) { - $settingsMetadata = $cache->get(self::ALL); - if (empty($settingsMetadata)) { - global $civicrm_root; - $metaDataFolders = [$civicrm_root . '/settings']; - \CRM_Utils_Hook::alterSettingsFolders($metaDataFolders); - $settingsMetadata = self::loadSettingsMetaDataFolders($metaDataFolders); - $cache->set(self::ALL, $settingsMetadata); - } - } - - \CRM_Utils_Hook::alterSettingsMetaData($settingsMetadata, $domainID, NULL); - if (!$cached) { + if (!is_array($settingsMetadata)) { + global $civicrm_root; + $metaDataFolders = [$civicrm_root . '/settings']; + \CRM_Utils_Hook::alterSettingsFolders($metaDataFolders); + $settingsMetadata = self::loadSettingsMetaDataFolders($metaDataFolders); + \CRM_Utils_Hook::alterSettingsMetaData($settingsMetadata, $domainID, NULL); $cache->set($cacheString, $settingsMetadata); } self::_filterSettingsSpecification($filters, $settingsMetadata); + if ($loadOptions) { + self::loadOptions($settingsMetadata); + } return $settingsMetadata; } @@ -145,20 +138,41 @@ protected static function loadSettingsMetadata($metaDataFolder) { * Metadata to filter. */ protected static function _filterSettingsSpecification($filters, &$settingSpec) { - if (empty($filters)) { - return; - } - elseif (array_keys($filters) == ['name']) { - $settingSpec = [$filters['name'] => \CRM_Utils_Array::value($filters['name'], $settingSpec, '')]; - return; + if (!empty($filters['name'])) { + $settingSpec = array_intersect_key($settingSpec, array_flip((array) $filters['name'])); + // FIXME: This is a workaround for settingsBag::setDb() called by unit tests with settings names that don't exist + $settingSpec += array_fill_keys((array) $filters['name'], []); + unset($filters['name']); } - else { + if (!empty($filters)) { foreach ($settingSpec as $field => $fieldValues) { if (array_intersect_assoc($fieldValues, $filters) != $filters) { unset($settingSpec[$field]); } } - return; + } + } + + /** + * Retrieve options from settings metadata + * + * @param array $settingSpec + */ + protected static function loadOptions(&$settingSpec) { + foreach ($settingSpec as &$spec) { + if (empty($spec['pseudoconstant'])) { + continue; + } + // It would be nice if we could leverage CRM_Core_PseudoConstant::get() somehow, + // but it's tightly coupled to DAO/field. However, if you really need to support + // more pseudoconstant types, then probably best to refactor it. For now, KISS. + if (!empty($spec['pseudoconstant']['callback'])) { + $spec['options'] = Resolver::singleton()->call($spec['pseudoconstant']['callback'], []); + } + elseif (!empty($spec['pseudoconstant']['optionGroupName'])) { + $keyColumn = \CRM_Utils_Array::value('keyColumn', $spec['pseudoconstant'], 'value'); + $spec['options'] = \CRM_Core_OptionGroup::values($spec['pseudoconstant']['optionGroupName'], FALSE, FALSE, TRUE, NULL, 'label', TRUE, FALSE, $keyColumn); + } } } diff --git a/Civi/Core/SqlTriggers.php b/Civi/Core/SqlTriggers.php index ce54d1844899..809b2dd960e2 100644 --- a/Civi/Core/SqlTriggers.php +++ b/Civi/Core/SqlTriggers.php @@ -38,7 +38,7 @@ class SqlTriggers { /** * The name of the output file. * - * @var string|NULL + * @var string|null */ private $file = NULL; diff --git a/Civi/Test/CiviEnvBuilder.php b/Civi/Test/CiviEnvBuilder.php index 91fc4b767885..767d34033a81 100644 --- a/Civi/Test/CiviEnvBuilder.php +++ b/Civi/Test/CiviEnvBuilder.php @@ -22,7 +22,7 @@ class CiviEnvBuilder { private $steps = []; /** - * @var string|NULL + * @var string|null * A digest of the values in $steps. */ private $targetSignature = NULL; diff --git a/Civi/Test/ContactTestTrait.php b/Civi/Test/ContactTestTrait.php index 448231bb1973..7bc10624ce86 100644 --- a/Civi/Test/ContactTestTrait.php +++ b/Civi/Test/ContactTestTrait.php @@ -89,6 +89,7 @@ public function individualCreate($params = array(), $seq = 0, $random = FALSE) { * * @return int * id of Household created + * @throws \Exception */ public function householdCreate($params = array(), $seq = 0) { $params = array_merge($this->sampleContact('Household', $seq), $params); diff --git a/agpl-3.0.txt b/LICENSE similarity index 100% rename from agpl-3.0.txt rename to LICENSE diff --git a/ang/crmRouteBinder.js b/ang/crmRouteBinder.js index 0dd232dd637c..a8563fd0c1de 100644 --- a/ang/crmRouteBinder.js +++ b/ang/crmRouteBinder.js @@ -50,18 +50,18 @@ registerGlobalListener($injector); options.format = options.format || 'json'; - var fmt = formats[options.format]; + var fmt = _.clone(formats[options.format]); if (options.deep) { fmt.watcher = '$watch'; } if (options.default === undefined) { options.default = fmt.default; } - var _scope = this; + var value, + _scope = this, + $route = $injector.get('$route'), + $timeout = $injector.get('$timeout'); - var $route = $injector.get('$route'), $timeout = $injector.get('$timeout'); - - var value; if (options.param in $route.current.params) { value = fmt.decode($route.current.params[options.param]); } @@ -74,12 +74,25 @@ // Keep the URL bar up-to-date. _scope[fmt.watcher](options.expr, function (newValue) { var encValue = fmt.encode(newValue); - if ($route.current.params[options.param] === encValue) return; + if (!_.isEqual(newValue, options.default) && $route.current.params[options.param] === encValue) { + return; + } pendingUpdates = pendingUpdates || {}; pendingUpdates[options.param] = encValue; var p = angular.extend({}, $route.current.params, pendingUpdates); - angular.forEach(ignorable, function(v,k){ if (p[k] === v) delete p[k]; }); + + angular.forEach(ignorable, function(v, k) { + if (p[k] === v) { + delete p[k]; + } + }); + + // Remove params from url if they equal their defaults + if (_.isEqual(newValue, options.default)) { + p[options.param] = null; + } + $route.updateParams(p); if (activeTimer) $timeout.cancel(activeTimer); diff --git a/api/v3/Generic.php b/api/v3/Generic.php index c88419ccb40b..6dfb1c81383a 100644 --- a/api/v3/Generic.php +++ b/api/v3/Generic.php @@ -432,7 +432,7 @@ function civicrm_api3_generic_getoptions($apiRequest) { // Validate 'context' from params $context = CRM_Utils_Array::value('context', $apiRequest['params']); CRM_Core_DAO::buildOptionsContext($context); - unset($apiRequest['params']['context'], $apiRequest['params']['field']); + unset($apiRequest['params']['context'], $apiRequest['params']['field'], $apiRequest['params']['condition']); $baoName = _civicrm_api3_get_BAO($apiRequest['entity']); $options = $baoName::buildOptions($fieldName, $context, $apiRequest['params']); diff --git a/api/v3/Setting.php b/api/v3/Setting.php index e7d2338c254f..a7ce04b76fcd 100644 --- a/api/v3/Setting.php +++ b/api/v3/Setting.php @@ -148,33 +148,14 @@ function _civicrm_api3_setting_getdefaults_spec(&$params) { * @throws \API_Exception */ function civicrm_api3_setting_getoptions($params) { - $specs = CRM_Core_BAO_Setting::getSettingSpecification(); + $domainId = CRM_Utils_Array::value('domain_id', $params); + $specs = \Civi\Core\SettingsMetadata::getMetadata(['name' => $params['field']], $domainId, TRUE); - if (empty($specs[$params['field']]) || empty($specs[$params['field']]['pseudoconstant'])) { + if (empty($specs[$params['field']]) || !is_array(CRM_Utils_Array::value('options', $specs[$params['field']]))) { throw new API_Exception("The field '" . $params['field'] . "' has no associated option list."); } - $pseudoconstant = $specs[$params['field']]['pseudoconstant']; - - // It would be nice if we could leverage CRM_Core_PseudoConstant::get() somehow, - // but it's tightly coupled to DAO/field. However, if you really need to support - // more pseudoconstant types, then probably best to refactor it. For now, KISS. - if (!empty($pseudoconstant['callback'])) { - $values = Civi\Core\Resolver::singleton()->call($pseudoconstant['callback'], []); - return civicrm_api3_create_success($values, $params, 'Setting', 'getoptions'); - } - elseif (!empty($pseudoconstant['optionGroupName'])) { - $keyColumn = 'value'; - if (!empty($pseudoconstant['keyColumn'])) { - $keyColumn = $pseudoconstant['keyColumn']; - } - return civicrm_api3_create_success( - CRM_Core_OptionGroup::values($pseudoconstant['optionGroupName'], FALSE, FALSE, TRUE, NULL, 'label', TRUE, FALSE, $keyColumn), - $params, 'Setting', 'getoptions' - ); - } - - throw new API_Exception("The field '" . $params['field'] . "' uses an unsupported option list."); + return civicrm_api3_create_success($specs[$params['field']]['options'], $params, 'Setting', 'getoptions'); } /** diff --git a/bower.json b/bower.json index b970b3e9ada7..c4aaaa21526f 100644 --- a/bower.json +++ b/bower.json @@ -18,7 +18,7 @@ "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": "~1.12", + "jquery": "civicrm/jquery#1.12.4-civicrm-1.1", "jquery-ui": "~1.12", "lodash-compat": "~3.0", "google-code-prettify": "~1.0", @@ -35,6 +35,7 @@ "es6-promise": "^4.2.4" }, "resolutions": { - "angular": "~1.5.11" + "angular": "~1.5.11", + "jquery": "1.12.4-civicrm-1.1" } } diff --git a/composer.json b/composer.json index fb0a9154945f..3a3f0bbae495 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,7 @@ "psr/simple-cache": "~1.0.1", "cweagans/composer-patches": "~1.0", "pear/log": "1.13.1", - "ezyang/htmlpurifier": "4.10" + "katzien/php-mime-type": "2.1.0" }, "scripts": { "post-install-cmd": [ diff --git a/composer.lock b/composer.lock index 4e2fd42aa8fe..86281bc7f02a 100644 --- a/composer.lock +++ b/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": "93a9f686f7eb00fb9d766d262eedb09b", + "content-hash": "a786aecfcc51b68f1ebafb0f43f99d08", "packages": [ { "name": "civicrm/civicrm-cxn-rpc", @@ -226,53 +226,6 @@ "homepage": "http://code.google.com/p/phpquery/", "time": "2013-03-21T12:39:33+00:00" }, - { - "name": "ezyang/htmlpurifier", - "version": "v4.10.0", - "source": { - "type": "git", - "url": "https://github.com/ezyang/htmlpurifier.git", - "reference": "d85d39da4576a6934b72480be6978fb10c860021" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/d85d39da4576a6934b72480be6978fb10c860021", - "reference": "d85d39da4576a6934b72480be6978fb10c860021", - "shasum": "" - }, - "require": { - "php": ">=5.2" - }, - "require-dev": { - "simpletest/simpletest": "^1.1" - }, - "type": "library", - "autoload": { - "psr-0": { - "HTMLPurifier": "library/" - }, - "files": [ - "library/HTMLPurifier.composer.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Edward Z. Yang", - "email": "admin@htmlpurifier.org", - "homepage": "http://ezyang.com" - } - ], - "description": "Standards compliant HTML filter written in PHP", - "homepage": "http://htmlpurifier.org/", - "keywords": [ - "html" - ], - "time": "2018-02-23T01:58:20+00:00" - }, { "name": "guzzlehttp/guzzle", "version": "6.3.0", @@ -454,6 +407,50 @@ ], "time": "2017-03-20T17:10:46+00:00" }, + { + "name": "katzien/php-mime-type", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/katzien/PhpMimeType.git", + "reference": "159dfbdcd5906442f3dad89951127f0b9dfa3b78" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/katzien/PhpMimeType/zipball/159dfbdcd5906442f3dad89951127f0b9dfa3b78", + "reference": "159dfbdcd5906442f3dad89951127f0b9dfa3b78", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "5.*", + "satooshi/php-coveralls": "1.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "MimeType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kat Zien" + } + ], + "description": "A PHP library to detect the mime type of files.", + "homepage": "https://github.com/katzien/PhpMimeType", + "keywords": [ + "mimetype", + "php" + ], + "time": "2017-03-23T02:05:33+00:00" + }, { "name": "marcj/topsort", "version": "1.1.0", @@ -1980,16 +1977,16 @@ }, { "name": "tecnickcom/tcpdf", - "version": "6.2.13", + "version": "6.2.26", "source": { "type": "git", "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "95c5938aafe4b20df1454dbddb3e5005c0b26f64" + "reference": "367241059ca166e3a76490f4448c284e0a161f15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/95c5938aafe4b20df1454dbddb3e5005c0b26f64", - "reference": "95c5938aafe4b20df1454dbddb3e5005c0b26f64", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/367241059ca166e3a76490f4448c284e0a161f15", + "reference": "367241059ca166e3a76490f4448c284e0a161f15", "shasum": "" }, "require": { @@ -2018,13 +2015,13 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPLv3" + "LGPL-3.0" ], "authors": [ { "name": "Nicola Asuni", "email": "info@tecnick.com", - "homepage": "http://nicolaasuni.tecnick.com" + "role": "lead" } ], "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", @@ -2038,7 +2035,7 @@ "pdf417", "qrcode" ], - "time": "2017-04-26T08:14:48+00:00" + "time": "2018-10-16T17:24:05+00:00" }, { "name": "totten/ca-config", diff --git a/contributor-key.yml b/contributor-key.yml index 19ec87f44c51..53ff04dbb41e 100644 --- a/contributor-key.yml +++ b/contributor-key.yml @@ -1054,7 +1054,7 @@ - github : pfigel name : Patrick Figel - organization: GreenPeace Central and Eastern Europe + organization: Greenpeace CEE - github : philmck name : Phil McKerracher diff --git a/install/index.php b/install/index.php index c6cd5c63ba15..6eaf8a503021 100644 --- a/install/index.php +++ b/install/index.php @@ -63,14 +63,16 @@ // Set the install type // this is sent as a query string when the page is first loaded // and subsequently posted to the page as a hidden field -if (isset($_POST['civicrm_install_type'])) { +// only permit acceptable installation types to prevent issues; +$acceptableInstallTypes = ['drupal', 'wordpress', 'backdrop']; +if (isset($_POST['civicrm_install_type']) && in_array($_POST['civicrm_install_type'], $acceptableInstallTypes)) { $installType = $_POST['civicrm_install_type']; } -elseif (isset($_GET['civicrm_install_type'])) { +elseif (isset($_GET['civicrm_install_type']) && in_array(strtolower($_GET['civicrm_install_type']), $acceptableInstallTypes)) { $installType = strtolower($_GET['civicrm_install_type']); } else { - // default value if not set + // default value if not set and not an acceptable install type. $installType = "drupal"; } diff --git a/release-notes.md b/release-notes.md index caaac6a198a8..2150d478e4e4 100644 --- a/release-notes.md +++ b/release-notes.md @@ -14,6 +14,23 @@ Other resources for identifying changes are: * https://github.com/civicrm/civicrm-joomla * https://github.com/civicrm/civicrm-wordpress +## CiviCRM 5.13.4 + +Released May 15, 2019 + +- **[Security advisories](release-notes/5.3.4.md#security)** + +## CiviCRM 5.13.3 + +Released May 14, 2019 + +- **[Synopsis](release-notes/5.13.3.md#synopsis)** +- **[Features](release-notes/5.13.3.md#features)** +- **[Bugs resolved](release-notes/5.13.3.md#bugs)** +- **[Miscellany](release-notes/5.13.3.md#misc)** +- **[Credits](release-notes/5.13.3.md#credits)** +- **[Feedback](release-notes/5.13.3.md#feedback)** + ## CiviCRM 5.13.2 Released May 6, 2019 diff --git a/release-notes/5.13.3.md b/release-notes/5.13.3.md new file mode 100644 index 000000000000..c9e516212d2d --- /dev/null +++ b/release-notes/5.13.3.md @@ -0,0 +1,50 @@ +# CiviCRM 5.13.3 + +Released May 14, 2019 + +- **[Synopsis](#synopsis)** +- **[Bugs resolved](#bugs)** +- **[Credits](#credits)** +- **[Feedback](#feedback)** + +## Synopsis + +| *Does this version...?* | | +|:--------------------------------------------------------------- |:-------:| +| Fix security vulnerabilities? | no | +| Change the database schema? | no | +| Alter the API? | no | +| Require attention to configuration options? | no | +| Fix problems installing or upgrading to a previous version? | no | +| Introduce features? | no | +| **Fix bugs?** | **yes** | + +## Bugs resolved + +- **Activity Tab - Fix regression in outputting names with > 25 activities recorded" ([dev/core#942](https://lab.civicrm.org/dev/core/issues/942): + [14231](https://github.com/civicrm/civicrm-core/pull/14231))** + +- **Activity Search - Fix regression in displaying the "Activity Date" filter + ([14230](https://github.com/civicrm/civicrm-core/pull/14230))** + +- **Profile - Fix e-notice when creating or editing a profile ([dev/core#923](https://lab.civicrm.org/dev/core/issues/923): + [14229](https://github.com/civicrm/civicrm-core/pull/14229))** + +- **Menu - Fix Javascript error involving ":hover" selector ([dev/core#950](https://lab.civicrm.org/dev/core/issues/950): + [14228](https://github.com/civicrm/civicrm-core/pull/14228))** + +- **Event Search - Fix error when filtering participants by 1 event and multiple statuses ([dev/core#956](https://lab.civicrm.org/dev/core/issues/956): + [14234](https://github.com/civicrm/civicrm-core/pull/14234))** + +## Credits + +This release was developed by the following authors and reviewers: + +Wikimedia Foundation - Eileen McNaughton; Pradeep Nayak; Greenpeace CEE - Patrick Figel; +Dave D; CiviCRM - Coleman Watts; Australian Greens - Seamus Lee + +## Feedback + +These release notes are edited by Tim Otten and Andrew Hunt. If you'd like to +provide feedback on them, please login to https://chat.civicrm.org/civicrm and +contact `@agh1`. diff --git a/release-notes/5.13.4.md b/release-notes/5.13.4.md new file mode 100644 index 000000000000..bc5c34d113d8 --- /dev/null +++ b/release-notes/5.13.4.md @@ -0,0 +1,23 @@ +# CiviCRM 5.13.4 + +Released May 15, 2019 + +- **[Security advisories](#security)** +- **[Features](#features)** +- **[Bugs resolved](#bugs)** +- **[Miscellany](#misc)** +- **[Credits](#credits)** + +## Security advisories + +- **[CIVI-SA-2019-09](https://civicrm.org/advisory/civi-sa-2019-09-xxe-in-phpword)**: XXE in PHPWord +- **[CIVI-SA-2019-10](https://civicrm.org/advisory/civi-sa-2019-10-tcpdf-xss-and-rce-vulerabilities)**: TCPDF XSS and RCE vulnerabilities +- **[CIVI-SA-2019-11](https://civicrm.org/advisory/civi-sa-2019-11-jquery-objectprototype-pollution)**: jQuery Object.prototype pollution +- **[CIVI-SA-2019-12](https://civicrm.org/advisory/civi-sa-2019-12-sqli-in-country-et-al)**: SQLI in "Country", et al +- **[CIVI-SA-2019-13](https://civicrm.org/advisory/civi-sa-2019-13-harden-against-unserialize-vulnerabilities)**: Harden against unserialize vulnerabilities +- **[CIVI-SA-2019-14](https://civicrm.org/advisory/civi-sa-2019-14-sqli-in-apiv3-getoptions)**: SQLI in APIv3 GetOptions +- **[CIVI-SA-2019-15](https://civicrm.org/advisory/civi-sa-2019-15-xss-via-forged-mime-type)**: XSS via forged MIME type +- **[CIVI-SA-2019-16](https://civicrm.org/advisory/civi-sa-2019-16-sqli-in-certain-checkboxes)**: SQLI in certain checkboxes +- **[CIVI-SA-2019-17](https://civicrm.org/advisory/civi-sa-2019-17-sqli-in-manage-events)**: SQLI in "Manage Events" +- **[CIVI-SA-2019-18](https://civicrm.org/advisory/civi-sa-2019-18-xss-in-civicrm-installer)**: XSS in CiviCRM installer +- **[CIVIEXT-SA-2019-01](https://civicrm.org/advisory/civiext-sa-2019-01-multiple-security-issues-in-apiv4)**: Multiple security issues in APIv4 diff --git a/settings/Core.setting.php b/settings/Core.setting.php index 27af8a8f5b4f..cc69e3f982d7 100644 --- a/settings/Core.setting.php +++ b/settings/Core.setting.php @@ -1052,4 +1052,18 @@ 'help_text' => NULL, 'validate_callback' => 'CRM_Utils_Rule::color', ], + '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' => ts('Mime Types that can be passed as URL params'), + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => ts('Acceptable Mime Types that can be used as part of file urls'), + 'help_text' => NULL, + ], ]; diff --git a/templates/CRM/Admin/Page/Access.tpl b/templates/CRM/Admin/Page/Access.tpl index 8d4e4445a90b..275978ccf1b4 100644 --- a/templates/CRM/Admin/Page/Access.tpl +++ b/templates/CRM/Admin/Page/Access.tpl @@ -28,28 +28,14 @@

{ts 1=$docLink}ACLs (Access Control Lists) allow you control access to CiviCRM data. An ACL consists of an Operation (e.g. 'View' or 'Edit'), a set of Data that the operation can be performed on (e.g. a group of contacts), and a Role that has permission to do this operation. Refer to the %1 for more info.{/ts} {if $config->userSystem->is_drupal EQ '1'}{ts}Note that a CiviCRM ACL Role is not related to the Drupal Role.{/ts}{/if}

{ts}EXAMPLE: 'Team Leaders' (ACL Role) can 'Edit' (Operation) all contacts in the 'Active Volunteers Group' (Data).{/ts}

- {if $config->userSystem->is_drupal EQ '1'} -

{ts 1=$ufAccessURL}Use Drupal Access Control to manage basic access to CiviCRM components and menu items. Use CiviCRM ACLs to control access to specific CiviCRM contact groups. You can also configure ACLs to grant or deny access to specific Events Profiles, and/or Custom Data Fields.{/ts}

- {elseif $config->userFramework EQ 'Joomla'} -

{ts 1=$ufAccessURL 2=$jAccessParams}Use Joomla Access Control to manage basic access to CiviCRM components and menu items. Use CiviCRM ACLs to control access to specific CiviCRM contact groups. You can also configure ACLs to grant or deny access to specific Events, Profiles, and/or Custom Data Fields.{/ts}

- {elseif $config->userFramework EQ 'WordPress'} -

{ts 1=$ufAccessURL}Use WordPress Access Control to manage basic access to CiviCRM components and menu items. Use CiviCRM ACLs to control access to specific CiviCRM contact groups. You can also configure ACLs to grant or deny access to specific Events, Profiles, and/or Custom Data Fields.{/ts}

- {/if} +

{ts 1=$ufAccessURL 2=$jAccessParams 3=$config->userFramework}Use %3 Access Control to manage basic access to CiviCRM components and menu items. Use CiviCRM ACLs to control access to specific CiviCRM contact groups. You can also configure ACLs to grant or deny access to specific Events, Profiles, and/or Custom Data Fields.{/ts}

{ts 1=$config->userFramework}Note that %1 Access Control permissions take precedence over CiviCRM ACLs. If you wish to use CiviCRM ACLs, first disable the related permission in %1 Access control for a user role, and then gradually add ACLs to replace that permission for certain groups of contacts.{/ts} - {if $config->userSystem->is_drupal EQ '1'} - + - {elseif $config->userFramework EQ 'Joomla'} - - - {elseif $config->userFramework EQ 'WordPress'} - - - {/if} diff --git a/tests/phpunit/CRM/Activity/BAO/ActivityTest.php b/tests/phpunit/CRM/Activity/BAO/ActivityTest.php index f6a7fed17903..bbf70d73f68f 100644 --- a/tests/phpunit/CRM/Activity/BAO/ActivityTest.php +++ b/tests/phpunit/CRM/Activity/BAO/ActivityTest.php @@ -30,39 +30,6 @@ public function tearDown() { parent::tearDown(); } - /** - * Setup or clean up SMS tests - * @param bool $teardown - * - * @throws \CiviCRM_API3_Exception - */ - public function setupForSmsTests($teardown = FALSE) { - require_once 'CiviTest/CiviTestSMSProvider.php'; - - // Option value params for CiviTestSMSProvider - $groupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'sms_provider_name', 'id', 'name'); - $params = array( - 'option_group_id' => $groupID, - 'label' => 'unittestSMS', - 'value' => 'unit.test.sms', - 'name' => 'CiviTestSMSProvider', - 'is_default' => 1, - 'is_active' => 1, - 'version' => 3, - ); - - if ($teardown) { - // Test completed, delete provider - $providerOptionValueResult = civicrm_api3('option_value', 'get', $params); - civicrm_api3('option_value', 'delete', array('id' => $providerOptionValueResult['id'])); - return; - } - - // Create an SMS provider "CiviTestSMSProvider". Civi handles "CiviTestSMSProvider" as a special case and allows it to be instantiated - // in CRM/Sms/Provider.php even though it is not an extension. - civicrm_api3('option_value', 'create', $params); - } - /** * Test case for create() method. */ diff --git a/tests/phpunit/CRM/Contact/BAO/QueryTest.php b/tests/phpunit/CRM/Contact/BAO/QueryTest.php index d3d42b94843a..c82fd495a5e9 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTest.php @@ -19,9 +19,14 @@ public function setUp() { parent::setUp(); } + /** + * Clean up after test. + * + * @throws \Exception + */ public function tearDown() { $this->quickCleanUpFinancialEntities(); - $tablesToTruncate = array( + $tablesToTruncate = [ 'civicrm_group_contact', 'civicrm_group', 'civicrm_saved_search', @@ -29,7 +34,7 @@ public function tearDown() { 'civicrm_tag', 'civicrm_contact', 'civicrm_address', - ); + ]; $this->quickCleanup($tablesToTruncate); } @@ -44,12 +49,89 @@ public function tearDown() { * @param $full */ public function testSearch($fv, $count, $ids, $full) { - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createFlatXMLDataSet( - dirname(__FILE__) . '/queryDataset.xml' - ) - ); + $this->callAPISuccess('SavedSearch', 'create', ['form_values' => 'a:9:{s:5:"qfKey";s:32:"0123456789abcdef0123456789abcdef";s:13:"includeGroups";a:1:{i:0;s:1:"3";}s:13:"excludeGroups";a:0:{}s:11:"includeTags";a:0:{}s:11:"excludeTags";a:0:{}s:4:"task";s:2:"14";s:8:"radio_ts";s:6:"ts_all";s:14:"customSearchID";s:1:"4";s:17:"customSearchClass";s:36:"CRM_Contact_Form_Search_Custom_Group";}']); + $this->callAPISuccess('SavedSearch', 'create', ['form_values' => 'a:9:{s:5:"qfKey";s:32:"0123456789abcdef0123456789abcdef";s:13:"includeGroups";a:1:{i:0;s:1:"3";}s:13:"excludeGroups";a:0:{}s:11:"includeTags";a:0:{}s:11:"excludeTags";a:0:{}s:4:"task";s:2:"14";s:8:"radio_ts";s:6:"ts_all";s:14:"customSearchID";s:1:"4";s:17:"customSearchClass";s:36:"CRM_Contact_Form_Search_Custom_Group";}']); + + $tag7 = $this->ids['Tag'][7] = $this->tagCreate(['name' => 'Test Tag 7', 'description' => 'Test Tag 7'])['id']; + $tag9 = $this->ids['Tag'][9] = $this->tagCreate(['name' => 'Test Tag 9', 'description' => 'Test Tag 9'])['id']; + $this->tagCreate(['name' => 'Test Tag 10']); + $groups = [ + 3 => ['name' => 'Test Group 3'], + 4 => ['name' => 'Test Smart Group 4', 'saved_search_id' => 1], + 5 => ['name' => 'Test Group 5'], + 6 => ['name' => 'Test Smart Group 6', 'saved_search_id' => 2], + ]; + + foreach ($groups as $id => $group) { + $this->ids['Group'][$id] = $this->groupCreate(array_merge($group, ['title' => $group['name']])); + } + $individuals = [ + ['first_name' => 'Test', 'last_name' => 'Test Contact 9', 'gender_id' => 1, 'prefix_id' => 1, 'suffix_id' => 1], + ['first_name' => 'Test', 'last_name' => 'Test Contact 10', 'gender_id' => 2, 'prefix_id' => 2, 'suffix_id' => 2, 'api.entity_tag.create' => ['tag_id' => $tag9]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 11', 'gender_id' => 3, 'prefix_id' => 3, 'suffix_id' => 3, 'api.entity_tag.create' => ['tag_id' => $tag7]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 12', 'gender_id' => 3, 'prefix_id' => 4, 'suffix_id' => 4, 'api.entity_tag.create' => ['tag_id' => $tag9], 'api.entity_tag.create.2' => ['tag_id' => $tag7]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 13', 'gender_id' => 2, 'prefix_id' => 2, 'suffix_id' => 2], + ['first_name' => 'Test', 'last_name' => 'Test Contact 14', 'gender_id' => 3, 'prefix_id' => 4, 'suffix_id' => 4, 'api.entity_tag.create' => ['tag_id' => $tag9]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 15', 'gender_id' => 3, 'prefix_id' => 4, 'suffix_id' => 5, 'api.entity_tag.create' => ['tag_id' => $tag7]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 16', 'gender_id' => 3, 'prefix_id' => 4, 'suffix_id' => 6, 'api.entity_tag.create' => ['tag_id' => $tag9], 'api.entity_tag.create.2' => ['tag_id' => $tag7]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 17', 'gender_id' => 2, 'prefix_id' => 4, 'suffix_id' => 7], + ['first_name' => 'Test', 'last_name' => 'Test Contact 18', 'gender_id' => 2, 'prefix_id' => 4, 'suffix_id' => 4, 'api.entity_tag.create' => ['tag_id' => $tag9]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 19', 'gender_id' => 2, 'prefix_id' => 4, 'suffix_id' => 6, 'api.entity_tag.create.2' => ['tag_id' => $tag7]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 20', 'gender_id' => 1, 'prefix_id' => 4, 'suffix_id' => 6, 'api.entity_tag.create' => ['tag_id' => $tag9], 'api.entity_tag.create.2' => ['tag_id' => $tag7]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 21', 'gender_id' => 3, 'prefix_id' => 1, 'suffix_id' => 6], + ['first_name' => 'Test', 'last_name' => 'Test Contact 22', 'gender_id' => 1, 'prefix_id' => 1, 'suffix_id' => 1, 'api.entity_tag.create' => ['tag_id' => $tag9]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 23', 'gender_id' => 3, 'prefix_id' => 1, 'suffix_id' => 1, 'api.entity_tag.create' => ['tag_id' => $tag7]], + ['first_name' => 'Test', 'last_name' => 'Test Contact 24', 'gender_id' => 3, 'prefix_id' => 3, 'suffix_id' => 2, 'api.entity_tag.create' => ['tag_id' => $tag9], 'api.entity_tag.create.2' => ['tag_id' => $tag7]], + ]; + foreach ($individuals as $individual) { + $this->ids['Contact'][$individual['last_name']] = $this->individualCreate($individual); + } + $groupContacts = [ + [5 => 13], + [5 => 14], + [5 => 15], + [5 => 16], + [5 => 21], + [5 => 22], + [5 => 23], + [5 => 24], + [3 => 17], + [3 => 18], + [3 => 19], + [3 => 20], + [3 => 21], + [3 => 22], + [3 => 23], + [3 => 24], + ]; + foreach ($groupContacts as $group) { + $groupID = $this->ids['Group'][key($group)]; + $contactID = $this->ids['Contact']['Test Contact ' . reset($group)]; + $this->callAPISuccess('GroupContact', 'create', ['group_id' => $groupID, 'contact_id' => $contactID, 'status' => 'Added']); + } + + // We have migrated from a hard-coded dataset to a dynamic one but are still working with the same + // dataprovider at this stage -> wrangle. + foreach ($fv as $key => $value) { + $entity = ucfirst($key); + if (!array_key_exists($entity, $this->ids)) { + continue; + } + if (is_numeric($value)) { + $fv[$key] = $this->ids[$entity][$value]; + } + elseif (!empty($value[0])) { + foreach ($value as $index => $oldGroup) { + $fv[$key][$index] = $this->ids[$entity][$oldGroup]; + } + } + else { + foreach (array_keys($value) as $index) { + unset($fv[$key][$index]); + $fv[$key][$this->ids[$entity][$index]] = 1; + } + } + } $params = CRM_Contact_BAO_Query::convertFormValues($fv); $obj = new CRM_Contact_BAO_Query($params); @@ -60,14 +142,18 @@ public function testSearch($fv, $count, $ids, $full) { $dao = $obj->searchQuery(); - $contacts = array(); + $contacts = []; while ($dao->fetch()) { $contacts[] = $dao->contact_id; } sort($contacts, SORT_NUMERIC); - $this->assertEquals($ids, $contacts); + $expectedIDs = []; + foreach ($ids as $id) { + $expectedIDs[] = $this->ids['Contact']['Test Contact ' . $id]; + } + $this->assertEquals($expectedIDs, $contacts); } /** diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index 44505f9f462c..a453d51d754d 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -999,22 +999,6 @@ public function testActivityCreate() { $this->assertEquals("$ 200.00 - STUDENT", $activity->subject, 'Check for total amount in activity.'); } - /** - * Test checkContributeSettings. - */ - public function testCheckContributeSettings() { - $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled'); - $this->assertNull($settings); - $params = array( - 'contribution_invoice_settings' => array( - 'deferred_revenue_enabled' => '1', - ), - ); - $this->callAPISuccess('Setting', 'create', $params); - $settings = CRM_Contribute_BAO_Contribution::checkContributeSettings('deferred_revenue_enabled'); - $this->assertEquals($settings, 1, 'Check for settings has failed'); - } - /** * Test allowUpdateRevenueRecognitionDate. */ diff --git a/tests/phpunit/CRM/Dedupe/MergerTest.php b/tests/phpunit/CRM/Dedupe/MergerTest.php index 96f440873f98..78dffbff2925 100644 --- a/tests/phpunit/CRM/Dedupe/MergerTest.php +++ b/tests/phpunit/CRM/Dedupe/MergerTest.php @@ -2,27 +2,38 @@ /** * Class CRM_Dedupe_DedupeMergerTest + * * @group headless */ class CRM_Dedupe_MergerTest extends CiviUnitTestCase { protected $_groupId; - protected $_contactIds = array(); + protected $_contactIds = []; + + /** + * Tear down. + * + * @throws \Exception + */ public function tearDown() { - $this->quickCleanup(array('civicrm_contact', 'civicrm_group_contact', 'civicrm_group')); + $this->quickCleanup([ + 'civicrm_contact', + 'civicrm_group_contact', + 'civicrm_group', + ]); parent::tearDown(); } public function createDupeContacts() { // create a group to hold contacts, so that dupe checks don't consider any other contacts in the DB - $params = array( - 'name' => 'Test Dupe Merger Group', - 'title' => 'Test Dupe Merger Group', - 'domain_id' => 1, - 'is_active' => 1, + $params = [ + 'name' => 'Test Dupe Merger Group', + 'title' => 'Test Dupe Merger Group', + 'domain_id' => 1, + 'is_active' => 1, 'visibility' => 'Public Pages', - ); + ]; $result = $this->callAPISuccess('group', 'create', $params); $this->_groupId = $result['id']; @@ -41,62 +52,62 @@ public function createDupeContacts() { // will - dale - dale@example.com // will - dale - will@example.com // will - dale - will@example.com - $params = array( - array( + $params = [ + [ 'first_name' => 'robin', 'last_name' => 'hood', 'email' => 'robin@example.com', 'contact_type' => 'Individual', - ), - array( + ], + [ 'first_name' => 'robin', 'last_name' => 'hood', 'email' => 'robin@example.com', 'contact_type' => 'Individual', - ), - array( + ], + [ 'first_name' => 'robin', 'last_name' => 'hood', 'email' => 'hood@example.com', 'contact_type' => 'Individual', - ), - array( + ], + [ 'first_name' => 'robin', 'last_name' => 'dale', 'email' => 'robin@example.com', 'contact_type' => 'Individual', - ), - array( + ], + [ 'first_name' => 'little', 'last_name' => 'dale', 'email' => 'dale@example.com', 'contact_type' => 'Individual', - ), - array( + ], + [ 'first_name' => 'little', 'last_name' => 'dale', 'email' => 'dale@example.com', 'contact_type' => 'Individual', - ), - array( + ], + [ 'first_name' => 'will', 'last_name' => 'dale', 'email' => 'dale@example.com', 'contact_type' => 'Individual', - ), - array( + ], + [ 'first_name' => 'will', 'last_name' => 'dale', 'email' => 'will@example.com', 'contact_type' => 'Individual', - ), - array( + ], + [ 'first_name' => 'will', 'last_name' => 'dale', 'email' => 'will@example.com', 'contact_type' => 'Individual', - ), - ); + ], + ]; $count = 1; foreach ($params as $param) { @@ -104,11 +115,11 @@ public function createDupeContacts() { $contact = civicrm_api('contact', 'create', $param); $this->_contactIds[$count++] = $contact['id']; - $grpParams = array( + $grpParams = [ 'contact_id' => $contact['id'], - 'group_id' => $this->_groupId, - 'version' => 3, - ); + 'group_id' => $this->_groupId, + 'version' => 3, + ]; $this->callAPISuccess('group_contact', 'create', $grpParams); } } @@ -163,7 +174,7 @@ public function testBatchMergeSelectedDuplicates() { @$object->run(); // Retrieve pairs from prev next cache table - $select = array('pn.is_selected' => 'is_selected'); + $select = ['pn.is_selected' => 'is_selected']; $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($dao->id, $this->_groupId); $pnDupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, NULL, NULL, 0, 0, $select); @@ -227,7 +238,7 @@ public function testBatchMergeAllDuplicates() { @$object->run(); // Retrieve pairs from prev next cache table - $select = array('pn.is_selected' => 'is_selected'); + $select = ['pn.is_selected' => 'is_selected']; $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($dao->id, $this->_groupId); $pnDupePairs = CRM_Core_BAO_PrevNextCache::retrieve($cacheKeyString, NULL, NULL, 0, 0, $select); @@ -261,18 +272,18 @@ public function testGetCidRefs() { * @return array */ public function getHackedInCIDRef() { - return array( - 'civicrm_entity_tag' => array( + return [ + 'civicrm_entity_tag' => [ 0 => 'entity_id', - ), - ); + ], + ]; } /** * Test function that gets duplicate pairs. * - * It turns out there are 2 code paths retrieving this data so my initial focus is on ensuring - * they match. + * It turns out there are 2 code paths retrieving this data so my initial + * focus is on ensuring they match. */ public function testGetMatches() { $this->setupMatchData(); @@ -284,34 +295,40 @@ public function testGetMatches() { FALSE ); - $this->assertEquals(array( - 0 => array( + $this->assertEquals([ + 0 => [ 'srcID' => $this->contacts[1]['id'], 'srcName' => 'Mr. Mickey Mouse II', 'dstID' => $this->contacts[0]['id'], 'dstName' => 'Mr. Mickey Mouse II', 'weight' => 20, 'canMerge' => TRUE, - ), - 1 => array( + ], + 1 => [ 'srcID' => $this->contacts[3]['id'], 'srcName' => 'Mr. Minnie Mouse II', 'dstID' => $this->contacts[2]['id'], 'dstName' => 'Mr. Minnie Mouse II', 'weight' => 20, 'canMerge' => TRUE, - ), - ), $pairs); + ], + ], $pairs); } /** * Test function that gets organization pairs. * - * Note the rule will match on organization_name OR email - hence lots of matches. + * Note the rule will match on organization_name OR email - hence lots of + * matches. + * + * @throws \Exception */ public function testGetOrganizationMatches() { $this->setupMatchData(); - $ruleGroups = $this->callAPISuccessGetSingle('RuleGroup', array('contact_type' => 'Organization', 'used' => 'Supervised')); + $ruleGroups = $this->callAPISuccessGetSingle('RuleGroup', [ + 'contact_type' => 'Organization', + 'used' => 'Supervised', + ]); $pairs = CRM_Dedupe_Merger::getDuplicatePairs( $ruleGroups['id'], @@ -321,42 +338,42 @@ public function testGetOrganizationMatches() { FALSE ); - $expectedPairs = array( - 0 => array( + $expectedPairs = [ + 0 => [ 'srcID' => $this->contacts[5]['id'], 'srcName' => 'Walt Disney Ltd', 'dstID' => $this->contacts[4]['id'], 'dstName' => 'Walt Disney Ltd', 'weight' => 20, 'canMerge' => TRUE, - ), - 1 => array( + ], + 1 => [ 'srcID' => $this->contacts[7]['id'], 'srcName' => 'Walt Disney', 'dstID' => $this->contacts[6]['id'], 'dstName' => 'Walt Disney', 'weight' => 10, 'canMerge' => TRUE, - ), - 2 => array( + ], + 2 => [ 'srcID' => $this->contacts[6]['id'], 'srcName' => 'Walt Disney', 'dstID' => $this->contacts[4]['id'], 'dstName' => 'Walt Disney Ltd', 'weight' => 10, 'canMerge' => TRUE, - ), - 3 => array( + ], + 3 => [ 'srcID' => $this->contacts[6]['id'], 'srcName' => 'Walt Disney', 'dstID' => $this->contacts[5]['id'], 'dstName' => 'Walt Disney Ltd', 'weight' => 10, 'canMerge' => TRUE, - ), - ); - usort($pairs, array(__CLASS__, 'compareDupes')); - usort($expectedPairs, array(__CLASS__, 'compareDupes')); + ], + ]; + usort($pairs, [__CLASS__, 'compareDupes']); + usort($expectedPairs, [__CLASS__, 'compareDupes']); $this->assertEquals($expectedPairs, $pairs); } @@ -365,10 +382,11 @@ public function testGetOrganizationMatches() { * * @param array $a * @param array $b + * * @return int */ public static function compareDupes($a, $b) { - foreach (array('srcName', 'dstName', 'srcID', 'dstID') as $field) { + foreach (['srcName', 'dstName', 'srcID', 'dstID'] as $field) { if ($a[$field] != $b[$field]) { return ($a[$field] < $b[$field]) ? 1 : -1; } @@ -378,14 +396,22 @@ public static function compareDupes($a, $b) { /** * Test function that gets organization duplicate pairs. + * + * @throws \Exception */ public function testGetOrganizationMatchesInGroup() { $this->setupMatchData(); - $ruleGroups = $this->callAPISuccessGetSingle('RuleGroup', array('contact_type' => 'Organization', 'used' => 'Supervised')); + $ruleGroups = $this->callAPISuccessGetSingle('RuleGroup', [ + 'contact_type' => 'Organization', + 'used' => 'Supervised', + ]); - $groupID = $this->groupCreate(array('title' => 'she-mice')); + $groupID = $this->groupCreate(['title' => 'she-mice']); - $this->callAPISuccess('GroupContact', 'create', array('group_id' => $groupID, 'contact_id' => $this->contacts[4]['id'])); + $this->callAPISuccess('GroupContact', 'create', [ + 'group_id' => $groupID, + 'contact_id' => $this->contacts[4]['id'], + ]); $pairs = CRM_Dedupe_Merger::getDuplicatePairs( $ruleGroups['id'], @@ -395,26 +421,29 @@ public function testGetOrganizationMatchesInGroup() { FALSE ); - $this->assertEquals(array( - 0 => array( + $this->assertEquals([ + 0 => [ 'srcID' => $this->contacts[5]['id'], 'srcName' => 'Walt Disney Ltd', 'dstID' => $this->contacts[4]['id'], 'dstName' => 'Walt Disney Ltd', 'weight' => 20, 'canMerge' => TRUE, - ), - 1 => array( + ], + 1 => [ 'srcID' => $this->contacts[6]['id'], 'srcName' => 'Walt Disney', 'dstID' => $this->contacts[4]['id'], 'dstName' => 'Walt Disney Ltd', 'weight' => 10, 'canMerge' => TRUE, - ), - ), $pairs); + ], + ], $pairs); - $this->callAPISuccess('GroupContact', 'create', array('group_id' => $groupID, 'contact_id' => $this->contacts[5]['id'])); + $this->callAPISuccess('GroupContact', 'create', [ + 'group_id' => $groupID, + 'contact_id' => $this->contacts[5]['id'], + ]); CRM_Core_DAO::executeQuery("DELETE FROM civicrm_prevnext_cache"); $pairs = CRM_Dedupe_Merger::getDuplicatePairs( $ruleGroups['id'], @@ -424,46 +453,49 @@ public function testGetOrganizationMatchesInGroup() { FALSE ); - $this->assertEquals(array( - 0 => array( + $this->assertEquals([ + 0 => [ 'srcID' => $this->contacts[5]['id'], 'srcName' => 'Walt Disney Ltd', 'dstID' => $this->contacts[4]['id'], 'dstName' => 'Walt Disney Ltd', 'weight' => 20, 'canMerge' => TRUE, - ), - 1 => array( + ], + 1 => [ 'srcID' => $this->contacts[6]['id'], 'srcName' => 'Walt Disney', 'dstID' => $this->contacts[4]['id'], 'dstName' => 'Walt Disney Ltd', 'weight' => 10, 'canMerge' => TRUE, - ), - 2 => array( + ], + 2 => [ 'srcID' => $this->contacts[6]['id'], 'srcName' => 'Walt Disney', 'dstID' => $this->contacts[5]['id'], 'dstName' => 'Walt Disney Ltd', 'weight' => 10, 'canMerge' => TRUE, - ), - ), $pairs); + ], + ], $pairs); } /** * Test function that gets duplicate pairs. * - * It turns out there are 2 code paths retrieving this data so my initial focus is on ensuring - * they match. + * It turns out there are 2 code paths retrieving this data so my initial + * focus is on ensuring they match. */ public function testGetMatchesInGroup() { $this->setupMatchData(); - $groupID = $this->groupCreate(array('title' => 'she-mice')); + $groupID = $this->groupCreate(['title' => 'she-mice']); - $this->callAPISuccess('GroupContact', 'create', array('group_id' => $groupID, 'contact_id' => $this->contacts[3]['id'])); + $this->callAPISuccess('GroupContact', 'create', [ + 'group_id' => $groupID, + 'contact_id' => $this->contacts[3]['id'], + ]); $pairs = CRM_Dedupe_Merger::getDuplicatePairs( 1, @@ -473,16 +505,68 @@ public function testGetMatchesInGroup() { FALSE ); - $this->assertEquals(array( - 0 => array( + $this->assertEquals([ + 0 => [ 'srcID' => $this->contacts[3]['id'], 'srcName' => 'Mr. Minnie Mouse II', 'dstID' => $this->contacts[2]['id'], 'dstName' => 'Mr. Minnie Mouse II', 'weight' => 20, 'canMerge' => TRUE, - ), - ), $pairs); + ], + ], $pairs); + } + + /** + * Test the special info handling is unchanged after cleanup. + * + * Note the handling is silly - we are testing to lock in over short term + * changes not to imply any contract on the function. + */ + public function testGetRowsElementsAndInfoSpecialInfo() { + $contact1 = $this->individualCreate([ + 'preferred_communication_method' => [], + 'communication_style_id' => 'Familiar', + 'prefix_id' => 'Mrs.', + 'suffix_id' => 'III', + ]); + $contact2 = $this->individualCreate([ + 'preferred_communication_method' => [ + 'SMS', + 'Fax', + ], + 'communication_style_id' => 'Formal', + 'gender_id' => 'Female', + ]); + $rowsElementsAndInfo = CRM_Dedupe_Merger::getRowsElementsAndInfo($contact1, $contact2); + $rows = $rowsElementsAndInfo['rows']; + $this->assertEquals([ + 'main' => 'Mrs.', + 'other' => 'Mr.', + 'title' => 'Individual Prefix', + ], $rows['move_prefix_id']); + $this->assertEquals([ + 'main' => 'III', + 'other' => 'II', + 'title' => 'Individual Suffix', + ], $rows['move_suffix_id']); + $this->assertEquals([ + 'main' => '', + 'other' => 'Female', + 'title' => 'Gender', + ], $rows['move_gender_id']); + $this->assertEquals([ + 'main' => 'Familiar', + 'other' => 'Formal', + 'title' => 'Communication Style', + ], $rows['move_communication_style_id']); + $this->assertEquals(1, $rowsElementsAndInfo['migration_info']['move_communication_style_id']); + $this->assertEquals([ + 'main' => '', + 'other' => 'SMS, Fax', + 'title' => 'Preferred Communication Method', + ], $rows['move_preferred_communication_method']); + $this->assertEquals('45', $rowsElementsAndInfo['migration_info']['move_preferred_communication_method']); } /** @@ -496,7 +580,7 @@ public function testMergeMembership() { //Add Membership for the duplicate contact. $memTypeId = $this->membershipTypeCreate(); - $membership = $this->callAPISuccess('Membership', 'create', [ + $this->callAPISuccess('Membership', 'create', [ 'membership_type_id' => $memTypeId, 'contact_id' => $duplicateContactID, ]); @@ -529,7 +613,7 @@ public function testMergeMembership() { */ public function testCustomDataOverwrite() { // Create Custom Field - $createGroup = $this->setupCustomGroupForIndividual(); + $createGroup = $this->setupCustomGroupForIndividual(); $createField = $this->setupCustomField('Graduation', $createGroup); $customFieldName = "custom_" . $createField['id']; @@ -543,41 +627,41 @@ public function testCustomDataOverwrite() { $duplicateContactID2 = $this->contacts[2]['id']; // update the text custom field for original contact with value 'abc' - $this->callAPISuccess('Contact', 'create', array( + $this->callAPISuccess('Contact', 'create', [ 'id' => $originalContactID, "{$customFieldName}" => 'abc', - )); + ]); $this->assertCustomFieldValue($originalContactID, 'abc', $customFieldName); // update the text custom field for duplicate contact 1 with value 'def' - $this->callAPISuccess('Contact', 'create', array( + $this->callAPISuccess('Contact', 'create', [ 'id' => $duplicateContactID1, "{$customFieldName}" => 'def', - )); + ]); $this->assertCustomFieldValue($duplicateContactID1, 'def', $customFieldName); // update the text custom field for duplicate contact 2 with value 'ghi' - $this->callAPISuccess('Contact', 'create', array( + $this->callAPISuccess('Contact', 'create', [ 'id' => $duplicateContactID2, "{$customFieldName}" => 'ghi', - )); + ]); $this->assertCustomFieldValue($duplicateContactID2, 'ghi', $customFieldName); /*** USE-CASE 1: DO NOT OVERWRITE CUSTOM FIELD VALUE **/ - $this->mergeContacts($originalContactID, $duplicateContactID1, array( + $this->mergeContacts($originalContactID, $duplicateContactID1, [ "move_{$customFieldName}" => NULL, - )); + ]); $this->assertCustomFieldValue($originalContactID, 'abc', $customFieldName); /*** USE-CASE 2: OVERWRITE CUSTOM FIELD VALUE **/ - $this->mergeContacts($originalContactID, $duplicateContactID2, array( + $this->mergeContacts($originalContactID, $duplicateContactID2, [ "move_{$customFieldName}" => 'ghi', - )); + ]); $this->assertCustomFieldValue($originalContactID, 'ghi', $customFieldName); // cleanup created custom set - $this->callAPISuccess('CustomField', 'delete', array('id' => $createField['id'])); - $this->callAPISuccess('CustomGroup', 'delete', array('id' => $createGroup['id'])); + $this->callAPISuccess('CustomField', 'delete', ['id' => $createField['id']]); + $this->callAPISuccess('CustomGroup', 'delete', ['id' => $createGroup['id']]); } /** @@ -588,16 +672,16 @@ public function testCustomDataOverwrite() { */ public function testMigrationOfUnselectedCustomDataOnEmptyCustomRecord() { // Create Custom Fields - $createGroup = $this->setupCustomGroupForIndividual(); + $createGroup = $this->setupCustomGroupForIndividual(); $customField1 = $this->setupCustomField('TestField', $createGroup); // Create multi-value custom field $multiGroup = $this->CustomGroupMultipleCreateByParams(); - $multiField = $this->customFieldCreate(array( + $multiField = $this->customFieldCreate([ 'custom_group_id' => $multiGroup['id'], 'label' => 'field_1' . $multiGroup['id'], 'in_selector' => 1, - )); + ]); // Contacts setup $this->setupMatchData(); @@ -605,27 +689,27 @@ public function testMigrationOfUnselectedCustomDataOnEmptyCustomRecord() { $duplicateContactID = $this->contacts[1]['id']; // Update the text custom fields for duplicate contact - $this->callAPISuccess('Contact', 'create', array( + $this->callAPISuccess('Contact', 'create', [ 'id' => $duplicateContactID, "custom_{$customField1['id']}" => 'abc', "custom_{$multiField['id']}" => 'def', - )); + ]); $this->assertCustomFieldValue($duplicateContactID, 'abc', "custom_{$customField1['id']}"); $this->assertCustomFieldValue($duplicateContactID, 'def', "custom_{$multiField['id']}"); // Merge, and ensure that no value was migrated - $this->mergeContacts($originalContactID, $duplicateContactID, array( + $this->mergeContacts($originalContactID, $duplicateContactID, [ "move_custom_{$customField1['id']}" => NULL, "move_rel_table_custom_{$multiGroup['id']}" => NULL, - )); + ]); $this->assertCustomFieldValue($originalContactID, '', "custom_{$customField1['id']}"); $this->assertCustomFieldValue($originalContactID, '', "custom_{$multiField['id']}"); // cleanup created custom set - $this->callAPISuccess('CustomField', 'delete', array('id' => $customField1['id'])); - $this->callAPISuccess('CustomGroup', 'delete', array('id' => $createGroup['id'])); - $this->callAPISuccess('CustomField', 'delete', array('id' => $multiField['id'])); - $this->callAPISuccess('CustomGroup', 'delete', array('id' => $multiGroup['id'])); + $this->callAPISuccess('CustomField', 'delete', ['id' => $customField1['id']]); + $this->callAPISuccess('CustomGroup', 'delete', ['id' => $createGroup['id']]); + $this->callAPISuccess('CustomField', 'delete', ['id' => $multiField['id']]); + $this->callAPISuccess('CustomGroup', 'delete', ['id' => $multiGroup['id']]); } /** @@ -636,17 +720,17 @@ public function testMigrationOfUnselectedCustomDataOnEmptyCustomRecord() { */ public function testMigrationOfSomeCustomDataOnEmptyCustomRecord() { // Create Custom Fields - $createGroup = $this->setupCustomGroupForIndividual(); + $createGroup = $this->setupCustomGroupForIndividual(); $customField1 = $this->setupCustomField('Test1', $createGroup); $customField2 = $this->setupCustomField('Test2', $createGroup); // Create multi-value custom field $multiGroup = $this->CustomGroupMultipleCreateByParams(); - $multiField = $this->customFieldCreate(array( + $multiField = $this->customFieldCreate([ 'custom_group_id' => $multiGroup['id'], 'label' => 'field_1' . $multiGroup['id'], 'in_selector' => 1, - )); + ]); // Contacts setup $this->setupMatchData(); @@ -654,32 +738,32 @@ public function testMigrationOfSomeCustomDataOnEmptyCustomRecord() { $duplicateContactID = $this->contacts[1]['id']; // Update the text custom fields for duplicate contact - $this->callAPISuccess('Contact', 'create', array( + $this->callAPISuccess('Contact', 'create', [ 'id' => $duplicateContactID, "custom_{$customField1['id']}" => 'abc', "custom_{$customField2['id']}" => 'def', "custom_{$multiField['id']}" => 'ghi', - )); + ]); $this->assertCustomFieldValue($duplicateContactID, 'abc', "custom_{$customField1['id']}"); $this->assertCustomFieldValue($duplicateContactID, 'def', "custom_{$customField2['id']}"); $this->assertCustomFieldValue($duplicateContactID, 'ghi', "custom_{$multiField['id']}"); // Perform merge - $this->mergeContacts($originalContactID, $duplicateContactID, array( + $this->mergeContacts($originalContactID, $duplicateContactID, [ "move_custom_{$customField1['id']}" => NULL, "move_custom_{$customField2['id']}" => 'def', "move_rel_table_custom_{$multiGroup['id']}" => '1', - )); + ]); $this->assertCustomFieldValue($originalContactID, '', "custom_{$customField1['id']}"); $this->assertCustomFieldValue($originalContactID, 'def', "custom_{$customField2['id']}"); $this->assertCustomFieldValue($originalContactID, 'ghi', "custom_{$multiField['id']}"); // cleanup created custom set - $this->callAPISuccess('CustomField', 'delete', array('id' => $customField1['id'])); - $this->callAPISuccess('CustomField', 'delete', array('id' => $customField2['id'])); - $this->callAPISuccess('CustomGroup', 'delete', array('id' => $createGroup['id'])); - $this->callAPISuccess('CustomField', 'delete', array('id' => $multiField['id'])); - $this->callAPISuccess('CustomGroup', 'delete', array('id' => $multiGroup['id'])); + $this->callAPISuccess('CustomField', 'delete', ['id' => $customField1['id']]); + $this->callAPISuccess('CustomField', 'delete', ['id' => $customField2['id']]); + $this->callAPISuccess('CustomGroup', 'delete', ['id' => $createGroup['id']]); + $this->callAPISuccess('CustomField', 'delete', ['id' => $multiField['id']]); + $this->callAPISuccess('CustomGroup', 'delete', ['id' => $multiGroup['id']]); } /** @@ -692,14 +776,17 @@ public function testMigrationOfSomeCustomDataOnEmptyCustomRecord() { * @param $params * Array of fields to be merged from source into target contact, of the form * ['move_' => ] + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ private function mergeContacts($originalContactID, $duplicateContactID, $params) { $rowsElementsAndInfo = CRM_Dedupe_Merger::getRowsElementsAndInfo($originalContactID, $duplicateContactID); - $migrationData = array( + $migrationData = [ 'main_details' => $rowsElementsAndInfo['main_details'], 'other_details' => $rowsElementsAndInfo['other_details'], - ); + ]; // Migrate data of duplicate contact CRM_Dedupe_Merger::moveAllBelongings($originalContactID, $duplicateContactID, array_merge($migrationData, $params)); @@ -714,10 +801,10 @@ private function mergeContacts($originalContactID, $duplicateContactID, $params) * @param $customFieldName */ private function assertCustomFieldValue($contactID, $expectedValue, $customFieldName) { - $data = $this->callAPISuccess('Contact', 'getsingle', array( + $data = $this->callAPISuccess('Contact', 'getsingle', [ 'id' => $contactID, - 'return' => array($customFieldName), - )); + 'return' => [$customFieldName], + ]); $this->assertEquals($expectedValue, $data[$customFieldName], "Custom field value was supposed to be '{$expectedValue}', '{$data[$customFieldName]}' found."); } @@ -729,22 +816,22 @@ private function assertCustomFieldValue($contactID, $expectedValue, $customField * Data for the created custom group record */ private function setupCustomGroupForIndividual() { - $customGroup = $this->callAPISuccess('custom_group', 'get', array( + $customGroup = $this->callAPISuccess('custom_group', 'get', [ 'name' => 'test_group', - )); + ]); if ($customGroup['count'] > 0) { - $this->callAPISuccess('CustomGroup', 'delete', array('id' => $customGroup['id'])); + $this->callAPISuccess('CustomGroup', 'delete', ['id' => $customGroup['id']]); } - $customGroup = $this->callAPISuccess('custom_group', 'create', array( + $customGroup = $this->callAPISuccess('custom_group', 'create', [ 'title' => 'Test_Group', 'name' => 'test_group', - 'extends' => array('Individual'), + 'extends' => ['Individual'], 'style' => 'Inline', 'is_multiple' => FALSE, 'is_active' => 1, - )); + ]); return $customGroup; } @@ -760,65 +847,65 @@ private function setupCustomGroupForIndividual() { * Data for the created custom field record */ private function setupCustomField($fieldLabel, $createGroup) { - return $this->callAPISuccess('custom_field', 'create', array( + return $this->callAPISuccess('custom_field', 'create', [ 'label' => $fieldLabel, 'data_type' => 'Alphanumeric', 'html_type' => 'Text', 'custom_group_id' => $createGroup['id'], - )); + ]); } /** * Set up some contacts for our matching. */ public function setupMatchData() { - $fixtures = array( - array( + $fixtures = [ + [ 'first_name' => 'Mickey', 'last_name' => 'Mouse', 'email' => 'mickey@mouse.com', - ), - array( + ], + [ 'first_name' => 'Mickey', 'last_name' => 'Mouse', 'email' => 'mickey@mouse.com', - ), - array( + ], + [ 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'email' => 'mickey@mouse.com', - ), - array( + ], + [ 'first_name' => 'Minnie', 'last_name' => 'Mouse', 'email' => 'mickey@mouse.com', - ), - ); + ], + ]; foreach ($fixtures as $fixture) { $contactID = $this->individualCreate($fixture); - $this->contacts[] = array_merge($fixture, array('id' => $contactID)); + $this->contacts[] = array_merge($fixture, ['id' => $contactID]); } - $organizationFixtures = array( - array( + $organizationFixtures = [ + [ 'organization_name' => 'Walt Disney Ltd', 'email' => 'walt@disney.com', - ), - array( + ], + [ 'organization_name' => 'Walt Disney Ltd', 'email' => 'walt@disney.com', - ), - array( + ], + [ 'organization_name' => 'Walt Disney', 'email' => 'walt@disney.com', - ), - array( + ], + [ 'organization_name' => 'Walt Disney', 'email' => 'walter@disney.com', - ), - ); + ], + ]; foreach ($organizationFixtures as $fixture) { $contactID = $this->organizationCreate($fixture); - $this->contacts[] = array_merge($fixture, array('id' => $contactID)); + $this->contacts[] = array_merge($fixture, ['id' => $contactID]); } } @@ -827,203 +914,204 @@ public function setupMatchData() { * * This is a statically maintained (in this test list). * - * There is also a check against an automated list but having both seems to add extra stability to me. They do - * not change often. + * There is also a check against an automated list but having both seems to + * add extra stability to me. They do not change often. */ public function getStaticCIDRefs() { - return array( - 'civicrm_acl_cache' => array( + return [ + 'civicrm_acl_cache' => [ 0 => 'contact_id', - ), - 'civicrm_acl_contact_cache' => array( + ], + 'civicrm_acl_contact_cache' => [ 0 => 'contact_id', - ), - 'civicrm_action_log' => array( + ], + 'civicrm_action_log' => [ 0 => 'contact_id', - ), - 'civicrm_activity_contact' => array( + ], + 'civicrm_activity_contact' => [ 0 => 'contact_id', - ), - 'civicrm_address' => array( + ], + 'civicrm_address' => [ 0 => 'contact_id', - ), - 'civicrm_batch' => array( + ], + 'civicrm_batch' => [ 0 => 'created_id', 1 => 'modified_id', - ), - 'civicrm_campaign' => array( + ], + 'civicrm_campaign' => [ 0 => 'created_id', 1 => 'last_modified_id', - ), - 'civicrm_case_contact' => array( + ], + 'civicrm_case_contact' => [ 0 => 'contact_id', - ), - 'civicrm_contact' => array( + ], + 'civicrm_contact' => [ 0 => 'primary_contact_id', 1 => 'employer_id', - ), - 'civicrm_contribution' => array( + ], + 'civicrm_contribution' => [ 0 => 'contact_id', - ), - 'civicrm_contribution_page' => array( + ], + 'civicrm_contribution_page' => [ 0 => 'created_id', - ), - 'civicrm_contribution_recur' => array( + ], + 'civicrm_contribution_recur' => [ 0 => 'contact_id', - ), - 'civicrm_contribution_soft' => array( + ], + 'civicrm_contribution_soft' => [ 0 => 'contact_id', - ), - 'civicrm_custom_group' => array( + ], + 'civicrm_custom_group' => [ 0 => 'created_id', - ), - 'civicrm_dashboard_contact' => array( + ], + 'civicrm_dashboard_contact' => [ 0 => 'contact_id', - ), - 'civicrm_dedupe_exception' => array( + ], + 'civicrm_dedupe_exception' => [ 0 => 'contact_id1', 1 => 'contact_id2', - ), - 'civicrm_domain' => array( + ], + 'civicrm_domain' => [ 0 => 'contact_id', - ), - 'civicrm_email' => array( + ], + 'civicrm_email' => [ 0 => 'contact_id', - ), - 'civicrm_event' => array( + ], + 'civicrm_event' => [ 0 => 'created_id', - ), - 'civicrm_event_carts' => array( + ], + 'civicrm_event_carts' => [ 0 => 'user_id', - ), - 'civicrm_financial_account' => array( + ], + 'civicrm_financial_account' => [ 0 => 'contact_id', - ), - 'civicrm_financial_item' => array( + ], + 'civicrm_financial_item' => [ 0 => 'contact_id', - ), - 'civicrm_grant' => array( + ], + 'civicrm_grant' => [ 0 => 'contact_id', - ), - 'civicrm_group' => array( + ], + 'civicrm_group' => [ 0 => 'created_id', 1 => 'modified_id', - ), - 'civicrm_group_contact' => array( + ], + 'civicrm_group_contact' => [ 0 => 'contact_id', - ), - 'civicrm_group_contact_cache' => array( + ], + 'civicrm_group_contact_cache' => [ 0 => 'contact_id', - ), - 'civicrm_group_organization' => array( + ], + 'civicrm_group_organization' => [ 0 => 'organization_id', - ), - 'civicrm_im' => array( + ], + 'civicrm_im' => [ 0 => 'contact_id', - ), - 'civicrm_log' => array( + ], + 'civicrm_log' => [ 0 => 'modified_id', - ), - 'civicrm_mailing' => array( + ], + 'civicrm_mailing' => [ 0 => 'created_id', 1 => 'scheduled_id', 2 => 'approver_id', - ), - 'civicrm_file' => array( + ], + 'civicrm_file' => [ 'created_id', - ), - 'civicrm_mailing_abtest' => array( + ], + 'civicrm_mailing_abtest' => [ 0 => 'created_id', - ), - 'civicrm_mailing_event_queue' => array( + ], + 'civicrm_mailing_event_queue' => [ 0 => 'contact_id', - ), - 'civicrm_mailing_event_subscribe' => array( + ], + 'civicrm_mailing_event_subscribe' => [ 0 => 'contact_id', - ), - 'civicrm_mailing_recipients' => array( + ], + 'civicrm_mailing_recipients' => [ 0 => 'contact_id', - ), - 'civicrm_membership' => array( + ], + 'civicrm_membership' => [ 0 => 'contact_id', - ), - 'civicrm_membership_log' => array( + ], + 'civicrm_membership_log' => [ 0 => 'modified_id', - ), - 'civicrm_membership_type' => array( + ], + 'civicrm_membership_type' => [ 0 => 'member_of_contact_id', - ), - 'civicrm_note' => array( + ], + 'civicrm_note' => [ 0 => 'contact_id', - ), - 'civicrm_openid' => array( + ], + 'civicrm_openid' => [ 0 => 'contact_id', - ), - 'civicrm_participant' => array( + ], + 'civicrm_participant' => [ 0 => 'contact_id', //CRM-16761 1 => 'transferred_to_contact_id', - ), - 'civicrm_payment_token' => array( + ], + 'civicrm_payment_token' => [ 0 => 'contact_id', 1 => 'created_id', - ), - 'civicrm_pcp' => array( + ], + 'civicrm_pcp' => [ 0 => 'contact_id', - ), - 'civicrm_phone' => array( + ], + 'civicrm_phone' => [ 0 => 'contact_id', - ), - 'civicrm_pledge' => array( + ], + 'civicrm_pledge' => [ 0 => 'contact_id', - ), - 'civicrm_print_label' => array( + ], + 'civicrm_print_label' => [ 0 => 'created_id', - ), - 'civicrm_relationship' => array( + ], + 'civicrm_relationship' => [ 0 => 'contact_id_a', 1 => 'contact_id_b', - ), - 'civicrm_report_instance' => array( + ], + 'civicrm_report_instance' => [ 0 => 'created_id', 1 => 'owner_id', - ), - 'civicrm_setting' => array( + ], + 'civicrm_setting' => [ 0 => 'contact_id', 1 => 'created_id', - ), - 'civicrm_subscription_history' => array( + ], + 'civicrm_subscription_history' => [ 0 => 'contact_id', - ), - 'civicrm_survey' => array( + ], + 'civicrm_survey' => [ 0 => 'created_id', 1 => 'last_modified_id', - ), - 'civicrm_tag' => array( + ], + 'civicrm_tag' => [ 0 => 'created_id', - ), - 'civicrm_uf_group' => array( + ], + 'civicrm_uf_group' => [ 0 => 'created_id', - ), - 'civicrm_uf_match' => array( + ], + 'civicrm_uf_match' => [ 0 => 'contact_id', - ), - 'civicrm_value_testgetcidref_1' => array( + ], + 'civicrm_value_testgetcidref_1' => [ 0 => 'entity_id', - ), - 'civicrm_website' => array( + ], + 'civicrm_website' => [ 0 => 'contact_id', - ), - ); + ], + ]; } /** * Get a list of CIDs that is calculated off the schema. * - * Note this is an expensive and table locking query. Should be safe in tests though. + * Note this is an expensive and table locking query. Should be safe in tests + * though. */ public function getCalculatedCIDRefs() { - $cidRefs = array(); + $cidRefs = []; $sql = " SELECT table_name, diff --git a/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php b/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php index aa4cd9e4313a..9e70d946bfb8 100644 --- a/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php +++ b/tests/phpunit/CRM/Event/BAO/AdditionalPaymentTest.php @@ -214,20 +214,23 @@ public function testTransactionInfo() { $result = $this->addParticipantWithPayment($feeAmt, $amtPaid); $contributionID = $result['contribution']['id']; - //Complete the partial payment. - $submittedValues = array( + $this->callAPISuccess('Payment', 'create', [ + 'contribution_id' => $contributionID, 'total_amount' => 20, 'payment_instrument_id' => 3, - ); - CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionID, $submittedValues, 'owed', $result['participant']['id']); + 'participant_id' => $result['participant']['id'], + ]); //Change selection to a lower amount. $params['price_2'] = 50; CRM_Price_BAO_LineItem::changeFeeSelections($params, $result['participant']['id'], 'participant', $contributionID, $result['feeBlock'], $result['lineItem']); - //Record a refund of the remaining amount. - $submittedValues['total_amount'] = 50; - CRM_Contribute_BAO_Contribution::recordAdditionalPayment($contributionID, $submittedValues, 'refund', $result['participant']['id']); + $this->callAPISuccess('Payment', 'create', [ + 'total_amount' => -50, + 'contribution_id' => $contributionID, + 'participant_id' => $result['participant']['id'], + 'payment_instrument_id' => 3, + ]); $paymentInfo = CRM_Contribute_BAO_Contribution::getPaymentInfo($result['participant']['id'], 'event', TRUE); $transaction = $paymentInfo['transaction']; diff --git a/tests/phpunit/CRM/Event/BAO/ChangeFeeSelectionTest.php b/tests/phpunit/CRM/Event/BAO/ChangeFeeSelectionTest.php index a2fc34fbbcef..047fcb652d6a 100644 --- a/tests/phpunit/CRM/Event/BAO/ChangeFeeSelectionTest.php +++ b/tests/phpunit/CRM/Event/BAO/ChangeFeeSelectionTest.php @@ -308,12 +308,12 @@ public function testCRM20611() { $contributionBalance = ($this->_cheapFee - $actualPaidAmount); $this->assertEquals($contributionBalance, CRM_Contribute_BAO_Contribution::getContributionBalance($this->_contributionId)); - //Complete the refund payment. - $submittedValues = array( - 'total_amount' => 120, + $this->callAPISuccess('Payment', 'create', [ + 'contribution_id' => $this->_contributionId, + 'total_amount' => -120, 'payment_instrument_id' => 3, - ); - CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $submittedValues, 'refund', $this->_participantId); + 'participant_id' => $this->_participantId, + ]); $contributionBalance += 120; $this->assertEquals($contributionBalance, CRM_Contribute_BAO_Contribution::getContributionBalance($this->_contributionId)); diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php index 6f2851a98af3..1bd7a387e1de 100644 --- a/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialAccountTest.php @@ -275,8 +275,8 @@ public function testValidateFinancialAccount() { * Test for validating financial type has deferred revenue account relationship. */ public function testcheckFinancialTypeHasDeferred() { - Civi::settings()->set('contribution_invoice_settings', array('deferred_revenue_enabled' => '1')); - $params = array(); + Civi::settings()->set('deferred_revenue_enabled', 1); + $params = []; $valid = CRM_Financial_BAO_FinancialAccount::checkFinancialTypeHasDeferred($params); $this->assertFalse($valid, "This should have been false"); $cid = $this->individualCreate(); diff --git a/tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php b/tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php index 74dbaca6ab43..a990e124fced 100644 --- a/tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php +++ b/tests/phpunit/CRM/Upgrade/Incremental/BaseTest.php @@ -151,6 +151,8 @@ public function testRenameField() { /** * Test renaming multiple fields. + * + * @throws Exception */ public function testRenameFields() { $this->callAPISuccess('SavedSearch', 'create', [ @@ -169,4 +171,15 @@ public function testRenameFields() { $this->assertEquals('activity_date_time_relative', $savedSearch['form_values'][1][0]); } + /** + * Test that a mis-saved variable in 'contribute settings' can be converted to a + * 'proper' setting. + */ + public function testConvertUpgradeContributeSettings() { + Civi::settings()->set('contribution_invoice_settings', ['foo' => 'bar', 'deferred_revenue_enabled' => 1]); + $this->assertEquals(0, Civi::settings()->get('deferred_revenue_enabled')); + CRM_Upgrade_Incremental_Base::updateContributeSettings(NULL, 5.1); + $this->assertEquals(1, Civi::settings()->get('deferred_revenue_enabled')); + } + } diff --git a/tests/phpunit/CRM/Utils/DeprecatedUtilsTest.php b/tests/phpunit/CRM/Utils/DeprecatedUtilsTest.php index 9c7277504c36..e202473a214b 100644 --- a/tests/phpunit/CRM/Utils/DeprecatedUtilsTest.php +++ b/tests/phpunit/CRM/Utils/DeprecatedUtilsTest.php @@ -38,28 +38,17 @@ public function testCheckParamsWithNoContactType() { * and request the error in array format */ public function testCheckParamsWithDuplicateContact2() { - // Insert a row in civicrm_contact creating individual contact - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/../../api/v3/dataset/contact_17.xml' - ) - ); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/../../api/v3/dataset/email_contact_17.xml' - ) - ); + $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact', 'email' => 'TestContact@example.com']); - $params = array( + $params = [ 'first_name' => 'Test', 'last_name' => 'Contact', 'email' => 'TestContact@example.com', 'contact_type' => 'Individual', - ); + ]; $contact = _civicrm_api3_deprecated_contact_check_params($params, TRUE); $this->assertEquals(1, $contact['is_error']); - $this->assertRegexp("/matching contacts.*17/s", + $this->assertRegexp("/matching contacts.*1/s", $contact['error_message']['message'] ); } diff --git a/tests/phpunit/CRM/Utils/FileTest.php b/tests/phpunit/CRM/Utils/FileTest.php index f52784ae4fb2..692bbee80380 100644 --- a/tests/phpunit/CRM/Utils/FileTest.php +++ b/tests/phpunit/CRM/Utils/FileTest.php @@ -95,4 +95,39 @@ public function testFileNameValid($fileName, $expectedResult) { $this->assertEquals($expectedResult, CRM_Utils_File::isValidFileName($fileName)); } + public function pathToFileExtension() { + $cases = []; + $cases[] = ['/evil.pdf', 'pdf']; + $cases[] = ['/helloworld.jpg', 'jpg']; + $cases[] = ['/smartwatch_1736683_1280_9af3657015e8660cc234eb1601da871.jpg', 'jpg']; + return $cases; + } + + /** + * Test returning appropriate file extension + * @dataProvider pathToFileExtension + * @param string $path + * @param string $expectedExtension + */ + public function testPathToExtension($path, $expectedExtension) { + $this->assertEquals($expectedExtension, CRM_Utils_File::getExtensionFromPath($path)); + } + + public function mimeTypeToExtension() { + $cases = []; + $cases[] = ['text/plain', ['txt', 'text', 'conf', 'def', 'list', 'log', 'in']]; + $cases[] = ['image/jpeg', ['jpeg', 'jpg', 'jpe']]; + $cases[] = ['image/png', ['png']]; + return $cases; + } + + /** + * @dataProvider mimeTypeToExtension + * @param stirng $mimeType + * @param array $expectedExtensions + */ + public function testMimeTypeToExtension($mimeType, $expectedExtensions) { + $this->assertEquals($expectedExtensions, CRM_Utils_File::getAcceptableExtensionsForMimeType($mimeType)); + } + } diff --git a/tests/phpunit/CRMTraits/Custom/CustomDataTrait.php b/tests/phpunit/CRMTraits/Custom/CustomDataTrait.php new file mode 100644 index 000000000000..8ff45ac8531c --- /dev/null +++ b/tests/phpunit/CRMTraits/Custom/CustomDataTrait.php @@ -0,0 +1,141 @@ + 'Custom Group', + 'extends' => [$this->entity], + 'weight' => 5, + 'style' => 'Inline', + 'max_multiple' => 0, + ], $params); + $this->ids['CustomGroup'][$params['title']] = $this->callAPISuccess('CustomGroup', 'create', $params)['id']; + return $this->ids['CustomGroup'][$params['title']]; + } + + /** + * @return array + */ + public function createCustomFieldsOfAllTypes() { + $customGroupID = $this->ids['CustomGroup']['Custom Group']; + $ids = []; + $params = [ + 'custom_group_id' => $customGroupID, + 'label' => 'Enter text here', + 'html_type' => 'Text', + 'data_type' => 'String', + 'default_value' => 'xyz', + 'weight' => 1, + 'is_required' => 1, + ]; + + $customField = $this->callAPISuccess('CustomField', 'create', $params); + $ids[] = $customField['id']; + + $optionValue[] = [ + 'label' => 'Red', + 'value' => 'R', + 'weight' => 1, + 'is_active' => 1, + ]; + $optionValue[] = [ + 'label' => 'Yellow', + 'value' => 'Y', + 'weight' => 2, + 'is_active' => 1, + ]; + $optionValue[] = [ + 'label' => 'Green', + 'value' => 'G', + 'weight' => 3, + 'is_active' => 1, + ]; + + $params = [ + 'label' => 'Pick Color', + 'html_type' => 'Select', + 'data_type' => 'String', + 'weight' => 2, + 'is_required' => 1, + 'is_searchable' => 0, + 'is_active' => 1, + 'option_values' => $optionValue, + 'custom_group_id' => $customGroupID, + ]; + + $customField = $this->callAPISuccess('custom_field', 'create', $params); + $ids[] = $customField['id']; + + $params = [ + 'custom_group_id' => $customGroupID, + 'name' => 'test_date', + 'label' => 'test_date', + 'html_type' => 'Select Date', + 'data_type' => 'Date', + 'default_value' => '20090711', + 'weight' => 3, + 'is_required' => 1, + 'is_searchable' => 0, + 'is_active' => 1, + ]; + + $customField = $this->callAPISuccess('custom_field', 'create', $params); + + $ids[] = $customField['id']; + $params = [ + 'custom_group_id' => $customGroupID, + 'name' => 'test_link', + 'label' => 'test_link', + 'html_type' => 'Link', + 'data_type' => 'Link', + 'default_value' => 'http://civicrm.org', + 'weight' => 4, + 'is_required' => 1, + 'is_searchable' => 0, + 'is_active' => 1, + ]; + + $customField = $this->callAPISuccess('custom_field', 'create', $params); + $ids[] = $customField['id']; + return $ids; + } + +} diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 39b9811ea8a6..73b9f178f6a9 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -62,7 +62,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { /** * Database has been initialized. * - * @var boolean + * @var bool */ private static $dbInit = FALSE; @@ -92,7 +92,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { protected $tempDirs; /** - * @var boolean populateOnce allows to skip db resets in setUp + * @var bool populateOnce allows to skip db resets in setUp * * WARNING! USE WITH CAUTION - IT'LL RENDER DATA DEPENDENCIES * BETWEEN TESTS WHEN RUN IN SUITE. SUITABLE FOR LOCAL, LIMITED @@ -105,7 +105,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { public static $populateOnce = FALSE; /** - * @var boolean DBResetRequired allows skipping DB reset + * @var bool DBResetRequired allows skipping DB reset * in specific test case. If you still need * to reset single test (method) of such case, call * $this->cleanDB() in the first line of this @@ -118,6 +118,16 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { */ private $tx = NULL; + /** + * Array of IDs created to support the test. + * + * e.g + * $this->ids = ['Contact' => ['descriptive_key' => $contactID], 'Group' => [$groupID]]; + * + * @var array + */ + protected $ids = []; + /** * Class used for hooks during tests. * @@ -321,6 +331,12 @@ protected function setUp() { // disable any left-over test extensions CRM_Core_DAO::executeQuery('DELETE FROM civicrm_extension WHERE full_name LIKE "test.%"'); + $extensions = \CRM_Extension_System::singleton()->getManager(); + $api4Status = $extensions->getStatus('org.civicrm.api4'); + if ($api4Status != $extensions::STATUS_INSTALLED && $api4Status != $extensions::STATUS_UNKNOWN) { + $extensions->enable(['org.civicrm.api4']); + } + // reset all the caches CRM_Utils_System::flushCache(); @@ -357,14 +373,6 @@ public function loadAllFixtures() { $this->getConnection()->getConnection()->query("SET FOREIGN_KEY_CHECKS = 0;"); - $xmlFiles = glob($fixturesDir . '/*.xml'); - foreach ($xmlFiles as $xmlFixture) { - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $dataset = $this->createXMLDataSet($xmlFixture); - $this->_tablesToTruncate = array_merge($this->_tablesToTruncate, $dataset->getTableNames()); - $op->execute($this->_dbconn, $dataset); - } - $yamlFiles = glob($fixturesDir . '/*.yaml'); foreach ($yamlFiles as $yamlFixture) { $op = new PHPUnit_Extensions_Database_Operation_Insert(); @@ -1942,13 +1950,13 @@ public function unsetExtensionSystem() { * @return void */ public function setMockSettingsMetaData($extras) { - Civi::service('settings_manager')->flush(); - CRM_Utils_Hook::singleton() ->setHook('civicrm_alterSettingsMetaData', function (&$metadata, $domainId, $profile) use ($extras) { $metadata = array_merge($metadata, $extras); }); + Civi::service('settings_manager')->flush(); + $fields = $this->callAPISuccess('setting', 'getfields', array()); foreach ($extras as $key => $spec) { $this->assertNotEmpty($spec['title']); @@ -3150,4 +3158,37 @@ public function enableMultilingual() { $dbLocale = '_en_US'; } + /** + * Setup or clean up SMS tests + * @param bool $teardown + * + * @throws \CiviCRM_API3_Exception + */ + public function setupForSmsTests($teardown = FALSE) { + require_once 'CiviTest/CiviTestSMSProvider.php'; + + // Option value params for CiviTestSMSProvider + $groupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'sms_provider_name', 'id', 'name'); + $params = array( + 'option_group_id' => $groupID, + 'label' => 'unittestSMS', + 'value' => 'unit.test.sms', + 'name' => 'CiviTestSMSProvider', + 'is_default' => 1, + 'is_active' => 1, + 'version' => 3, + ); + + if ($teardown) { + // Test completed, delete provider + $providerOptionValueResult = civicrm_api3('option_value', 'get', $params); + civicrm_api3('option_value', 'delete', array('id' => $providerOptionValueResult['id'])); + return; + } + + // Create an SMS provider "CiviTestSMSProvider". Civi handles "CiviTestSMSProvider" as a special case and allows it to be instantiated + // in CRM/Sms/Provider.php even though it is not an extension. + return civicrm_api3('option_value', 'create', $params); + } + } diff --git a/tests/phpunit/api/v3/AddressTest.php b/tests/phpunit/api/v3/AddressTest.php index bbbc21cf9a7d..308b012d60e9 100644 --- a/tests/phpunit/api/v3/AddressTest.php +++ b/tests/phpunit/api/v3/AddressTest.php @@ -479,4 +479,47 @@ public function testCreateAddressSymbolicCountryAndState($inputCountry, $inputSt $this->assertEquals($expectState, $created['state_province_id']); } + public function testBuildStateProvinceOptionsWithDodgyProvinceLimit() { + $provinceLimit = [1228, "abcd;ef"]; + $this->callAPISuccess('setting', 'create', [ + 'provinceLimit' => $provinceLimit, + ]); + $result = $this->callAPIFailure('address', 'getoptions', ['field' => 'state_province_id']); + // confirm that we hit our error not a SQLI. + $this->assertEquals('Province limit or default country setting is incorrect', $result['error_message']); + $this->callAPISuccess('setting', 'create', [ + 'provinceLimit' => [1228], + ]); + // Now confirm with a correct province setting it works fine + $this->callAPISuccess('address', 'getoptions', ['field' => 'state_province_id']); + } + + public function testBuildCountryWithDodgyCountryLimitSetting() { + $countryLimit = [1228, "abcd;ef"]; + $this->callAPISuccess('setting', 'create', [ + 'countryLimit' => $countryLimit, + ]); + $result = $this->callAPIFailure('address', 'getoptions', ['field' => 'country_id']); + // confirm that we hit our error not a SQLI. + $this->assertEquals('Available Country setting is incorrect', $result['error_message']); + $this->callAPISuccess('setting', 'create', [ + 'countryLimit' => [1228], + ]); + // Now confirm with a correct province setting it works fine + $this->callAPISuccess('address', 'getoptions', ['field' => 'country_id']); + } + + public function testBuildCountyWithDodgeStateProvinceFiltering() { + $result = $this->callAPIFailure('Address', 'getoptions', [ + 'field' => 'county_id', + 'state_province_id' => "abcd;ef", + ]); + $this->assertEquals('Can only accept Integers for state_province_id filtering', $result['error_message']); + $goodResult = $this->callAPISuccess('Address', 'getoptions', [ + 'field' => 'county_id', + 'state_province_id' => 1004, + ]); + $this->assertEquals('San Francisco', $goodResult['values'][4]); + } + } diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php index 818068d0363a..d0d5ed746667 100644 --- a/tests/phpunit/api/v3/ContactTest.php +++ b/tests/phpunit/api/v3/ContactTest.php @@ -1479,16 +1479,10 @@ public function testCreateHouseholdInadequateDetails() { * Verify successful update of individual contact. */ public function testUpdateIndividualWithAll() { - // Insert a row in civicrm_contact creating individual contact. - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/contact_ind.xml' - ) - ); + $contactID = $this->individualCreate(); - $params = array( - 'id' => 23, + $params = [ + 'id' => $contactID, 'first_name' => 'abcd', 'contact_type' => 'Individual', 'nick_name' => 'This is nickname first', @@ -1500,8 +1494,7 @@ public function testUpdateIndividualWithAll() { 'external_identifier' => '1928837465', 'image_URL' => 'http://some.url.com/image.jpg', 'home_url' => 'http://www.example.org', - - ); + ]; $this->callAPISuccess('Contact', 'Update', $params); $getResult = $this->callAPISuccess('Contact', 'Get', $params); @@ -1510,50 +1503,28 @@ public function testUpdateIndividualWithAll() { //reducing this test partially back to api v2 level to get it through unset($params['home_url']); foreach ($params as $key => $value) { - $this->assertEquals($value, $getResult['values'][23][$key]); + $this->assertEquals($value, $getResult['values'][$contactID][$key]); } - // Check updated civicrm_contact against expected. - $expected = $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/contact_ind_upd.xml' - ); - $actual = new PHPUnit_Extensions_Database_DataSet_QueryDataSet( - $this->_dbconn - ); - $actual->addTable('civicrm_contact'); - $expected->matches($actual); } /** * Verify successful update of organization contact. + * + * @throws \Exception */ public function testUpdateOrganizationWithAll() { - // Insert a row in civicrm_contact creating organization contact - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/contact_org.xml' - ) - ); + $contactID = $this->organizationCreate(); - $params = array( - 'id' => 24, + $params = [ + 'id' => $contactID, 'organization_name' => 'WebAccess India Pvt Ltd', 'legal_name' => 'WebAccess', 'sic_code' => 'ABC12DEF', 'contact_type' => 'Organization', - ); + ]; $this->callAPISuccess('Contact', 'Update', $params); - - // Check updated civicrm_contact against expected. - $expected = $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/contact_org_upd.xml' - ); - $actual = new PHPUnit_Extensions_Database_DataSet_QueryDataSet( - $this->_dbconn - ); - $actual->addTable('civicrm_contact'); - $expected->matches($actual); + $this->getAndCheck($params, $contactID, 'Contact'); } /** @@ -1629,30 +1600,24 @@ private function createEmployerOfMembership() { * Verify successful update of household contact. */ public function testUpdateHouseholdWithAll() { - // Insert a row in civicrm_contact creating household contact - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/contact_hld.xml' - ) - ); + $contactID = $this->householdCreate(); - $params = array( - 'id' => 25, + $params = [ + 'id' => $contactID , 'household_name' => 'ABC household', 'nick_name' => 'ABC House', 'contact_type' => 'Household', - ); + ]; $result = $this->callAPISuccess('Contact', 'Update', $params); - $expected = array( + $expected = [ 'contact_type' => 'Household', 'is_opt_out' => 0, 'sort_name' => 'ABC household', 'display_name' => 'ABC household', 'nick_name' => 'ABC House', - ); + ]; $this->getAndCheck($expected, $result['id'], 'contact'); } @@ -1664,20 +1629,12 @@ public function testUpdateHouseholdWithAll() { * CRM-7645. */ public function testUpdateCreateWithID() { - // Insert a row in civicrm_contact creating individual contact. - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/contact_ind.xml' - ) - ); - - $params = array( - 'id' => 23, + $contactID = $this->individualCreate(); + $this->callAPISuccess('Contact', 'Update', [ + 'id' => $contactID, 'first_name' => 'abcd', 'last_name' => 'wxyz', - ); - $this->callAPISuccess('Contact', 'Update', $params); + ]); } /** @@ -1788,55 +1745,31 @@ public function testContactGetRetDefault() { * Test civicrm_contact_getquick() with empty name param. */ public function testContactGetQuick() { - // Insert a row in civicrm_contact creating individual contact. - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/contact_17.xml' - ) - ); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/email_contact_17.xml' - ) - ); - $params = array( - 'name' => "T", - ); + $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact', 'email' => 'TestContact@example.com']); - $result = $this->callAPISuccess('contact', 'getquick', $params); - $this->assertEquals(17, $result['values'][0]['id']); - $params = array( + $result = $this->callAPISuccess('contact', 'getquick', ['name' => 'T']); + $this->assertEquals($contactID, $result['values'][0]['id']); + $params = [ 'name' => "TestContact@example.com", 'field_name' => 'sort_name', - ); + ]; $result = $this->callAPISuccess('contact', 'getquick', $params); - $this->assertEquals(17, $result['values'][0]['id']); + $this->assertEquals($contactID, $result['values'][0]['id']); } /** * Test civicrm_contact_get) with empty params. */ public function testContactGetEmptyParams() { - $this->callAPISuccess('contact', 'get', array()); + $this->callAPISuccess('contact', 'get', []); } /** * Test civicrm_contact_get(,true) with no matches. */ public function testContactGetOldParamsNoMatches() { - // Insert a row in civicrm_contact creating contact 17. - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/contact_17.xml' - ) - ); - - $params = array( - 'first_name' => 'Fred', - ); - $result = $this->callAPISuccess('contact', 'get', $params); + $this->individualCreate(); + $result = $this->callAPISuccess('contact', 'get', ['first_name' => 'Fred']); $this->assertEquals(0, $result['count']); } @@ -1844,19 +1777,11 @@ public function testContactGetOldParamsNoMatches() { * Test civicrm_contact_get(,true) with one match. */ public function testContactGetOldParamsOneMatch() { - // Insert a row in civicrm_contact creating contact 17 - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet(dirname(__FILE__) . '/dataset/contact_17.xml' - ) - ); + $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']); - $params = array( - 'first_name' => 'Test', - ); - $result = $this->callAPISuccess('contact', 'get', $params); - $this->assertEquals(17, $result['values'][17]['contact_id']); - $this->assertEquals(17, $result['id']); + $result = $this->callAPISuccess('contact', 'get', ['first_name' => 'Test']); + $this->assertEquals($contactID, $result['values'][$contactID]['contact_id']); + $this->assertEquals($contactID, $result['id']); } /** @@ -2488,11 +2413,11 @@ public function testChainingValuesCreate() { * Test TrueFalse format - I couldn't come up with an easy way to get an error on Get. */ public function testContactGetFormatIsSuccessTrue() { - $this->createContactFromXML(); + $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']); $description = "This demonstrates use of the 'format.is_success' param. This param causes only the success or otherwise of the function to be returned as BOOLEAN"; $subfile = "FormatIsSuccess_True"; - $params = array('id' => 17, 'format.is_success' => 1); + $params = ['id' => $contactID, 'format.is_success' => 1]; $result = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile); $this->assertEquals(1, $result); $this->callAPISuccess('Contact', 'Delete', $params); @@ -2562,25 +2487,24 @@ public function killTheJusticeLeague($op, $entity, $id, &$params) { * Test Single Entity format. */ public function testContactGetSingleEntityArray() { - $this->createContactFromXML(); + $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']); $description = "This demonstrates use of the 'format.single_entity_array' param. This param causes the only contact to be returned as an array without the other levels. It will be ignored if there is not exactly 1 result"; $subfile = "GetSingleContact"; - $params = array('id' => 17); - $result = $this->callAPIAndDocument('Contact', 'GetSingle', $params, __FUNCTION__, __FILE__, $description, $subfile); - $this->assertEquals('Test Contact', $result['display_name']); - $this->callAPISuccess('Contact', 'Delete', $params); + $result = $this->callAPIAndDocument('Contact', 'GetSingle', ['id' => $contactID], __FUNCTION__, __FILE__, $description, $subfile); + $this->assertEquals('Mr. Test Contact II', $result['display_name']); + $this->callAPISuccess('Contact', 'Delete', ['id' => $contactID]); } /** * Test Single Entity format. */ public function testContactGetFormatCountOnly() { - $this->createContactFromXML(); + $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']); $description = "This demonstrates use of the 'getCount' action. This param causes the count of the only function to be returned as an integer."; - $params = array('id' => 17); + $params = ['id' => $contactID]; $result = $this->callAPIAndDocument('Contact', 'GetCount', $params, __FUNCTION__, __FILE__, $description, 'GetCountContact'); $this->assertEquals('1', $result); @@ -2591,14 +2515,14 @@ public function testContactGetFormatCountOnly() { * Test id only format. */ public function testContactGetFormatIDOnly() { - $this->createContactFromXML(); + $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']); $description = "This demonstrates use of the 'format.id_only' param. This param causes the id of the only entity to be returned as an integer. It will be ignored if there is not exactly 1 result"; $subfile = "FormatOnlyID"; - $params = array('id' => 17, 'format.only_id' => 1); + $params = ['id' => $contactID, 'format.only_id' => 1]; $result = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile); - $this->assertEquals('17', $result); + $this->assertEquals($contactID, $result); $this->callAPISuccess('Contact', 'Delete', $params); } @@ -2606,14 +2530,14 @@ public function testContactGetFormatIDOnly() { * Test id only format. */ public function testContactGetFormatSingleValue() { - $this->createContactFromXML(); + $contactID = $this->individualCreate(['first_name' => 'Test', 'last_name' => 'Contact']); $description = "This demonstrates use of the 'format.single_value' param. This param causes only a single value of the only entity to be returned as an string. It will be ignored if there is not exactly 1 result"; $subFile = "FormatSingleValue"; - $params = array('id' => 17, 'return' => 'display_name'); + $params = ['id' => $contactID, 'return' => 'display_name']; $result = $this->callAPIAndDocument('Contact', 'getvalue', $params, __FUNCTION__, __FILE__, $description, $subFile); - $this->assertEquals('Test Contact', $result); + $this->assertEquals('Mr. Test Contact II', $result); $this->callAPISuccess('Contact', 'Delete', $params); } @@ -2687,19 +2611,6 @@ public function testContactUpdatePermissions() { $this->callAPISuccess('contact', 'update', $params); } - /** - * Set up helper to create a contact. - */ - public function createContactFromXML() { - // Insert a row in civicrm_contact creating contact 17. - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/contact_17.xml' - ) - ); - } - /** * Test contact proximity api. */ diff --git a/tests/phpunit/api/v3/CustomValueTest.php b/tests/phpunit/api/v3/CustomValueTest.php index 6b29420744fe..c99b72debb03 100644 --- a/tests/phpunit/api/v3/CustomValueTest.php +++ b/tests/phpunit/api/v3/CustomValueTest.php @@ -31,7 +31,7 @@ */ class api_v3_CustomValueTest extends CiviUnitTestCase { protected $_apiversion = 3; - protected $ids; + protected $optionGroup; public $DBResetRequired = FALSE; diff --git a/tests/phpunit/api/v3/GroupNestingTest.php b/tests/phpunit/api/v3/GroupNestingTest.php index 30820f486283..5b00f456290c 100644 --- a/tests/phpunit/api/v3/GroupNestingTest.php +++ b/tests/phpunit/api/v3/GroupNestingTest.php @@ -32,171 +32,162 @@ * @group headless */ class api_v3_GroupNestingTest extends CiviUnitTestCase { - protected $_apiversion; /** * Sets up the fixture, for example, opens a network connection. + * * This method is called before a test is executed. */ protected function setUp() { - $this->_apiversion = 3; parent::setUp(); - // Insert a row in civicrm_group creating option group - // from_email_address group - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/group_admins.xml' - ) - ); - - // Insert a row in civicrm_group creating option group - // from_email_address group - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/group_subscribers.xml' - ) - ); + $this->ids['Group'] = []; + $this->ids['Group']['parent'] = $this->callAPISuccess('Group', 'create', [ + 'name' => 'Administrators', + 'title' => 'Administrators', + ])['id']; + $this->ids['Group']['child'] = $this->callAPISuccess('Group', 'create', [ + 'name' => 'Newsletter Subscribers', + 'title' => 'Newsletter Subscribers', + 'parents' => $this->ids['Group']['parent'], + ])['id']; + $this->ids['Group']['child2'] = $this->callAPISuccess('Group', 'create', [ + 'name' => 'Another Newsletter Subscribers', + 'title' => 'Another Newsletter Subscribers', + 'parents' => $this->ids['Group']['parent'], + ])['id']; + $this->ids['Group']['child3'] = $this->callAPISuccess('Group', 'create', [ + 'name' => 'Super Special Newsletter Subscribers', + 'title' => 'Super Special Newsletter Subscribers', + 'parents' => [$this->ids['Group']['parent'], $this->ids['Group']['child']], + ])['id']; - // Insert a row in civicrm_group creating option group - // from_email_address group - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/group_nesting.xml' - ) - ); } /** - * Tears down the fixture, for example, closes a network connection. + * Tears down the fixture. + * * This method is called after a test is executed. + * + * @throws \Exception */ protected function tearDown() { - // Truncate the tables $this->quickCleanup( - array( + [ 'civicrm_group', 'civicrm_group_nesting', 'civicrm_contact', 'civicrm_uf_group', 'civicrm_uf_join', 'civicrm_uf_match', - ) + ] ); } - ///////////////// civicrm_group_nesting_get methods - /** * Test civicrm_group_nesting_get. */ public function testGet() { - $params = array( - 'parent_group_id' => 1, - 'child_group_id' => 2, - ); + $params = [ + 'parent_group_id' => $this->ids['Group']['parent'], + 'child_group_id' => $this->ids['Group']['child'], + ]; $result = $this->callAPIAndDocument('group_nesting', 'get', $params, __FUNCTION__, __FILE__); - // expected data loaded in setUp - $expected = array( - 1 => array( + $expected = [ + 1 => [ 'id' => 1, - 'child_group_id' => 2, - 'parent_group_id' => 1, - ), - ); + 'child_group_id' => $this->ids['Group']['child'], + 'parent_group_id' => $this->ids['Group']['parent'], + ], + ]; $this->assertEquals($expected, $result['values']); } /** - * Test civicrm_group_nesting_get with just one - * param (child_group_id). + * Test civicrm_group_nesting_get with just one param (child_group_id). */ public function testGetWithChildGroupId() { - $params = array( - 'child_group_id' => 4, - ); + $params = [ + 'child_group_id' => $this->ids['Group']['child3'], + ]; $result = $this->callAPISuccess('group_nesting', 'get', $params); // expected data loaded in setUp - $expected = array( - 3 => array( + $expected = [ + 3 => [ 'id' => 3, - 'child_group_id' => 4, - 'parent_group_id' => 1, - ), - 4 => array( + 'child_group_id' => $this->ids['Group']['child3'], + 'parent_group_id' => $this->ids['Group']['parent'], + ], + 4 => [ 'id' => 4, - 'child_group_id' => 4, - 'parent_group_id' => 2, - ), - ); + 'child_group_id' => $this->ids['Group']['child3'], + 'parent_group_id' => $this->ids['Group']['child'], + ], + ]; $this->assertEquals($expected, $result['values']); } /** - * Test civicrm_group_nesting_get with just one - * param (parent_group_id). + * Test civicrm_group_nesting_get with just one param (parent_group_id). */ public function testGetWithParentGroupId() { - $params = array( - 'parent_group_id' => 1, - ); + $params = [ + 'parent_group_id' => $this->ids['Group']['parent'], + ]; $result = $this->callAPISuccess('group_nesting', 'get', $params); // expected data loaded in setUp - $expected = array( - 1 => array( + $expected = [ + 1 => [ 'id' => 1, - 'child_group_id' => 2, - 'parent_group_id' => 1, - ), - 2 => array( + 'child_group_id' => $this->ids['Group']['child'], + 'parent_group_id' => $this->ids['Group']['parent'], + ], + 2 => [ 'id' => 2, - 'child_group_id' => 3, - 'parent_group_id' => 1, - ), - 3 => array( + 'child_group_id' => $this->ids['Group']['child2'], + 'parent_group_id' => $this->ids['Group']['parent'], + ], + 3 => [ 'id' => 3, - 'child_group_id' => 4, - 'parent_group_id' => 1, - ), - ); + 'child_group_id' => $this->ids['Group']['child3'], + 'parent_group_id' => $this->ids['Group']['parent'], + ], + ]; $this->assertEquals($expected, $result['values']); } /** * Test civicrm_group_nesting_get for no records results. + * * Success expected. (these tests are of marginal value as are in syntax conformance, * don't copy & paste */ public function testGetEmptyResults() { - $params = array( - 'parent_group_id' => 1, + $params = [ + 'parent_group_id' => $this->ids['Group']['parent'], 'child_group_id' => 700, - ); + ]; $this->callAPISuccess('group_nesting', 'get', $params); } - ///////////////// civicrm_group_nesting_create methods - /** * Test civicrm_group_nesting_create. + * + * @throws \Exception */ public function testCreate() { - // groups id=1 and id=2 loaded in setUp - $params = array( - 'parent_group_id' => 1, - 'child_group_id' => 3, - ); + $params = [ + 'parent_group_id' => $this->ids['Group']['parent'], + 'child_group_id' => $this->ids['Group']['child2'], + ]; $this->callAPIAndDocument('group_nesting', 'create', $params, __FUNCTION__, __FILE__); $this->callAPISuccessGetCount('GroupNesting', $params, 1); @@ -206,16 +197,15 @@ public function testCreate() { * Test civicrm_group_nesting_remove. */ public function testDelete() { - // groups id=1 and id=2 loaded in setUp - $getparams = array( - 'parent_group_id' => 1, - 'child_group_id' => 2, - ); + $params = [ + 'parent_group_id' => $this->ids['Group']['parent'], + 'child_group_id' => $this->ids['Group']['child'], + ]; - $result = $this->callAPISuccess('group_nesting', 'get', $getparams); - $params = array('id' => $result['id']); + $result = $this->callAPISuccess('group_nesting', 'get', $params); + $params = ['id' => $result['id']]; $this->callAPIAndDocument('group_nesting', 'delete', $params, __FUNCTION__, __FILE__); - $this->assertEquals(0, $this->callAPISuccess('group_nesting', 'getcount', $getparams)); + $this->assertEquals(0, $this->callAPISuccess('group_nesting', 'getcount', $params)); } /** @@ -224,7 +214,7 @@ public function testDelete() { * Error expected. */ public function testDeleteWithEmptyParams() { - $this->callAPIFailure('group_nesting', 'delete', array()); + $this->callAPIFailure('group_nesting', 'delete', []); } } diff --git a/tests/phpunit/api/v3/JobTest.php b/tests/phpunit/api/v3/JobTest.php index 54163231d810..8e3f32b5e9e8 100644 --- a/tests/phpunit/api/v3/JobTest.php +++ b/tests/phpunit/api/v3/JobTest.php @@ -245,13 +245,19 @@ public function testCallSendReminderSuccessMoreThanDefaultLimit() { * We create 3 contacts - 1 is in our group, 1 has our membership & the chosen one has both * & check that only the chosen one got the reminder */ - public function testCallSendReminderLimitTo() { + public function testCallSendReminderLimitToSMS() { $membershipTypeID = $this->membershipTypeCreate(); $this->membershipStatusCreate(); $createTotal = 3; $groupID = $this->groupCreate(array('name' => 'Texan drawlers', 'title' => 'a...')); for ($i = 1; $i <= $createTotal; $i++) { $contactID = $this->individualCreate(); + $this->callAPISuccess('Phone', 'create', [ + 'contact_id' => $contactID, + 'phone' => '555 123 1234', + 'phone_type_id' => 'Mobile', + 'location_type_id' => 'Billing', + ]); if ($i == 2) { $theChosenOneID = $contactID; } @@ -271,6 +277,19 @@ public function testCallSendReminderLimitTo() { )); } } + $this->setupForSmsTests(); + $provider = civicrm_api3('SmsProvider', 'create', array( + 'name' => "CiviTestSMSProvider", + 'api_type' => "1", + "username" => "1", + "password" => "1", + "api_type" => "1", + "api_url" => "1", + "api_params" => "a=1", + "is_default" => "1", + "is_active" => "1", + "domain_id" => "1", + )); $this->callAPISuccess('action_schedule', 'create', array( 'title' => " remind all Texans", 'subject' => "drawling renewal", @@ -282,12 +301,16 @@ public function testCallSendReminderLimitTo() { 'start_action_unit' => 'day', 'group_id' => $groupID, 'limit_to' => TRUE, + 'sms_provider_id' => $provider['id'], + 'mode' => 'User_Preference', )); $this->callAPISuccess('job', 'send_reminder', array()); $successfulCronCount = CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_action_log"); $this->assertEquals($successfulCronCount, 1); $sentToID = CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM civicrm_action_log"); $this->assertEquals($sentToID, $theChosenOneID); + $this->assertEquals(0, CRM_Core_DAO::singleValueQuery("SELECT is_error FROM civicrm_action_log")); + $this->setupForSmsTests(TRUE); } public function testCallDisableExpiredRelationships() { @@ -314,6 +337,85 @@ public function testCallDisableExpiredRelationships() { $this->contactDelete($orgID); } + /** + * Test scheduled reminders respect limit to (since above identified addition_to handling issue). + * + * We create 3 contacts - 1 is in our group, 1 has our membership & the chosen one has both + * & check that only the chosen one got the reminder + * + * Also check no hard fail on cron job with running a reminder that has a deleted SMS provider + */ + public function testCallSendReminderLimitToSMSWithDeletedProviderr() { + $membershipTypeID = $this->membershipTypeCreate(); + $this->membershipStatusCreate(); + $createTotal = 3; + $groupID = $this->groupCreate(array('name' => 'Texan drawlers', 'title' => 'a...')); + for ($i = 1; $i <= $createTotal; $i++) { + $contactID = $this->individualCreate(); + $this->callAPISuccess('Phone', 'create', [ + 'contact_id' => $contactID, + 'phone' => '555 123 1234', + 'phone_type_id' => 'Mobile', + 'location_type_id' => 'Billing', + ]); + if ($i == 2) { + $theChosenOneID = $contactID; + } + if ($i < 3) { + $this->callAPISuccess('group_contact', 'create', array( + 'contact_id' => $contactID, + 'status' => 'Added', + 'group_id' => $groupID, + )); + } + if ($i > 1) { + $this->callAPISuccess('membership', 'create', array( + 'contact_id' => $contactID, + 'membership_type_id' => $membershipTypeID, + 'join_date' => 'now', + 'start_date' => '+ 1 day', + )); + } + } + $this->setupForSmsTests(); + $provider = civicrm_api3('SmsProvider', 'create', array( + 'name' => "CiviTestSMSProvider", + 'api_type' => "1", + "username" => "1", + "password" => "1", + "api_type" => "1", + "api_url" => "1", + "api_params" => "a=1", + "is_default" => "1", + "is_active" => "1", + "domain_id" => "1", + )); + $this->callAPISuccess('action_schedule', 'create', array( + 'title' => " remind all Texans", + 'subject' => "drawling renewal", + 'entity_value' => $membershipTypeID, + 'mapping_id' => 4, + 'start_action_date' => 'membership_start_date', + 'start_action_offset' => 1, + 'start_action_condition' => 'before', + 'start_action_unit' => 'day', + 'group_id' => $groupID, + 'limit_to' => TRUE, + 'sms_provider_id' => $provider['id'], + 'mode' => 'SMS', + )); + $this->callAPISuccess('SmsProvider', 'delete', ['id' => $provider['id']]); + $this->callAPISuccess('job', 'send_reminder', array()); + $cronCount = CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_action_log"); + $this->assertEquals($cronCount, 1); + $sentToID = CRM_Core_DAO::singleValueQuery("SELECT contact_id FROM civicrm_action_log"); + $this->assertEquals($sentToID, $theChosenOneID); + $cronlog = CRM_Core_DAO::executeQuery("SELECT * FROM civicrm_action_log")->fetchAll()[0]; + $this->assertEquals(1, $cronlog['is_error']); + $this->assertEquals('SMS reminder cannot be sent because the SMS provider has been deleted.', $cronlog['message']); + $this->setupForSmsTests(TRUE); + } + /** * Test the batch merge function. * diff --git a/tests/phpunit/api/v3/MailingContactTest.php b/tests/phpunit/api/v3/MailingContactTest.php index a9e00c9ea33f..7ec969cac6be 100644 --- a/tests/phpunit/api/v3/MailingContactTest.php +++ b/tests/phpunit/api/v3/MailingContactTest.php @@ -40,21 +40,20 @@ * @group headless */ class api_v3_MailingContactTest extends CiviUnitTestCase { - protected $_apiversion = 3; protected $_entity = 'mailing'; public function setUp() { parent::setUp(); - $params = array( + $params = [ 'first_name' => 'abc1', 'contact_type' => 'Individual', 'last_name' => 'xyz1', - ); + ]; $this->_contact = $this->callAPISuccess("contact", "create", $params); } public function tearDown() { - $this->callAPISuccess("contact", "delete", array('id' => $this->_contact['id'])); + $this->callAPISuccess("contact", "delete", ['id' => $this->_contact['id']]); parent::tearDown(); } @@ -88,10 +87,7 @@ public function testMailingContactGetFields() { * belongs in the SyntaxConformance class */ public function testMailingNoContactID() { - $params = array( - 'something' => 'This is not a real field', - ); - $this->callAPIFailure('MailingContact', 'get', $params); + $this->callAPIFailure('MailingContact', 'get', ['something' => 'This is not a real field']); } /** @@ -103,8 +99,7 @@ public function testMailingNoContactID() { * belongs in the SyntaxConformance class */ public function testMailingContactInvalidContactID() { - $params = array('contact_id' => 'This is not a number'); - $this->callAPIFailure('MailingContact', 'get', $params); + $this->callAPIFailure('MailingContact', 'get', ['contact_id' => 'This is not a number']); } /** @@ -134,24 +129,13 @@ public function testMailingContactNoMailings() { * Test that the API returns a mailing properly when there is only one. */ public function testMailingContactDelivered() { - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - //Create the User - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/mailing_contact.xml' - ) - ); - // Create the Mailing and connections to the user. - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/mailing_delivered.xml' - ) - ); + list($contactID, $mailingID, $eventQueueID) = $this->setupEventQueue(); + CRM_Core_DAO::executeQuery("INSERT INTO civicrm_mailing_event_delivered (event_queue_id) VALUES(%1)", [1 => [$eventQueueID, 'Integer']]); - $params = array( - 'contact_id' => 23, + $params = [ + 'contact_id' => $contactID, 'type' => 'Delivered', - ); + ]; $result = $this->callAPISuccess('MailingContact', 'get', $params); $count = $this->callAPISuccess('MailingContact', 'getcount', $params); @@ -160,40 +144,54 @@ public function testMailingContactDelivered() { $this->assertFalse(empty($result['values'])); $this->assertEquals($result['values'][1]['mailing_id'], 1); $this->assertEquals($result['values'][1]['subject'], "Some Subject"); - $this->assertEquals($result['values'][1]['creator_id'], 3); - $this->assertEquals($result['values'][1]['creator_name'], "xyz1, abc1"); + $this->assertEquals(CRM_Core_Session::getLoggedInContactID(), $result['values'][1]['creator_id']); } /** - * Test that the API returns only the "Bounced" mailings when instructed to do so. + * Test that the API returns only the "Bounced" mailings when instructed to + * do so. + * + * @throws \Exception */ public function testMailingContactBounced() { - $op = new PHPUnit_Extensions_Database_Operation_Insert(); - // Create the User. - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/mailing_contact.xml' - ) - ); - // Create the Mailing and connections to the user. - $op->execute($this->_dbconn, - $this->createXMLDataSet( - dirname(__FILE__) . '/dataset/mailing_bounced.xml' - ) - ); + list($contactID, $mailingID, $eventQueueID) = $this->setupEventQueue(); + CRM_Core_DAO::executeQuery("INSERT INTO civicrm_mailing_event_bounce (event_queue_id, bounce_type_id) VALUES(%1, 6)", [1 => [$eventQueueID, 'Integer']]); - $params = array( - 'contact_id' => 23, + $params = [ + 'contact_id' => $contactID, 'type' => 'Bounced', - ); + ]; - $result = $this->callAPISuccess('MailingContact', 'get', $params); - $this->assertEquals($result['count'], 1); - $this->assertFalse(empty($result['values'])); - $this->assertEquals($result['values'][2]['mailing_id'], 2); - $this->assertEquals($result['values'][2]['subject'], "Some Subject"); - $this->assertEquals($result['values'][2]['creator_id'], 3); - $this->assertEquals($result['values'][2]['creator_name'], "xyz1, abc1"); + $result = $this->callAPISuccess('MailingContact', 'get', $params)['values']; + $this->assertEquals(1, count($result)); + $this->assertEquals($mailingID, $result[$mailingID]['mailing_id']); + $this->assertEquals('Some Subject', $result[$mailingID]['subject']); + $this->assertEquals(CRM_Core_Session::getLoggedInContactID(), $result[$mailingID]['creator_id'], 3); + } + + /** + * @return array + * @throws \Exception + */ + public function setupEventQueue() { + $contactID = $this->individualCreate(['first_name' => 'Test']); + $emailID = $this->callAPISuccessGetValue('Email', [ + 'return' => 'id', + 'contact_id' => $contactID, + ]); + $this->createLoggedInUser(); + $mailingID = $this->callAPISuccess('Mailing', 'create', [ + 'name' => 'Test Mailing', + 'subject' => 'Some Subject', + ])['id']; + $mailingJobID = $this->callAPISuccess('MailingJob', 'create', ['mailing_id' => $mailingID])['id']; + $eventQueueID = $this->callAPISuccess('MailingEventQueue', 'create', [ + 'contact_id' => $contactID, + 'mailing_id' => $mailingID, + 'email_id' => $emailID, + 'job_id' => $mailingJobID, + ])['id']; + return [$contactID, $mailingID, $eventQueueID]; } } diff --git a/tests/phpunit/api/v3/ProfileTest.php b/tests/phpunit/api/v3/ProfileTest.php index 6e2e88f7820b..8cd5cdb60b0f 100644 --- a/tests/phpunit/api/v3/ProfileTest.php +++ b/tests/phpunit/api/v3/ProfileTest.php @@ -32,13 +32,17 @@ * @group headless */ class api_v3_ProfileTest extends CiviUnitTestCase { - protected $_apiversion; + protected $_profileID = 0; + protected $_membershipTypeID; + protected $_contactID; + /** + * Set up for test. + */ public function setUp() { - $this->_apiversion = 3; parent::setUp(); $config = CRM_Core_Config::singleton(); $countryLimit = $config->countryLimit; @@ -49,26 +53,31 @@ public function setUp() { $this->_membershipTypeID = $this->membershipTypeCreate(); } + /** + * Cleanup after test. + * + * @throws \Exception + */ public function tearDown() { - $this->quickCleanup(array( + $this->quickCleanup([ 'civicrm_contact', 'civicrm_phone', 'civicrm_address', 'civicrm_membership', 'civicrm_contribution', 'civicrm_uf_match', - ), TRUE); - $this->callAPISuccess('membership_type', 'delete', array('id' => $this->_membershipTypeID)); - // ok can't be bothered wring an api to do this & truncating is crazy + ], TRUE); + $this->callAPISuccess('membership_type', 'delete', ['id' => $this->_membershipTypeID]); CRM_Core_DAO::executeQuery(" DELETE FROM civicrm_uf_group WHERE id IN ($this->_profileID, 26)"); + parent::tearDown(); } /** * Check Without ProfileId. */ public function testProfileGetWithoutProfileId() { - $this->callAPIFailure('profile', 'get', array('contact_id' => 1), + $this->callAPIFailure('profile', 'get', ['contact_id' => 1], 'Mandatory key(s) missing from params array: profile_id' ); } @@ -77,7 +86,10 @@ public function testProfileGetWithoutProfileId() { * Check with no invalid profile Id. */ public function testProfileGetInvalidProfileId() { - $this->callAPIFailure('profile', 'get', array('contact_id' => 1, 'profile_id' => 1000)); + $this->callAPIFailure('profile', 'get', [ + 'contact_id' => 1, + 'profile_id' => 1000, + ]); } /** @@ -87,32 +99,35 @@ public function testProfileGet() { $profileFieldValues = $this->_createIndividualContact(); $expected = reset($profileFieldValues); $contactId = key($profileFieldValues); - $params = array( + $params = [ 'profile_id' => $this->_profileID, 'contact_id' => $contactId, - ); - $result = $this->callAPISuccess('profile', 'get', $params); + ]; + $result = $this->callAPISuccess('profile', 'get', $params)['values']; foreach ($expected as $profileField => $value) { - $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result['values'])); + $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result)); } } + /** + * Test getting multiple profiles. + */ public function testProfileGetMultiple() { $profileFieldValues = $this->_createIndividualContact(); $expected = reset($profileFieldValues); $contactId = key($profileFieldValues); - $params = array( - 'profile_id' => array($this->_profileID, 1, 'Billing'), + $params = [ + 'profile_id' => [$this->_profileID, 1, 'Billing'], 'contact_id' => $contactId, - ); + ]; - $result = $this->callAPIAndDocument('profile', 'get', $params, __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument('profile', 'get', $params, __FUNCTION__, __FILE__)['values']; foreach ($expected as $profileField => $value) { - $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result['values'][$this->_profileID]), " error message: " . "missing/mismatching value for {$profileField}"); + $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result[$this->_profileID]), " error message: " . "missing/mismatching value for {$profileField}"); } - $this->assertEquals('abc1', $result['values'][1]['first_name'], " error message: " . "missing/mismatching value for {$profileField}"); - $this->assertFalse(array_key_exists('email-Primary', $result['values'][1]), 'profile 1 doesn not include email'); - $this->assertEquals($result['values']['Billing'], array( + $this->assertEquals('abc1', $result[1]['first_name'], " error message: " . "missing/mismatching value for first name"); + $this->assertFalse(array_key_exists('email-Primary', $result[1]), 'profile 1 does not include email'); + $this->assertEquals($result['Billing'], [ 'billing_first_name' => 'abc1', 'billing_middle_name' => 'J.', 'billing_last_name' => 'xyz1', @@ -123,27 +138,30 @@ public function testProfileGetMultiple() { 'billing_postal_code-5' => '90210', 'billing-email-5' => 'abc1.xyz1@yahoo.com', 'email-5' => 'abc1.xyz1@yahoo.com', - )); + ]); } + /** + * Test getting billing profile filled using is_billing. + */ public function testProfileGetBillingUseIsBillingLocation() { $individual = $this->_createIndividualContact(); $contactId = key($individual); - $this->callAPISuccess('address', 'create', array( + $this->callAPISuccess('address', 'create', [ 'is_billing' => 1, 'street_address' => 'is billing st', 'location_type_id' => 2, 'contact_id' => $contactId, - )); + ]); - $params = array( - 'profile_id' => array($this->_profileID, 1, 'Billing'), + $params = [ + 'profile_id' => [$this->_profileID, 1, 'Billing'], 'contact_id' => $contactId, - ); + ]; - $result = $this->callAPISuccess('profile', 'get', $params); - $this->assertEquals('abc1', $result['values'][1]['first_name']); - $this->assertEquals(array( + $result = $this->callAPISuccess('profile', 'get', $params)['values']; + $this->assertEquals('abc1', $result[1]['first_name']); + $this->assertEquals([ 'billing_first_name' => 'abc1', 'billing_middle_name' => 'J.', 'billing_last_name' => 'xyz1', @@ -154,33 +172,36 @@ public function testProfileGetBillingUseIsBillingLocation() { 'billing-email-5' => 'abc1.xyz1@yahoo.com', 'email-5' => 'abc1.xyz1@yahoo.com', 'billing_postal_code-5' => '', - ), $result['values']['Billing']); + ], $result['Billing']); } + /** + * Test getting multiple profiles, including billing. + */ public function testProfileGetMultipleHasBillingLocation() { $individual = $this->_createIndividualContact(); $contactId = key($individual); - $this->callAPISuccess('address', 'create', array( + $this->callAPISuccess('address', 'create', [ 'contact_id' => $contactId, 'street_address' => '25 Big Street', 'city' => 'big city', 'location_type_id' => 5, - )); - $this->callAPISuccess('email', 'create', array( + ]); + $this->callAPISuccess('email', 'create', [ 'contact_id' => $contactId, 'email' => 'big@once.com', 'location_type_id' => 2, 'is_billing' => 1, - )); + ]); - $params = array( - 'profile_id' => array($this->_profileID, 1, 'Billing'), + $params = [ + 'profile_id' => [$this->_profileID, 1, 'Billing'], 'contact_id' => $contactId, - ); + ]; $result = $this->callAPISuccess('profile', 'get', $params); $this->assertEquals('abc1', $result['values'][1]['first_name']); - $this->assertEquals($result['values']['Billing'], array( + $this->assertEquals($result['values']['Billing'], [ 'billing_first_name' => 'abc1', 'billing_middle_name' => 'J.', 'billing_last_name' => 'xyz1', @@ -191,20 +212,20 @@ public function testProfileGetMultipleHasBillingLocation() { 'billing-email-5' => 'big@once.com', 'email-5' => 'big@once.com', 'billing_postal_code-5' => '', - )); + ]); } /** - * Get Billing empty contact - this will return generic defaults + * Get Billing empty contact - this will return generic defaults. */ public function testProfileGetBillingEmptyContact() { $this->callAPISuccess('Setting', 'create', ['defaultContactCountry' => 1228]); - $params = array( - 'profile_id' => array('Billing'), - ); + $params = [ + 'profile_id' => ['Billing'], + ]; - $result = $this->callAPISuccess('profile', 'get', $params); - $this->assertEquals(array( + $result = $this->callAPISuccess('profile', 'get', $params)['values']; + $this->assertEquals([ 'billing_first_name' => '', 'billing_middle_name' => '', 'billing_last_name' => '', @@ -215,7 +236,7 @@ public function testProfileGetBillingEmptyContact() { 'billing_email-5' => '', 'email-5' => '', 'billing_postal_code-5' => '', - ), $result['values']['Billing']); + ], $result['Billing']); } /** @@ -239,28 +260,27 @@ public function testContactActivityGetWrongActivityId() { /** * Check contact activity profile with wrong activity type. + * + * @throws \Exception */ public function testContactActivityGetWrongActivityType() { - //flush cache by calling with reset - $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE); - $sourceContactId = $this->householdCreate(); - $activityparams = array( + $activityParams = [ 'source_contact_id' => $sourceContactId, 'activity_type_id' => '2', 'subject' => 'Test activity', 'activity_date_time' => '20110316', 'duration' => '120', - 'location' => 'Pensulvania', + 'location' => 'Pennsylvania', 'details' => 'a test activity', 'status_id' => '1', 'priority_id' => '1', - ); + ]; - $activity = $this->callAPISuccess('activity', 'create', $activityparams); + $activity = $this->callAPISuccess('activity', 'create', $activityParams)['values']; - $activityValues = array_pop($activity['values']); + $activityValues = array_pop($activity); list($params) = $this->_createContactWithActivity(); @@ -288,10 +308,10 @@ public function testContactActivityGetSuccess() { public function testGetFields() { $this->_createIndividualProfile(); $this->_addCustomFieldToProfile($this->_profileID); - $result = $this->callAPIAndDocument('profile', 'getfields', array( + $result = $this->callAPIAndDocument('profile', 'getfields', [ 'action' => 'submit', 'profile_id' => $this->_profileID, - ), __FUNCTION__, __FILE__, + ], __FUNCTION__, __FILE__, 'demonstrates retrieving profile fields passing in an id'); $this->assertArrayKeyExists('first_name', $result['values']); $this->assertEquals('2', $result['values']['first_name']['type']); @@ -302,17 +322,17 @@ public function testGetFields() { } /** - * Check getfields works & gives us our fields - partipant profile + * Check getfields works & gives us our fields - participant profile */ public function testGetFieldsParticipantProfile() { - $result = $this->callAPISuccess('profile', 'getfields', array( + $result = $this->callAPISuccess('profile', 'getfields', [ 'action' => 'submit', 'profile_id' => 'participant_status', 'get_options' => 'all', - )); + ]); $this->assertTrue(array_key_exists('participant_status_id', $result['values'])); $this->assertEquals('Attended', $result['values']['participant_status_id']['options'][2]); - $this->assertEquals(array('participant_status'), $result['values']['participant_status_id']['api.aliases']); + $this->assertEquals(['participant_status'], $result['values']['participant_status_id']['api.aliases']); } /** @@ -320,18 +340,18 @@ public function testGetFieldsParticipantProfile() { * (getting to the end with no e-notices is pretty good evidence it's working) */ public function testGetFieldsMembershipBatchProfile() { - $result = $this->callAPISuccess('profile', 'getfields', array( + $result = $this->callAPISuccess('profile', 'getfields', [ 'action' => 'submit', 'profile_id' => 'membership_batch_entry', 'get_options' => 'all', - )); + ]); $this->assertTrue(array_key_exists('total_amount', $result['values'])); $this->assertTrue(array_key_exists('financial_type_id', $result['values'])); - $this->assertEquals(array( + $this->assertEquals([ 'contribution_type_id', 'contribution_type', 'financial_type', - ), $result['values']['financial_type_id']['api.aliases']); + ], $result['values']['financial_type_id']['api.aliases']); $this->assertTrue(!array_key_exists('financial_type', $result['values'])); $this->assertEquals(12, $result['values']['receive_date']['type']); } @@ -341,14 +361,14 @@ public function testGetFieldsMembershipBatchProfile() { * (getting to the end with no e-notices is pretty good evidence it's working) */ public function testGetFieldsAllProfiles() { - $result = $this->callAPISuccess('uf_group', 'get', array('return' => 'id')); - $profileIDs = array_keys($result['values']); + $result = $this->callAPISuccess('uf_group', 'get', ['return' => 'id'])['values']; + $profileIDs = array_keys($result); foreach ($profileIDs as $profileID) { - $this->callAPISuccess('profile', 'getfields', array( + $this->callAPISuccess('profile', 'getfields', [ 'action' => 'submit', 'profile_id' => $profileID, 'get_options' => 'all', - )); + ]); } } @@ -356,9 +376,9 @@ public function testGetFieldsAllProfiles() { * Check Without ProfileId. */ public function testProfileSubmitWithoutProfileId() { - $params = array( + $params = [ 'contact_id' => 1, - ); + ]; $this->callAPIFailure('profile', 'submit', $params, 'Mandatory key(s) missing from params array: profile_id' ); @@ -368,11 +388,11 @@ public function testProfileSubmitWithoutProfileId() { * Check with no invalid profile Id. */ public function testProfileSubmitInvalidProfileId() { - $params = array( + $params = [ 'contact_id' => 1, 'profile_id' => 1000, - ); - $result = $this->callAPIFailure('profile', 'submit', $params); + ]; + $this->callAPIFailure('profile', 'submit', $params); } /** @@ -381,15 +401,18 @@ public function testProfileSubmitInvalidProfileId() { public function testProfileSubmitCheckProfileRequired() { $profileFieldValues = $this->_createIndividualContact(); $contactId = key($profileFieldValues); - $updateParams = array( + $updateParams = [ 'first_name' => 'abc2', 'last_name' => 'xyz2', 'phone-1-1' => '022 321 826', 'country-1' => '1013', 'state_province-1' => '1000', - ); + ]; - $params = array_merge(array('profile_id' => $this->_profileID, 'contact_id' => $contactId), + $params = array_merge([ + 'profile_id' => $this->_profileID, + 'contact_id' => $contactId, + ], $updateParams ); @@ -405,26 +428,26 @@ public function testProfileSubmit() { $profileFieldValues = $this->_createIndividualContact(); $contactId = key($profileFieldValues); - $updateParams = array( + $updateParams = [ 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email-primary' => 'abc2.xyz2@gmail.com', 'phone-1-1' => '022 321 826', 'country-1' => '1013', 'state_province-1' => '1000', - ); + ]; - $params = array_merge(array( + $params = array_merge([ 'profile_id' => $this->_profileID, 'contact_id' => $contactId, - ), $updateParams); + ], $updateParams); $this->callAPIAndDocument('profile', 'submit', $params, __FUNCTION__, __FILE__); - $getParams = array( + $getParams = [ 'profile_id' => $this->_profileID, 'contact_id' => $contactId, - ); + ]; $profileDetails = $this->callAPISuccess('profile', 'get', $getParams); foreach ($updateParams as $profileField => $value) { @@ -440,22 +463,22 @@ public function testProfileSubmit() { /** * Ensure caches are being cleared so we don't get into a debugging trap because of cached metadata - * First we delete & create to increment the version & then check for caching probs + * First we delete & create to increment the version & then check for caching problems. */ public function testProfileSubmitCheckCaching() { - $this->callAPISuccess('membership_type', 'delete', array('id' => $this->_membershipTypeID)); + $this->callAPISuccess('membership_type', 'delete', ['id' => $this->_membershipTypeID]); $this->_membershipTypeID = $this->membershipTypeCreate(); - $membershipTypes = $this->callAPISuccess('membership_type', 'get', array()); - $profileFields = $this->callAPISuccess('profile', 'getfields', array( + $membershipTypes = $this->callAPISuccess('membership_type', 'get', []); + $profileFields = $this->callAPISuccess('profile', 'getfields', [ 'get_options' => 'all', 'action' => 'submit', 'profile_id' => 'membership_batch_entry', - )); - $getoptions = $this->callAPISuccess('membership', 'getoptions', array( + ]); + $getoptions = $this->callAPISuccess('membership', 'getoptions', [ 'field' => 'membership_type', 'context' => 'validate', - )); + ]); $this->assertEquals(array_keys($membershipTypes['values']), array_keys($getoptions['values'])); $this->assertEquals(array_keys($membershipTypes['values']), array_keys($profileFields['values']['membership_type_id']['options'])); @@ -465,12 +488,12 @@ public function testProfileSubmitCheckCaching() { * Test that the fields are returned in the right order despite the faffing around that goes on. */ public function testMembershipGetFieldsOrder() { - $result = $this->callAPISuccess('profile', 'getfields', array( + $result = $this->callAPISuccess('profile', 'getfields', [ 'action' => 'submit', 'profile_id' => 'membership_batch_entry', - )); + ])['values']; $weight = 1; - foreach ($result['values'] as $fieldName => $field) { + foreach ($result as $fieldName => $field) { if ($fieldName == 'profile_id') { continue; } @@ -484,7 +507,7 @@ public function testMembershipGetFieldsOrder() { */ public function testProfileSubmitMembershipBatch() { $this->_contactID = $this->individualCreate(); - $this->callAPISuccess('profile', 'submit', array( + $this->callAPISuccess('profile', 'submit', [ 'profile_id' => 'membership_batch_entry', 'financial_type_id' => 1, 'membership_type' => $this->_membershipTypeID, @@ -493,7 +516,7 @@ public function testProfileSubmitMembershipBatch() { 'contribution_status_id' => 1, 'receive_date' => 'now', 'contact_id' => $this->_contactID, - )); + ]); } /** @@ -503,26 +526,26 @@ public function testLegacySet() { $profileFieldValues = $this->_createIndividualContact(); $contactId = key($profileFieldValues); - $updateParams = array( + $updateParams = [ 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email-Primary' => 'abc2.xyz2@gmail.com', 'phone-1-1' => '022 321 826', 'country-1' => '1013', 'state_province-1' => '1000', - ); + ]; - $params = array_merge(array( + $params = array_merge([ 'profile_id' => $this->_profileID, 'contact_id' => $contactId, - ), $updateParams); + ], $updateParams); $result = $this->callAPISuccess('profile', 'set', $params); $this->assertArrayKeyExists('values', $result); - $getParams = array( + $getParams = [ 'profile_id' => $this->_profileID, 'contact_id' => $contactId, - ); + ]; $profileDetails = $this->callAPISuccess('profile', 'get', $getParams); foreach ($updateParams as $profileField => $value) { @@ -539,8 +562,7 @@ public function testContactActivitySubmitWithoutActivityId() { $params = array_merge($params, $expected); unset($params['activity_id']); - $result = $this->callAPIFailure('profile', 'submit', $params); - $this->assertEquals($result['error_message'], 'Mandatory key(s) missing from params array: activity_id'); + $this->callAPIFailure('profile', 'submit', $params, 'Mandatory key(s) missing from params array: activity_id'); } /** @@ -550,32 +572,31 @@ public function testContactActivitySubmitWrongActivityId() { list($params, $expected) = $this->_createContactWithActivity(); $params = array_merge($params, $expected); $params['activity_id'] = 100001; - $result = $this->callAPIFailure('profile', 'submit', $params); - $this->assertEquals($result['error_message'], 'Invalid Activity Id (aid).'); + $this->callAPIFailure('profile', 'submit', $params, 'Invalid Activity Id (aid).'); } /** * Check contact activity profile with wrong activity type. + * + * @throws \Exception */ public function testContactActivitySubmitWrongActivityType() { - //flush cache by calling with reset - CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE); $sourceContactId = $this->householdCreate(); - $activityparams = array( + $activityParams = [ 'source_contact_id' => $sourceContactId, 'activity_type_id' => '2', 'subject' => 'Test activity', 'activity_date_time' => '20110316', 'duration' => '120', - 'location' => 'Pensulvania', + 'location' => 'Pennsylvania', 'details' => 'a test activity', 'status_id' => '1', 'priority_id' => '1', - ); + ]; - $activity = $this->callAPISuccess('activity', 'create', $activityparams); + $activity = $this->callAPISuccess('activity', 'create', $activityParams); $activityValues = array_pop($activity['values']); @@ -593,7 +614,7 @@ public function testContactActivitySubmitWrongActivityType() { public function testContactActivitySubmitSuccess() { list($params) = $this->_createContactWithActivity(); - $updateParams = array( + $updateParams = [ 'first_name' => 'abc2', 'last_name' => 'xyz2', 'email-Primary' => 'abc2.xyz2@yahoo.com', @@ -602,13 +623,13 @@ public function testContactActivitySubmitSuccess() { 'activity_duration' => '100', 'activity_date_time' => '2010-03-08 00:00:00', 'activity_status_id' => '2', - ); + ]; $profileParams = array_merge($params, $updateParams); $this->callAPISuccess('profile', 'submit', $profileParams); - $result = $this->callAPISuccess('profile', 'get', $params); + $result = $this->callAPISuccess('profile', 'get', $params)['values']; foreach ($updateParams as $profileField => $value) { - $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result['values']), " error message: " . "missing/mismatching value for {$profileField}" + $this->assertEquals($value, CRM_Utils_Array::value($profileField, $result), " error message: " . "missing/mismatching value for {$profileField}" ); } } @@ -617,9 +638,9 @@ public function testContactActivitySubmitSuccess() { * Check profile apply Without ProfileId. */ public function testProfileApplyWithoutProfileId() { - $params = array( + $params = [ 'contact_id' => 1, - ); + ]; $this->callAPIFailure('profile', 'apply', $params, 'Mandatory key(s) missing from params array: profile_id'); } @@ -628,10 +649,10 @@ public function testProfileApplyWithoutProfileId() { * Check profile apply with no invalid profile Id. */ public function testProfileApplyInvalidProfileId() { - $params = array( + $params = [ 'contact_id' => 1, 'profile_id' => 1000, - ); + ]; $this->callAPIFailure('profile', 'apply', $params); } @@ -643,7 +664,7 @@ public function testProfileApply() { current($profileFieldValues); $contactId = key($profileFieldValues); - $params = array( + $params = [ 'profile_id' => $this->_profileID, 'contact_id' => $contactId, 'first_name' => 'abc2', @@ -652,49 +673,45 @@ public function testProfileApply() { 'phone-1-1' => '022 321 826', 'country-1' => '1013', 'state_province-1' => '1000', - ); + ]; $result = $this->callAPIAndDocument('profile', 'apply', $params, __FUNCTION__, __FILE__); // Expected field values - $expected['contact'] = array( + $expected['contact'] = [ 'contact_id' => $contactId, 'contact_type' => 'Individual', 'first_name' => 'abc2', 'last_name' => 'xyz2', - ); - $expected['email'] = array( + ]; + $expected['email'] = [ 'location_type_id' => 1, 'is_primary' => 1, 'email' => 'abc2.xyz2@gmail.com', - ); + ]; - $expected['phone'] = array( + $expected['phone'] = [ 'location_type_id' => 1, 'is_primary' => 1, 'phone_type_id' => 1, 'phone' => '022 321 826', - ); - $expected['address'] = array( + ]; + $expected['address'] = [ 'location_type_id' => 1, 'is_primary' => 1, 'country_id' => 1013, 'state_province_id' => 1000, - ); + ]; foreach ($expected['contact'] as $field => $value) { - $this->assertEquals($value, CRM_Utils_Array::value($field, $result['values']), "In line " . __LINE__ . " error message: " . "missing/mismatching value for {$field}" + $this->assertEquals($value, CRM_Utils_Array::value($field, $result['values']), "missing/mismatching value for {$field}" ); } - foreach (array( - 'email', - 'phone', - 'address', - ) as $fieldType) { + foreach (['email', 'phone', 'address'] as $fieldType) { $typeValues = array_pop($result['values'][$fieldType]); foreach ($expected[$fieldType] as $field => $value) { - $this->assertEquals($value, CRM_Utils_Array::value($field, $typeValues), "In line " . __LINE__ . " error message: " . "missing/mismatching value for {$field} ({$fieldType})" + $this->assertEquals($value, CRM_Utils_Array::value($field, $typeValues), "missing/mismatching value for {$field} ({$fieldType})" ); } } @@ -710,31 +727,31 @@ public function testSubmitWithTags() { $params['profile_id'] = $this->_profileID; $params['contact_id'] = $contactId; - $this->callAPISuccess('ufField', 'create', array( + $this->callAPISuccess('ufField', 'create', [ 'uf_group_id' => $this->_profileID, 'field_name' => 'tag', 'visibility' => 'Public Pages and Listings', 'field_type' => 'Contact', 'label' => 'Tags', - )); + ]); $tag_1 = $this->callAPISuccess('tag', 'create', ['name' => 'abc'])['id']; $tag_2 = $this->callAPISuccess('tag', 'create', ['name' => 'def'])['id']; $params['tag'] = "$tag_1,$tag_2"; - $result = $this->callAPISuccess('profile', 'submit', $params); + $this->callAPISuccess('profile', 'submit', $params); $tags = $this->callAPISuccess('entityTag', 'get', ['entity_id' => $contactId]); $this->assertEquals(2, $tags['count']); $params['tag'] = [$tag_1]; - $result = $this->callAPISuccess('profile', 'submit', $params); + $this->callAPISuccess('profile', 'submit', $params); $tags = $this->callAPISuccess('entityTag', 'get', ['entity_id' => $contactId]); $this->assertEquals(1, $tags['count']); $params['tag'] = ''; - $result = $this->callAPISuccess('profile', 'submit', $params); + $this->callAPISuccess('profile', 'submit', $params); $tags = $this->callAPISuccess('entityTag', 'get', ['entity_id' => $contactId]); $this->assertEquals(0, $tags['count']); @@ -743,6 +760,8 @@ public function testSubmitWithTags() { /** * Check success with a note. + * + * @throws \Exception */ public function testSubmitWithNote() { $profileFieldValues = $this->_createIndividualContact(); @@ -751,13 +770,13 @@ public function testSubmitWithNote() { $params['profile_id'] = $this->_profileID; $params['contact_id'] = $contactId; - $this->callAPISuccess('ufField', 'create', array( + $this->callAPISuccess('ufField', 'create', [ 'uf_group_id' => $this->_profileID, 'field_name' => 'note', 'visibility' => 'Public Pages and Listings', 'field_type' => 'Contact', 'label' => 'Note', - )); + ]); $params['note'] = "Hello 123"; $this->callAPISuccess('profile', 'submit', $params); @@ -768,6 +787,8 @@ public function testSubmitWithNote() { /** * Check handling a custom greeting. + * + * @throws \CiviCRM_API3_Exception */ public function testSubmitGreetingFields() { $profileFieldValues = $this->_createIndividualContact(); @@ -776,13 +797,13 @@ public function testSubmitGreetingFields() { $params['profile_id'] = $this->_profileID; $params['contact_id'] = $contactId; - $this->callAPISuccess('ufField', 'create', array( + $this->callAPISuccess('ufField', 'create', [ 'uf_group_id' => $this->_profileID, 'field_name' => 'email_greeting', 'visibility' => 'Public Pages and Listings', 'field_type' => 'Contact', 'label' => 'Email Greeting', - )); + ]); $emailGreetings = array_column(civicrm_api3('OptionValue', 'get', ['option_group_id' => "email_greeting"])['values'], NULL, 'name'); @@ -801,16 +822,17 @@ public function testSubmitGreetingFields() { /** * Helper function to create an Individual with address/email/phone info. Import UF Group and UF Fields + * * @param array $params * * @return mixed */ - public function _createIndividualContact($params = array()) { - $contactParams = array_merge(array( + public function _createIndividualContact($params = []) { + $contactParams = array_merge([ 'first_name' => 'abc1', 'last_name' => 'xyz1', 'email' => 'abc1.xyz1@yahoo.com', - 'api.address.create' => array( + 'api.address.create' => [ 'location_type_id' => 1, 'is_primary' => 1, 'street_address' => '5 Saint Helier St', @@ -823,26 +845,26 @@ public function _createIndividualContact($params = array()) { 'postal_code' => '90210', 'city' => 'Gotham City', 'is_billing' => 0, - ), - 'api.phone.create' => array( + ], + 'api.phone.create' => [ 'location_type_id' => '1', 'phone' => '021 512 755', 'phone_type_id' => '1', 'is_primary' => '1', - ), - ), $params); + ], + ], $params); $this->_contactID = $this->individualCreate($contactParams); $this->_createIndividualProfile(); // expected result of above created profile with contact Id $contactId - $profileData[$this->_contactID] = array( + $profileData[$this->_contactID] = [ 'first_name' => 'abc1', 'last_name' => 'xyz1', 'email-primary' => 'abc1.xyz1@yahoo.com', 'phone-1-1' => '021 512 755', 'country-1' => '1228', 'state_province-1' => '1021', - ); + ]; return $profileData; } @@ -862,12 +884,12 @@ public function _createContactWithActivity() { CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', '26', 'group_type', 'Individual,Contact,Activity' . CRM_Core_DAO::VALUE_SEPARATOR . 'ActivityType:1'); $sourceContactId = $this->individualCreate(); - $contactParams = array( + $contactParams = [ 'first_name' => 'abc1', 'last_name' => 'xyz1', 'contact_type' => 'Individual', 'email' => 'abc1.xyz1@yahoo.com', - 'api.address.create' => array( + 'api.address.create' => [ 'location_type_id' => 1, 'is_primary' => 1, 'name' => 'Saint Helier St', @@ -877,8 +899,8 @@ public function _createContactWithActivity() { 'supplemental_address_1' => 'Hallmark Ct', 'supplemental_address_2' => 'Jersey Village', 'supplemental_address_3' => 'My Town', - ), - ); + ], + ]; $contact = $this->callAPISuccess('contact', 'create', $contactParams); @@ -888,31 +910,31 @@ public function _createContactWithActivity() { $this->assertEquals(0, $contact['values'][$contactId]['api.address.create']['is_error'], " error message: " . CRM_Utils_Array::value('error_message', $contact['values'][$contactId]['api.address.create']) ); - $activityParams = array( + $activityParams = [ 'source_contact_id' => $sourceContactId, 'assignee_contact_id' => $contactId, 'activity_type_id' => '1', 'subject' => 'Make-it-Happen Meeting', 'activity_date_time' => '2011-03-16 00:00:00', 'duration' => '120', - 'location' => 'Pensulvania', + 'location' => 'Pennsylvania', 'details' => 'a test activity', 'status_id' => '1', 'priority_id' => '1', - ); + ]; $activity = $this->callAPISuccess('activity', 'create', $activityParams); $activityValues = array_pop($activity['values']); // valid parameters for above profile - $profileParams = array( + $profileParams = [ 'profile_id' => 26, 'contact_id' => $contactId, 'activity_id' => $activityValues['id'], - ); + ]; // expected result of above created profile - $expected = array( + $expected = [ 'first_name' => 'abc1', 'last_name' => 'xyz1', 'email-Primary' => 'abc1.xyz1@yahoo.com', @@ -921,43 +943,43 @@ public function _createContactWithActivity() { 'activity_duration' => '120', 'activity_date_time' => '2011-03-16 00:00:00', 'activity_status_id' => '1', - ); + ]; - return array($profileParams, $expected); + return [$profileParams, $expected]; } /** * Create a profile. */ public function _createIndividualProfile() { - $ufGroupParams = array( + $ufGroupParams = [ 'group_type' => 'Individual,Contact', // really we should remove this & test the ufField create sets it 'name' => 'test_individual_contact_profile', 'title' => 'Flat Coffee', - 'api.uf_field.create' => array( - array( + 'api.uf_field.create' => [ + [ 'field_name' => 'first_name', 'is_required' => 1, 'visibility' => 'Public Pages and Listings', 'field_type' => 'Individual', 'label' => 'First Name', - ), - array( + ], + [ 'field_name' => 'last_name', 'is_required' => 1, 'visibility' => 'Public Pages and Listings', 'field_type' => 'Individual', 'label' => 'Last Name', - ), - array( + ], + [ 'field_name' => 'email', 'is_required' => 1, 'visibility' => 'Public Pages and Listings', 'field_type' => 'Contact', 'label' => 'Email', - ), - array( + ], + [ 'field_name' => 'phone', 'is_required' => 1, 'visibility' => 'Public Pages and Listings', @@ -965,32 +987,32 @@ public function _createIndividualProfile() { 'location_type_id' => 1, 'phone_type_id' => 1, 'label' => 'Phone', - ), - array( + ], + [ 'field_name' => 'country', 'is_required' => 1, 'visibility' => 'Public Pages and Listings', 'field_type' => 'Contact', 'location_type_id' => 1, 'label' => 'Country', - ), - array( + ], + [ 'field_name' => 'state_province', 'is_required' => 1, 'visibility' => 'Public Pages and Listings', 'field_type' => 'Contact', 'location_type_id' => 1, 'label' => 'State Province', - ), - array( + ], + [ 'field_name' => 'postal_code', 'is_required' => 0, 'field_type' => 'Contact', 'location_type_id' => 1, 'label' => 'State Province', - ), - ), - ); + ], + ], + ]; $profile = $this->callAPISuccess('uf_group', 'create', $ufGroupParams); $this->_profileID = $profile['id']; } @@ -1000,11 +1022,11 @@ public function _createIndividualProfile() { */ public function _addCustomFieldToProfile($profileID) { $ids = $this->entityCustomGroupWithSingleFieldCreate(__FUNCTION__, ''); - $this->uFFieldCreate(array( + $this->uFFieldCreate([ 'uf_group_id' => $profileID, 'field_name' => 'custom_' . $ids['custom_field_id'], 'contact_type' => 'Contact', - )); + ]); } } diff --git a/tests/phpunit/api/v3/RelationshipTest.php b/tests/phpunit/api/v3/RelationshipTest.php index 469624da2724..1fdc04b337ce 100644 --- a/tests/phpunit/api/v3/RelationshipTest.php +++ b/tests/phpunit/api/v3/RelationshipTest.php @@ -30,6 +30,9 @@ * @group headless */ class api_v3_RelationshipTest extends CiviUnitTestCase { + + use CRMTraits_Custom_CustomDataTrait; + protected $_apiversion = 3; protected $_cId_a; /** @@ -45,12 +48,11 @@ class api_v3_RelationshipTest extends CiviUnitTestCase { */ protected $_cId_b2; protected $_relTypeID; - protected $_ids = array(); - protected $_customGroupId = NULL; + protected $_ids = []; protected $_customFieldId = NULL; protected $_params; - protected $_entity; + protected $entity; /** * Set up function. @@ -65,7 +67,7 @@ public function setUp() { )); $this->_cId_b = $this->organizationCreate(); $this->_cId_b2 = $this->organizationCreate(array('organization_name' => ' Org 2')); - $this->_entity = 'relationship'; + $this->entity = 'Relationship'; //Create a relationship type. $relTypeParams = array( 'name_a_b' => 'Relation 1 for delete', @@ -397,7 +399,7 @@ public function testRelationshipCreateEmptyEndDate() { */ public function testRelationshipCreateEditWithCustomData() { $this->createCustomGroup(); - $this->_ids = $this->createCustomField(); + $this->_ids = $this->createCustomFieldsOfAllTypes(); //few custom Values for comparing $custom_params = array( "custom_{$this->_ids[0]}" => 'Hello! this is custom data for relationship', @@ -453,122 +455,17 @@ public function testGetWithCustom() { $params = $this->_params; $params['custom_' . $ids['custom_field_id']] = "custom string"; - $result = $this->callAPISuccess($this->_entity, 'create', $params); + $result = $this->callAPISuccess($this->entity, 'create', $params); $this->assertEquals($result['id'], $result['values'][$result['id']]['id']); $getParams = array('id' => $result['id']); - $check = $this->callAPIAndDocument($this->_entity, 'get', $getParams, __FUNCTION__, __FILE__); + $check = $this->callAPIAndDocument($this->entity, 'get', $getParams, __FUNCTION__, __FILE__); $this->assertEquals("custom string", $check['values'][$check['id']]['custom_' . $ids['custom_field_id']], ' in line ' . __LINE__); $this->customFieldDelete($ids['custom_field_id']); $this->customGroupDelete($ids['custom_group_id']); } - /** - * @return mixed - */ - public function createCustomGroup() { - $params = array( - 'title' => 'Custom Group', - 'extends' => array('Relationship'), - 'weight' => 5, - 'style' => 'Inline', - 'is_active' => 1, - 'max_multiple' => 0, - ); - $customGroup = $this->callAPISuccess('custom_group', 'create', $params); - $this->_customGroupId = $customGroup['id']; - return $customGroup['id']; - } - - /** - * @return array - */ - public function createCustomField() { - $ids = array(); - $params = array( - 'custom_group_id' => $this->_customGroupId, - 'label' => 'Enter text about relationship', - 'html_type' => 'Text', - 'data_type' => 'String', - 'default_value' => 'xyz', - 'weight' => 1, - 'is_required' => 1, - 'is_searchable' => 0, - 'is_active' => 1, - ); - - $customField = $this->callAPISuccess('CustomField', 'create', $params); - $ids[] = $customField['id']; - - $optionValue[] = array( - 'label' => 'Red', - 'value' => 'R', - 'weight' => 1, - 'is_active' => 1, - ); - $optionValue[] = array( - 'label' => 'Yellow', - 'value' => 'Y', - 'weight' => 2, - 'is_active' => 1, - ); - $optionValue[] = array( - 'label' => 'Green', - 'value' => 'G', - 'weight' => 3, - 'is_active' => 1, - ); - - $params = array( - 'label' => 'Pick Color', - 'html_type' => 'Select', - 'data_type' => 'String', - 'weight' => 2, - 'is_required' => 1, - 'is_searchable' => 0, - 'is_active' => 1, - 'option_values' => $optionValue, - 'custom_group_id' => $this->_customGroupId, - ); - - $customField = $this->callAPISuccess('custom_field', 'create', $params); - $ids[] = $customField['id']; - - $params = array( - 'custom_group_id' => $this->_customGroupId, - 'name' => 'test_date', - 'label' => 'test_date', - 'html_type' => 'Select Date', - 'data_type' => 'Date', - 'default_value' => '20090711', - 'weight' => 3, - 'is_required' => 1, - 'is_searchable' => 0, - 'is_active' => 1, - ); - - $customField = $this->callAPISuccess('custom_field', 'create', $params); - - $ids[] = $customField['id']; - $params = array( - 'custom_group_id' => $this->_customGroupId, - 'name' => 'test_link', - 'label' => 'test_link', - 'html_type' => 'Link', - 'data_type' => 'Link', - 'default_value' => 'http://civicrm.org', - 'weight' => 4, - 'is_required' => 1, - 'is_searchable' => 0, - 'is_active' => 1, - ); - - $customField = $this->callAPISuccess('custom_field', 'create', $params); - $ids[] = $customField['id']; - return $ids; - } - /** * Check with empty array. */ @@ -675,7 +572,7 @@ public function testRelationshipCreateDuplicate() { */ public function testRelationshipCreateDuplicateWithCustomFields() { $this->createCustomGroup(); - $this->_ids = $this->createCustomField(); + $this->_ids = $this->createCustomFieldsOfAllTypes(); $custom_params_1 = array( "custom_{$this->_ids[0]}" => 'Hello! this is custom data for relationship', @@ -719,7 +616,7 @@ public function testRelationshipCreateDuplicateWithCustomFields() { */ public function testRelationshipCreateDuplicateWithCustomFields2() { $this->createCustomGroup(); - $this->_ids = $this->createCustomField(); + $this->_ids = $this->createCustomFieldsOfAllTypes(); $custom_params_2 = array( "custom_{$this->_ids[0]}" => 'Hello! this is other custom data', @@ -755,7 +652,7 @@ public function testRelationshipCreateDuplicateWithCustomFields2() { */ public function testRelationshipCreateDuplicateWithCustomFields3() { $this->createCustomGroup(); - $this->_ids = $this->createCustomField(); + $this->_ids = $this->createCustomFieldsOfAllTypes(); $custom_params_1 = array( "custom_{$this->_ids[0]}" => 'Hello! this is other custom data', @@ -1097,18 +994,18 @@ public function testGetRelationshipWithRelTypes() { * an incorrect one */ public function testGetRelationshipByTypeReciprocal() { - $created = $this->callAPISuccess($this->_entity, 'create', $this->_params); - $result = $this->callAPISuccess($this->_entity, 'get', array( + $created = $this->callAPISuccess($this->entity, 'create', $this->_params); + $result = $this->callAPISuccess($this->entity, 'get', array( 'contact_id' => $this->_cId_a, 'relationship_type_id' => $this->_relTypeID, )); $this->assertEquals(1, $result['count']); - $result = $this->callAPISuccess($this->_entity, 'get', array( + $result = $this->callAPISuccess($this->entity, 'get', array( 'contact_id' => $this->_cId_a, 'relationship_type_id' => $this->_relTypeID + 1, )); $this->assertEquals(0, $result['count']); - $this->callAPISuccess($this->_entity, 'delete', array('id' => $created['id'])); + $this->callAPISuccess($this->entity, 'delete', array('id' => $created['id'])); } /** @@ -1119,17 +1016,17 @@ public function testGetRelationshipByTypeReciprocal() { * an incorrect one */ public function testGetRelationshipByTypeDAO() { - $this->_ids['relationship'] = $this->callAPISuccess($this->_entity, 'create', array('format.only_id' => TRUE) + + $this->_ids['relationship'] = $this->callAPISuccess($this->entity, 'create', array('format.only_id' => TRUE) + $this->_params); - $this->callAPISuccess($this->_entity, 'getcount', array( + $this->callAPISuccess($this->entity, 'getcount', array( 'contact_id_a' => $this->_cId_a, ), 1); - $result = $this->callAPISuccess($this->_entity, 'get', array( + $result = $this->callAPISuccess($this->entity, 'get', array( 'contact_id_a' => $this->_cId_a, 'relationship_type_id' => $this->_relTypeID, )); $this->assertEquals(1, $result['count']); - $result = $this->callAPISuccess($this->_entity, 'get', array( + $result = $this->callAPISuccess($this->entity, 'get', array( 'contact_id_a' => $this->_cId_a, 'relationship_type_id' => $this->_relTypeID + 1, )); @@ -1144,7 +1041,7 @@ public function testGetRelationshipByTypeDAO() { * an incorrect one */ public function testGetRelationshipByTypeArrayDAO() { - $this->callAPISuccess($this->_entity, 'create', $this->_params); + $this->callAPISuccess($this->entity, 'create', $this->_params); $org3 = $this->organizationCreate(); // lets just assume built in ones aren't being messed with! $relType2 = 5; @@ -1152,7 +1049,7 @@ public function testGetRelationshipByTypeArrayDAO() { $relType3 = 6; // Relationship 2. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType2, 'contact_id_b' => $this->_cId_b2, @@ -1160,14 +1057,14 @@ public function testGetRelationshipByTypeArrayDAO() { ); // Relationship 3. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType3, 'contact_id_b' => $org3, )) ); - $result = $this->callAPISuccess($this->_entity, 'get', array( + $result = $this->callAPISuccess($this->entity, 'get', array( 'contact_id_a' => $this->_cId_a, 'relationship_type_id' => array('IN' => array($this->_relTypeID, $relType3)), )); @@ -1186,14 +1083,14 @@ public function testGetRelationshipByTypeArrayDAO() { * an incorrect one */ public function testGetRelationshipByTypeArrayReciprocal() { - $this->callAPISuccess($this->_entity, 'create', $this->_params); + $this->callAPISuccess($this->entity, 'create', $this->_params); $org3 = $this->organizationCreate(); // lets just assume built in ones aren't being messed with! $relType2 = 5; $relType3 = 6; // Relationship 2. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType2, 'contact_id_b' => $this->_cId_b2, @@ -1201,14 +1098,14 @@ public function testGetRelationshipByTypeArrayReciprocal() { ); // Relationship 3. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType3, 'contact_id_b' => $org3, )) ); - $result = $this->callAPISuccess($this->_entity, 'get', array( + $result = $this->callAPISuccess($this->entity, 'get', array( 'contact_id' => $this->_cId_a, 'relationship_type_id' => array('IN' => array($this->_relTypeID, $relType3)), )); @@ -1229,7 +1126,7 @@ public function testGetRelationshipByTypeArrayReciprocal() { * an incorrect one */ public function testGetRelationshipByMembershipTypeDAO() { - $this->callAPISuccess($this->_entity, 'create', $this->_params); + $this->callAPISuccess($this->entity, 'create', $this->_params); $org3 = $this->organizationCreate(); // lets just assume built in ones aren't being messed with! @@ -1243,7 +1140,7 @@ public function testGetRelationshipByMembershipTypeDAO() { )); // Relationship 2. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType2, 'contact_id_b' => $this->_cId_b2, @@ -1251,7 +1148,7 @@ public function testGetRelationshipByMembershipTypeDAO() { ); // Relationship 3. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType3, 'contact_id_b' => $org3, @@ -1259,7 +1156,7 @@ public function testGetRelationshipByMembershipTypeDAO() { ); // Relationship 4 with reversal. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType1, 'contact_id_a' => $this->_cId_a, @@ -1267,7 +1164,7 @@ public function testGetRelationshipByMembershipTypeDAO() { )) ); - $result = $this->callAPISuccess($this->_entity, 'get', array( + $result = $this->callAPISuccess($this->entity, 'get', array( 'contact_id_a' => $this->_cId_a, 'membership_type_id' => $memberType, )); @@ -1286,7 +1183,7 @@ public function testGetRelationshipByMembershipTypeDAO() { * an incorrect one */ public function testGetRelationshipByMembershipTypeReciprocal() { - $this->callAPISuccess($this->_entity, 'create', $this->_params); + $this->callAPISuccess($this->entity, 'create', $this->_params); $org3 = $this->organizationCreate(); // Let's just assume built in ones aren't being messed with! @@ -1299,7 +1196,7 @@ public function testGetRelationshipByMembershipTypeReciprocal() { )); // Relationship 2. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType2, 'contact_id_b' => $this->_cId_b2, @@ -1307,7 +1204,7 @@ public function testGetRelationshipByMembershipTypeReciprocal() { ); // Relationship 4. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType3, 'contact_id_b' => $org3, @@ -1315,7 +1212,7 @@ public function testGetRelationshipByMembershipTypeReciprocal() { ); // Relationship 4 with reversal. - $this->callAPISuccess($this->_entity, 'create', + $this->callAPISuccess($this->entity, 'create', array_merge($this->_params, array( 'relationship_type_id' => $relType1, 'contact_id_a' => $this->_cId_a, @@ -1323,7 +1220,7 @@ public function testGetRelationshipByMembershipTypeReciprocal() { )) ); - $result = $this->callAPISuccess($this->_entity, 'get', array( + $result = $this->callAPISuccess($this->entity, 'get', array( 'contact_id' => $this->_cId_a, 'membership_type_id' => $memberType, )); @@ -1339,9 +1236,9 @@ public function testGetRelationshipByMembershipTypeReciprocal() { * Check for e-notices on enable & disable as reported in CRM-14350 */ public function testSetActive() { - $relationship = $this->callAPISuccess($this->_entity, 'create', $this->_params); - $this->callAPISuccess($this->_entity, 'create', array('id' => $relationship['id'], 'is_active' => 0)); - $this->callAPISuccess($this->_entity, 'create', array('id' => $relationship['id'], 'is_active' => 1)); + $relationship = $this->callAPISuccess($this->entity, 'create', $this->_params); + $this->callAPISuccess($this->entity, 'create', array('id' => $relationship['id'], 'is_active' => 0)); + $this->callAPISuccess($this->entity, 'create', array('id' => $relationship['id'], 'is_active' => 1)); } /** diff --git a/tests/phpunit/api/v3/ReportTemplateTest.php b/tests/phpunit/api/v3/ReportTemplateTest.php index baa1cfe47e77..912c566e32de 100644 --- a/tests/phpunit/api/v3/ReportTemplateTest.php +++ b/tests/phpunit/api/v3/ReportTemplateTest.php @@ -37,8 +37,6 @@ class api_v3_ReportTemplateTest extends CiviUnitTestCase { use CRMTraits_ACL_PermissionTrait; use CRMTraits_PCP_PCPTestTrait; - protected $_apiversion = 3; - protected $contactIDs = []; /** @@ -196,7 +194,7 @@ public function hookSelectWhere($entity, &$clauses) { */ public function testReportTemplateGetRowsContactSummary() { $description = "Retrieve rows from a report template (optionally providing the instance_id)."; - $result = $this->callApiSuccess('report_template', 'getrows', array( + $result = $this->callAPISuccess('report_template', 'getrows', array( 'report_id' => 'contact/summary', 'options' => array('metadata' => array('labels', 'title')), ), __FUNCTION__, __FILE__, $description, 'Getrows'); @@ -396,6 +394,11 @@ public static function getMembershipReportTemplates() { return array(array('member/detail')); } + /** + * Get the membership and contribution reports to test. + * + * @return array + */ public static function getMembershipAndContributionReportTemplatesForGroupTests() { $templates = array_merge(self::getContributionReportTemplates(), self::getMembershipReportTemplates()); foreach ($templates as $key => $value) { @@ -1202,14 +1205,14 @@ public function testPcpReportTotals() { ); $c3 = $this->contributionCreate($contribution3params); // Now the soft contribution. - $p = array( + $p = [ 'contribution_id' => $c3, 'pcp_id' => $pcp2->id, 'contact_id' => $pcpOwnerContact2Id, 'amount' => 200.00, 'currency' => 'USD', 'soft_credit_type_id' => $pcp_soft_credit_type_id, - ); + ]; $this->callAPISuccess('contribution_soft', 'create', $p); $template = 'contribute/pcp'; @@ -1231,7 +1234,7 @@ public function testPcpReportTotals() { */ public function testGetAddressColumns() { $template = 'event/participantlisting'; - $rows = $this->callAPISuccess('report_template', 'getrows', [ + $this->callAPISuccess('report_template', 'getrows', [ 'report_id' => $template, 'fields' => [ 'sort_name' => '1', diff --git a/tests/phpunit/api/v3/SettingTest.php b/tests/phpunit/api/v3/SettingTest.php index aa75cf711572..f8d6ed962064 100644 --- a/tests/phpunit/api/v3/SettingTest.php +++ b/tests/phpunit/api/v3/SettingTest.php @@ -110,7 +110,6 @@ public function testGetFields() { public function testGetFieldsCaching() { $settingsMetadata = array(); Civi::cache('settings')->set('settingsMetadata_' . \CRM_Core_Config::domainID() . '_', $settingsMetadata); - Civi::cache('settings')->set(\Civi\Core\SettingsMetadata::ALL, $settingsMetadata); $result = $this->callAPISuccess('setting', 'getfields', array()); $this->assertArrayNotHasKey('customCSSURL', $result['values']); $this->quickCleanup(array('civicrm_cache')); diff --git a/tests/phpunit/api/v3/UFFieldTest.php b/tests/phpunit/api/v3/UFFieldTest.php index 945bc52725b8..a422c8ebd86b 100644 --- a/tests/phpunit/api/v3/UFFieldTest.php +++ b/tests/phpunit/api/v3/UFFieldTest.php @@ -27,21 +27,29 @@ /** * Test class for UFGroup API - civicrm_uf_* + * * @todo Split UFGroup and UFJoin tests * * @package CiviCRM * @group headless */ class api_v3_UFFieldTest extends CiviUnitTestCase { + /** * ids from the uf_group_test.xml fixture + * * @var int */ protected $_ufGroupId = 11; + protected $_ufFieldId; + protected $_contactId = 69; + protected $_apiversion = 3; + protected $_params; + protected $_entity = 'uf_field'; /** @@ -52,14 +60,14 @@ class api_v3_UFFieldTest extends CiviUnitTestCase { protected function setUp() { parent::setUp(); $this->quickCleanup( - array( + [ 'civicrm_group', 'civicrm_contact', 'civicrm_uf_group', 'civicrm_uf_field', 'civicrm_uf_join', 'civicrm_uf_match', - ) + ] ); $op = new PHPUnit_Extensions_Database_Operation_Insert(); @@ -68,9 +76,9 @@ protected function setUp() { $this->createFlatXMLDataSet(dirname(__FILE__) . '/dataset/uf_group_test.xml') ); - $this->callAPISuccess('uf_field', 'getfields', array('cache_clear' => 1)); + $this->callAPISuccess('uf_field', 'getfields', ['cache_clear' => 1]); - $this->_params = array( + $this->_params = [ 'field_name' => 'phone', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', @@ -81,7 +89,7 @@ protected function setUp() { 'location_type_id' => 1, 'phone_type_id' => 1, 'uf_group_id' => $this->_ufGroupId, - ); + ]; } /** @@ -91,13 +99,13 @@ protected function setUp() { */ public function tearDown() { $this->quickCleanup( - array( + [ 'civicrm_group', 'civicrm_contact', 'civicrm_uf_group', 'civicrm_uf_join', 'civicrm_uf_match', - ) + ] ); } @@ -127,8 +135,8 @@ public function testCreateUFFieldWithBadFieldName() { * Failure test for bad parameters. */ public function testCreateUFFieldWithWrongParams() { - $this->callAPIFailure('uf_field', 'create', array('field_name' => 'test field')); - $this->callAPIFailure('uf_field', 'create', array('label' => 'name-less field')); + $this->callAPIFailure('uf_field', 'create', ['field_name' => 'test field']); + $this->callAPIFailure('uf_field', 'create', ['label' => 'name-less field']); } /** @@ -140,21 +148,21 @@ public function testCreateUFFieldWithDefaultAutoWeight() { $params1 = $this->_params; $ufField1 = $this->callAPISuccess('uf_field', 'create', $params1); $this->assertEquals(1, $ufField1['values'][$ufField1['id']]['weight']); - $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array( - 1 => array($ufField1['id'], 'Int'), - )); + $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', [ + 1 => [$ufField1['id'], 'Int'], + ]); $params2 = $this->_params; // needs to be a different field $params2['location_type_id'] = 2; $ufField2 = $this->callAPISuccess('uf_field', 'create', $params2); $this->assertEquals(1, $ufField2['values'][$ufField2['id']]['weight']); - $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array( - 1 => array($ufField2['id'], 'Int'), - )); - $this->assertDBQuery(2, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', array( - 1 => array($ufField1['id'], 'Int'), - )); + $this->assertDBQuery(1, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', [ + 1 => [$ufField2['id'], 'Int'], + ]); + $this->assertDBQuery(2, 'SELECT weight FROM civicrm_uf_field WHERE id = %1', [ + 1 => [$ufField1['id'], 'Int'], + ]); } /** @@ -162,9 +170,9 @@ public function testCreateUFFieldWithDefaultAutoWeight() { */ public function testDeleteUFField() { $ufField = $this->callAPISuccess('uf_field', 'create', $this->_params); - $params = array( + $params = [ 'field_id' => $ufField['id'], - ); + ]; $this->callAPIAndDocument('uf_field', 'delete', $params, __FUNCTION__, __FILE__); } @@ -173,7 +181,7 @@ public function testDeleteUFField() { */ public function testGetUFFieldSuccess() { $this->callAPISuccess($this->_entity, 'create', $this->_params); - $result = $this->callAPIAndDocument($this->_entity, 'get', array(), __FUNCTION__, __FILE__); + $result = $this->callAPIAndDocument($this->_entity, 'get', [], __FUNCTION__, __FILE__); $this->getAndCheck($this->_params, $result['id'], $this->_entity); } @@ -181,8 +189,8 @@ public function testGetUFFieldSuccess() { * Create / updating field. */ public function testReplaceUFFields() { - $baseFields = array(); - $baseFields[] = array( + $baseFields = []; + $baseFields[] = [ 'field_name' => 'first_name', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', @@ -190,8 +198,8 @@ public function testReplaceUFFields() { 'label' => 'Test First Name', 'is_searchable' => 1, 'is_active' => 1, - ); - $baseFields[] = array( + ]; + $baseFields[] = [ 'field_name' => 'country', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', @@ -200,8 +208,8 @@ public function testReplaceUFFields() { 'is_searchable' => 1, 'is_active' => 1, 'location_type_id' => 1, - ); - $baseFields[] = array( + ]; + $baseFields[] = [ 'field_name' => 'phone', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', @@ -211,17 +219,17 @@ public function testReplaceUFFields() { 'is_active' => 1, 'location_type_id' => 1, 'phone_type_id' => 1, - ); + ]; - $params = array( + $params = [ 'uf_group_id' => $this->_ufGroupId, 'option.autoweight' => FALSE, 'values' => $baseFields, 'check_permissions' => TRUE, - ); + ]; $result = $this->callAPIAndDocument('uf_field', 'replace', $params, __FUNCTION__, __FILE__); - $inputsByName = CRM_Utils_Array::index(array('field_name'), $params['values']); + $inputsByName = CRM_Utils_Array::index(['field_name'], $params['values']); $this->assertEquals(count($params['values']), count($result['values'])); foreach ($result['values'] as $outUfField) { $this->assertTrue(is_string($outUfField['field_name'])); @@ -244,7 +252,7 @@ public function testReplaceUFFields() { */ public function testProfilesWithoutACL() { $this->createLoggedInUser(); - $baseFields[] = array( + $baseFields[] = [ 'field_name' => 'first_name', 'field_type' => 'Contact', 'visibility' => 'Public Pages and Listings', @@ -252,14 +260,14 @@ public function testProfilesWithoutACL() { 'label' => 'Test First Name', 'is_searchable' => 1, 'is_active' => 1, - ); - CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM'); - $params = array( + ]; + CRM_Core_Config::singleton()->userPermissionClass->permissions = ['access CiviCRM']; + $params = [ 'uf_group_id' => $this->_ufGroupId, 'option.autoweight' => FALSE, 'values' => $baseFields, 'check_permissions' => TRUE, - ); + ]; $this->_loggedInUser = CRM_Core_Session::singleton()->get('userID'); $this->callAPIFailure('uf_field', 'replace', $params); } @@ -269,11 +277,11 @@ public function testProfilesWithoutACL() { */ public function testACLPermissionforProfiles() { $this->createLoggedInUser(); - $this->_permissionedGroup = $this->groupCreate(array( + $this->_permissionedGroup = $this->groupCreate([ 'title' => 'Edit Profiles', 'is_active' => 1, 'name' => 'edit-profiles', - )); + ]); $this->setupACL(TRUE); $this->testReplaceUFFields(); } diff --git a/tests/phpunit/api/v3/custom_api/MailingProviderData.php b/tests/phpunit/api/v3/custom_api/MailingProviderData.php index f01bf6ec9809..8d250cdc6723 100644 --- a/tests/phpunit/api/v3/custom_api/MailingProviderData.php +++ b/tests/phpunit/api/v3/custom_api/MailingProviderData.php @@ -47,7 +47,7 @@ class CRM_Omnimail_DAO_MailingProviderData extends CRM_Core_DAO { /** * Should CiviCRM log any modifications to this table in the civicrm_log table. * - * @var boolean + * @var bool */ protected static $_log = FALSE; /** diff --git a/tests/phpunit/api/v3/dataset/email_contact_17.xml b/tests/phpunit/api/v3/dataset/email_contact_17.xml deleted file mode 100644 index 4239ae0f6f20..000000000000 --- a/tests/phpunit/api/v3/dataset/email_contact_17.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - -
» {ts}Drupal Access Control{/ts}» {ts 1=$config->userFramework}%1 Access Control{/ts} {ts}Grant access to CiviCRM components and other CiviCRM permissions.{/ts}» {ts}Joomla Access Control{/ts}{ts}Grant access to CiviCRM components and other CiviCRM permissions.{/ts}» {ts}WordPress Access Control{/ts}{ts}Grant access to CiviCRM components and other CiviCRM permissions.{/ts}
{ts}Use following steps if you need to control View and/or Edit permissions for specific contact groups, specific profiles or specific custom data fields.{/ts}
- id - contact_id - location_type_id - email - is_primary - is_billing - on_hold - is_bulkmail - hold_date - reset_date - - 100 - 17 - 1 - TestContact@example.com - 1 - 1 - 0 - 0 - - - -
- diff --git a/xml/schema/Contact/Contact.xml b/xml/schema/Contact/Contact.xml index cfc14f5bd136..b74654f4d50d 100644 --- a/xml/schema/Contact/Contact.xml +++ b/xml/schema/Contact/Contact.xml @@ -352,6 +352,7 @@ 32 API Key for validating requests related to this contact. 2.2 + true index_api_key diff --git a/xml/templates/dao.tpl b/xml/templates/dao.tpl index f4e39f4d6765..8e634226a353 100644 --- a/xml/templates/dao.tpl +++ b/xml/templates/dao.tpl @@ -128,6 +128,9 @@ class {$table.className} extends CRM_Core_DAO {ldelim} {if $field.rule} 'rule' => '{$field.rule}', {/if} {* field.rule *} +{if $field.protected} + 'protected' => '{$field.protected}', +{/if} {if $field.default || $field.default === '0'} 'default' => '{if ($field.default[0]=="'" or $field.default[0]=='"')}{$field.default|substring:1:-1}{else}{$field.default}{/if}', {/if} {* field.default *} @@ -151,7 +154,7 @@ class {$table.className} extends CRM_Core_DAO {ldelim} ), {/if} {if $field.pseudoconstant} - 'pseudoconstant' => {$field.pseudoconstant|@print_array} + 'pseudoconstant' => {$field.pseudoconstant|@print_array}, {/if} {* field.pseudoconstant *} ), {/foreach} {* table.fields *} );